Remove "distutils" dependency

The library "distutils" will be deprecated in Python 3.10:
https://peps.python.org/pep-0632/

Story: #45393
Change-Id: I7cf48a5e56c28d6161c6dfef162871cedb1f1c46
This commit is contained in:
Rodolfo Alonso Hernandez 2022-05-12 23:27:29 +00:00
parent 7911ff1820
commit f66debc7ec
3 changed files with 6 additions and 12 deletions

View File

@ -17,7 +17,7 @@
global flags
"""
from distutils.version import LooseVersion
from packaging import version
from os_ken import cfg
@ -86,13 +86,6 @@ DEFAULT_ZSERV_ROUTER_ID = '1.1.1.1'
# should be None.
DEFAULT_ZSERV_FRR_VERSION = '0.0'
# Hack: In oslo_config.cfg.Opt, ConfigType might access __class__ attribute
# for equal comparison, but on Python 2, LooseVersion does not have __class__
# attribute and it causes AttributeError. So here inject __class__ attribute
# into LooseVersion class.
if not hasattr(LooseVersion, '__class__'):
LooseVersion.__class__ = LooseVersion
CONF.register_cli_opts([
cfg.StrOpt(
'server-host', default=DEFAULT_ZSERV_HOST,
@ -124,6 +117,6 @@ CONF.register_cli_opts([
help='Initial Router ID used by Zebra protocol service '
'(default: %s)' % DEFAULT_ZSERV_ROUTER_ID),
cfg.Opt(
'frr-version', LooseVersion, default=DEFAULT_ZSERV_FRR_VERSION,
'frr-version', version.Version, default=DEFAULT_ZSERV_FRR_VERSION,
help='FRRouting version when integrated with FRRouting (e.g., 3.0)'),
], group='zapi')

View File

@ -23,9 +23,9 @@ import abc
import socket
import struct
import logging
from distutils.version import LooseVersion
import netaddr
from packaging import version as packaging_version
import six
from os_ken import flags as cfg_flags # For loading 'zapi' option definition
@ -45,8 +45,8 @@ LOG = logging.getLogger(__name__)
_DEFAULT_VERSION = 3
_DEFAULT_FRR_VERSION = 4
_FRR_VERSION_2_0 = LooseVersion('2.0')
_FRR_VERSION_3_0 = LooseVersion('3.0')
_FRR_VERSION_2_0 = packaging_version.Version('2.0')
_FRR_VERSION_3_0 = packaging_version.Version('3.0')
# Constants in quagga/lib/zebra.h

View File

@ -8,6 +8,7 @@ msgpack>=1.0.0 # RPC library, BGP speaker(net_cntl)
netaddr>=0.7.18 # BSD
oslo.config>=5.1.0
ovs>=2.8.0 # OVSDB
packaging>=20.4 # Apache-2.0
Routes>=2.3.1 # MIT
six>=1.10.0
WebOb>=1.8.2 # wsgi