Backed out changeset fe995d56c949 3.25
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 28 Mar 2017 15:03:15 +0200
branch3.25
changeset 12115 8d0127498a28
parent 12109 425be06bb1e8
child 12116 3522b19f35d6
Backed out changeset fe995d56c949 available_cubes should not strip cubicweb_prefix but return actual package name for cube as package, since its output is also used to e.g. get ccplugin or site_cubicweb module name. Original aim of this set was to fix output of the "cubicweb-ctl list" command. This will be done by an alternate implementation in a later cset.
cubicweb/cwconfig.py
cubicweb/test/unittest_cwconfig.py
--- a/cubicweb/cwconfig.py	Fri Mar 24 14:56:48 2017 +0100
+++ b/cubicweb/cwconfig.py	Tue Mar 28 15:03:15 2017 +0200
@@ -512,7 +512,6 @@
     @classmethod
     def available_cubes(cls):
         cubes = set()
-        prefix = 'cubicweb_'
         for entry_point in pkg_resources.iter_entry_points(
                 group='cubicweb.cubes', name=None):
             try:
@@ -521,11 +520,11 @@
                 continue
             else:
                 modname = module.__name__
-                if not modname.startswith(prefix):
+                if not modname.startswith('cubicweb_'):
                     cls.warning('entry point %s does not appear to be a cube',
                                 entry_point)
                     continue
-                cubes.add(modname[len(prefix):])
+                cubes.add(modname)
         # Legacy cubes.
         for directory in cls.cubes_search_path():
             if not exists(directory):
--- a/cubicweb/test/unittest_cwconfig.py	Fri Mar 24 14:56:48 2017 +0100
+++ b/cubicweb/test/unittest_cwconfig.py	Tue Mar 28 15:03:15 2017 +0200
@@ -127,9 +127,9 @@
     @patch('pkg_resources.iter_entry_points', side_effect=iter_entry_points)
     def test_available_cubes(self, mock_iter_entry_points):
         expected_cubes = [
-            'card', 'comment', 'email', 'file',
-            'forge', 'localperms',
-            'mycube', 'tag',
+            'card', 'comment', 'cubicweb_comment', 'cubicweb_email', 'file',
+            'cubicweb_file', 'cubicweb_forge', 'localperms',
+            'cubicweb_mycube', 'tag',
         ]
         self._test_available_cubes(expected_cubes)
         mock_iter_entry_points.assert_called_once_with(