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.
--- 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(