rqt gui renaming issue

mkdir -p tmp_catkin_ws/src
cd tmp_catkin_ws/src
catkin_init_workspace
git clone https://github.com/lucasw/rqt_mypkg.git
cd ..
catkin_make
source devel/setup.bash
rosrun rqt_mypkg rqt_mypkg

it works

cd src/rqt_mypkg
git checkout name_change_test
cd ../..
catkin_make
rosrun rqt_mypkg rqt_mypkg

it does not work:

Traceback (most recent call last):
  File "/home/lucasw/tmp_catkin_ws/src/rqt_mypkg/rqt_example_py/scripts/rqt_mypkg", line 5, in <module>
      from rqt_mypkg.mypkg import MyPlugin
      ImportError: No module named mypkg

Actually it does work fine once I have correct a missing file… so there is no issue here? It looks like there is no flexibility to have the src/dir_name be different than the package name.

$ git diff master
diff --git a/rqt_example_py/plugin.xml b/rqt_example_py/plugin.xml
index 298a298..64634dc 100644
--- a/rqt_example_py/plugin.xml
+++ b/rqt_example_py/plugin.xml
@@ -1,5 +1,5 @@
 <library path="src">
-  <class name="My Plugin" type="rqt_mypkg.my_module.MyPlugin" base_class_type="rqt_gui_py::Plugin">
+  <class name="My Plugin" type="rqt_mypkg.mypkg.MyPlugin" base_class_type="rqt_gui_py::Plugin">
     <description>
       An example Python GUI plugin to create a great user interface.
     </description>
diff --git a/rqt_example_py/scripts/rqt_mypkg b/rqt_example_py/scripts/rqt_mypkg
index 6dd18aa..b3d934a 100755
--- a/rqt_example_py/scripts/rqt_mypkg
+++ b/rqt_example_py/scripts/rqt_mypkg
@@ -2,9 +2,9 @@
 
 import sys
 
-from rqt_mypkg.my_module import MyPlugin
+from rqt_mypkg.mypkg import MyPlugin
 from rqt_gui.main import Main
 
-plugin = 'rqt_mypkg'
+plugin = 'mypkg'
 main = Main(filename=plugin)
 sys.exit(main.main(standalone=plugin))
diff --git a/rqt_example_py/src/rqt_mypkg/my_module.py b/rqt_example_py/src/rqt_mypkg/my_module.py
deleted file mode 100644
index 5b2d41b..0000000
--- a/rqt_example_py/src/rqt_mypkg/my_module.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import os
-import rospy
-
-from qt_gui.plugin import Plugin
-from python_qt_binding import loadUi
-from python_qt_binding.QtGui import QWidget
-
-class MyPlugin(Plugin):
-
-    def __init__(self, context):
-        super(MyPlugin, self).__init__(context)
-        # Give QObjects reasonable names
-        self.setObjectName('MyPlugin')
-

cd
mkdir -p tmp_catkin_ws2/src
cd tmp_catkin_ws2/src
catkin_init_workspace
git clone https://github.com/lucasw/rqt_mypkg.git
cd rqt_mypkg
git checkout name_change_test
cd ../..
catkin_make
source devel/setup.bash
rosrun rqt_mypkg rqt_mypkg
Written on March 15, 2016