Commit 6d935da0 authored by Adrien Di Mascio's avatar Adrien Di Mascio
Browse files

[devctl] make i18n custom message extractors work with legacy layouts

distname needs to be "cubicweb_<cubename>", even with legacy layouts
for pkg.load_entry_point() to work

closes #16272177

branch : 3.24
parent 7534b32c45e3
......@@ -569,8 +569,12 @@ def update_cube_catalogs(cubedir):
cubedir = osp.abspath(osp.normpath(cubedir))
workdir = tempfile.mkdtemp()
distname = osp.basename(cubedir)
cubename = distname.split('_')[-1]
cubename = osp.basename(cubedir)
if cubename.startswith('cubicweb_'): # new layout
distname = cubename
cubename = cubename[len('cubicweb_'):]
distname = 'cubicweb_' + cubename
print('cubedir', cubedir)
extract_cls = I18nCubeMessageExtractor
......@@ -136,11 +136,11 @@ class I18nCollectorTest(BaseTestCase):
@patch('pkg_resources.load_entry_point', return_value=FakeMessageExtractor)
def test_cube_custom_extractor(self, mock_load_entry_point):
for distname, cubedir in [
osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube')),
distname = 'cubicweb_i18ntestcube' # same for new and legacy layout
for cubedir in [
osp.join(DATADIR, 'libpython', 'cubicweb_i18ntestcube'),
# Legacy cubes.
('i18ntestcube', osp.join(DATADIR, 'cubes', 'i18ntestcube')),
osp.join(DATADIR, 'cubes', 'i18ntestcube'),
with self.subTest(cubedir=cubedir):
with capture_stdout() as stream:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment