From ef1ae3ad01ab2a02c085dbbe5473d8109f5f1aea Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Tue, 30 Apr 2019 21:15:18 -0700 Subject: vpp_config: Update deprecated platform.linux_distribution() platform.linux_distribution() was deprecated in python 3.5 and removed in 3.8. update to use distro.linux_distribution(). >>> import platform >>> platform.linux_distribution() ('Ubuntu', '16.04', 'xenial') >>> import distro >>> distro.linux_distribution() ('Ubuntu', '16.04', 'xenial') Change-Id: Ia8a7cd2d78fd56145cdded0b9d361a1b45bb4d27 Signed-off-by: Paul Vinciguerra --- extras/vpp_config/setup.py | 2 +- extras/vpp_config/vpplib/VPPUtil.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/extras/vpp_config/setup.py b/extras/vpp_config/setup.py index f04669f7e42..977ad38ca98 100644 --- a/extras/vpp_config/setup.py +++ b/extras/vpp_config/setup.py @@ -9,7 +9,7 @@ setup(name="vpp_config", keywords="vppconfig", url='https://wiki.fd.io/view/VPP', py_modules=['vpp_config'], - install_requires=['pyyaml', 'requests'], + install_requires=['distro', 'pyyaml', 'requests'], extra_requires=["ipaddress; python_version < '3.3'"], packages=['vpplib'], entry_points={ diff --git a/extras/vpp_config/vpplib/VPPUtil.py b/extras/vpp_config/vpplib/VPPUtil.py index 5ed46f2452e..9835f51f0fd 100644 --- a/extras/vpp_config/vpplib/VPPUtil.py +++ b/extras/vpp_config/vpplib/VPPUtil.py @@ -17,11 +17,12 @@ from __future__ import print_function import logging import re import subprocess -import platform import requests from collections import Counter +import distro + ubuntu_pkgs = {'release': ['vpp', 'vpp-plugins', 'vpp-api-java', 'vpp-api-lua', 'vpp-api-python', 'vpp-dbg', 'vpp-dev'], 'master': ['vpp', 'vpp-plugin-core', 'vpp-api-python', @@ -705,14 +706,14 @@ class VPPUtil(object): :rtype: list """ - distro = platform.linux_distribution() - if distro[0] == 'Ubuntu' or \ - distro[0] == 'CentOS Linux' or \ - distro[:7] == 'Red Hat': - return distro + dist = distro.linux_distribution() + if dist[0] == 'Ubuntu' or \ + dist[0] == 'CentOS Linux' or \ + dist[:7] == 'Red Hat': + return dist else: raise RuntimeError( - 'Linux Distribution {} is not supported'.format(distro[0])) + 'Linux Distribution {} is not supported'.format(dist[0])) @staticmethod def version(): -- cgit 1.2.3-korg