diff --git a/pymod2pkg/__init__.py b/pymod2pkg/__init__.py index e739ac0..29fbeed 100644 --- a/pymod2pkg/__init__.py +++ b/pymod2pkg/__init__.py @@ -13,7 +13,7 @@ from __future__ import print_function import argparse -import platform +import distro import re @@ -340,17 +340,19 @@ OPENSTACK_UPSTREAM_PKG_MAP = [ def get_pkg_map(dist): - if dist.lower().find('suse') != -1: + d_lower = dist.lower() + if 'suse' in d_lower or 'sles' in d_lower: return SUSE_PKG_MAP - if dist.lower().find('ubuntu') != -1: + if 'ubuntu' in d_lower: return UBUNTU_PKG_MAP return RDO_PKG_MAP def get_default_tr_func(dist): - if dist.lower().find('suse') != -1: + d_lower = dist.lower() + if 'suse' in d_lower or 'sles' in d_lower: return default_suse_tr - if dist.lower().find('ubuntu') != -1: + if 'ubuntu' in d_lower: return default_ubuntu_tr return default_rdo_tr @@ -360,7 +362,7 @@ def module2package(mod, dist, pkg_map=None, py_vers=('py',)): mod: python module name dist: a linux distribution as returned by - `platform.linux_distribution()[0]` + `distro.LinuxDistribution().id().partition(' ')[0]` pkg_map: a custom package mapping. None means autodetected based on the given dist parameter py_vers: a list of python versions the function should return. Default is @@ -412,9 +414,9 @@ def main(): parser = argparse.ArgumentParser(description='Python module name to' 'package name') group = parser.add_mutually_exclusive_group() - group.add_argument('--dist', help='distribution style ' - '(default: %(default)s)', - default=platform.linux_distribution()[0]) + group.add_argument( + '--dist', help='distribution style (default: %(default)s)', + default=distro.LinuxDistribution().id().partition(' ')[0]) group.add_argument('--upstream', help='map to OpenStack project name', action='store_true') parser.add_argument('--pyver', help='Python versions to return. "py" is ' diff --git a/requirements.txt b/requirements.txt index 0bb2deb..35cc597 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. +distro pbr!=2.1.0,>=2.0.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index c91f589..1ad7343 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,11 +7,10 @@ author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/pymod2pkg/latest/ classifier = - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 Intended Audience :: Developers License :: OSI Approved :: Apache Software License Topic :: Software Development :: Libraries diff --git a/test-requirements.txt b/test-requirements.txt index e3570d6..1de0ae7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,5 +5,5 @@ stestr>=2.0.0 # Apache-2.0 testresources>=2.0.0 # Apache-2.0/BSD testtools>=2.2.0 # MIT -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +sphinx!=1.6.6,!=1.6.7;python_version>='3.4' # BSD openstackdocstheme>=1.18.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 80b259c..38dc7dc 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ commands = stestr run {posargs} [testenv:pep8] deps = {[testenv]deps} - flake8<3.7.0,>=3.6.0 + flake8<3.8.0,>=3.7.0 commands = flake8 [testenv:venv]