Switch away from deprecated distribution lookup
Python 3.8 removed the linux_distribution support, we need to switch to the distro package. To pass testing, we need to update to a newer flake8 version. Also update setuptools annotation since Python 2.x support has been dropped. Change-Id: I40768af80ff376866b1070026a93fd3f4bb1c2e4
This commit is contained in:
parent
5012af2f47
commit
037724dd88
|
@ -13,7 +13,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import platform
|
import distro
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
@ -340,17 +340,19 @@ OPENSTACK_UPSTREAM_PKG_MAP = [
|
||||||
|
|
||||||
|
|
||||||
def get_pkg_map(dist):
|
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
|
return SUSE_PKG_MAP
|
||||||
if dist.lower().find('ubuntu') != -1:
|
if 'ubuntu' in d_lower:
|
||||||
return UBUNTU_PKG_MAP
|
return UBUNTU_PKG_MAP
|
||||||
return RDO_PKG_MAP
|
return RDO_PKG_MAP
|
||||||
|
|
||||||
|
|
||||||
def get_default_tr_func(dist):
|
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
|
return default_suse_tr
|
||||||
if dist.lower().find('ubuntu') != -1:
|
if 'ubuntu' in d_lower:
|
||||||
return default_ubuntu_tr
|
return default_ubuntu_tr
|
||||||
return default_rdo_tr
|
return default_rdo_tr
|
||||||
|
|
||||||
|
@ -360,7 +362,7 @@ def module2package(mod, dist, pkg_map=None, py_vers=('py',)):
|
||||||
|
|
||||||
mod: python module name
|
mod: python module name
|
||||||
dist: a linux distribution as returned by
|
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
|
pkg_map: a custom package mapping. None means autodetected based on the
|
||||||
given dist parameter
|
given dist parameter
|
||||||
py_vers: a list of python versions the function should return. Default is
|
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'
|
parser = argparse.ArgumentParser(description='Python module name to'
|
||||||
'package name')
|
'package name')
|
||||||
group = parser.add_mutually_exclusive_group()
|
group = parser.add_mutually_exclusive_group()
|
||||||
group.add_argument('--dist', help='distribution style '
|
group.add_argument(
|
||||||
'(default: %(default)s)',
|
'--dist', help='distribution style (default: %(default)s)',
|
||||||
default=platform.linux_distribution()[0])
|
default=distro.LinuxDistribution().id().partition(' ')[0])
|
||||||
group.add_argument('--upstream', help='map to OpenStack project name',
|
group.add_argument('--upstream', help='map to OpenStack project name',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('--pyver', help='Python versions to return. "py" is '
|
parser.add_argument('--pyver', help='Python versions to return. "py" is '
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# The order of packages is significant, because pip processes them in the order
|
# 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
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
|
distro
|
||||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
|
|
|
@ -7,11 +7,10 @@ author = OpenStack
|
||||||
author-email = openstack-discuss@lists.openstack.org
|
author-email = openstack-discuss@lists.openstack.org
|
||||||
home-page = https://docs.openstack.org/pymod2pkg/latest/
|
home-page = https://docs.openstack.org/pymod2pkg/latest/
|
||||||
classifier =
|
classifier =
|
||||||
Programming Language :: Python :: 2
|
|
||||||
Programming Language :: Python :: 2.7
|
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.6
|
Programming Language :: Python :: 3.6
|
||||||
Programming Language :: Python :: 3.7
|
Programming Language :: Python :: 3.7
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
Intended Audience :: Developers
|
Intended Audience :: Developers
|
||||||
License :: OSI Approved :: Apache Software License
|
License :: OSI Approved :: Apache Software License
|
||||||
Topic :: Software Development :: Libraries
|
Topic :: Software Development :: Libraries
|
||||||
|
|
|
@ -5,5 +5,5 @@ stestr>=2.0.0 # Apache-2.0
|
||||||
testresources>=2.0.0 # Apache-2.0/BSD
|
testresources>=2.0.0 # Apache-2.0/BSD
|
||||||
testtools>=2.2.0 # MIT
|
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
|
openstackdocstheme>=1.18.1 # Apache-2.0
|
||||||
|
|
Loading…
Reference in New Issue