From 9eb8f76e64601fc3dfc1ddcdb7a67d096a1437b9 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Wed, 11 Oct 2017 14:40:14 +0200 Subject: [PATCH] Change default translation for py2 in RDO RDO does not have python2-foo packages for everything but python2-foo packages usually Provides python-foo packages. So change the default translation for python2 packages to python-foo (instead of python2-foo). Change-Id: I51cacf2de8fd108b224f442bd760fa8ba43daec9 --- pymod2pkg/__init__.py | 2 +- tests.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pymod2pkg/__init__.py b/pymod2pkg/__init__.py index 5d78508..f99011b 100644 --- a/pymod2pkg/__init__.py +++ b/pymod2pkg/__init__.py @@ -79,7 +79,7 @@ def default_rdo_tr(mod): pkg = pkg.replace('_', '-').replace('.', '-').lower() if not pkg.startswith('python-'): pkg = 'python-' + pkg - py2pkg = re.sub('python', 'python2', pkg) + py2pkg = pkg py3pkg = re.sub('python', 'python3', pkg) return (pkg, py2pkg, py3pkg) diff --git a/tests.py b/tests.py index 877321f..375f3e3 100644 --- a/tests.py +++ b/tests.py @@ -150,7 +150,11 @@ class Pymod2PkgTests(unittest.TestCase): def test_default_translation_py2py3_rdo(self): self.assertEqual(pymod2pkg.module2package('oslo.db', 'fedora', py_vers=['py2', 'py3']), - ['python2-oslo-db', 'python3-oslo-db']) + ['python-oslo-db', 'python3-oslo-db']) + self.assertEqual(pymod2pkg.module2package('foobar', 'fedora', + py_vers=['py', 'py2', 'py3']), + ['python-foobar', 'python-foobar', 'python3-foobar']) + self.assertEqual(pymod2pkg.module2package('Babel', 'fedora', py_vers=['py2', 'py3']), ['python-babel', 'python3-babel'])