doc: replace deprecated distutils version parsing
PATCH 1/1 doc: replace deprecated distutils version parsing
When using Python 3.10, this warning appears:
DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12.
Use setuptools or check PEP 632 for potential alternatives
The PEP 632 recommends replacing "distutils.version" with "packaging".
Bugzilla ID: 914
Cc: [email protected]
--- buildtools/call-sphinx-build.py | 4 ++-- doc/guides/conf.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
buildtools/call-sphinx-build.py +2 -2
@@ -7,7 +7,7 @@ import os from os.path import join from subprocess import run, PIPE, STDOUT -from distutils.version import StrictVersion +from packaging.version import Version # assign parameters to variables (sphinx, version, src, dst, *extra_args) = sys.argv[1:]
@@ -19,7 +19,7 @@ ver = run([sphinx, '--version'], stdout=PIPE, stderr=STDOUT).stdout.decode().split()[-1] sphinx_cmd = [sphinx] + extra_args -if StrictVersion(ver) >= StrictVersion('1.7'): +if Version(ver) >= Version('1.7'): sphinx_cmd += ['-j', 'auto'] # find all the files sphinx will process so we can write them as dependencies
doc/guides/conf.py +3 -3
@@ -3,7 +3,7 @@ # Copyright(c) 2010-2015 Intel Corporation from docutils import nodes -from distutils.version import LooseVersion +from packaging.version import Version from sphinx import __version__ as sphinx_version from os import listdir from os import environ
@@ -28,7 +28,7 @@ project = 'Data Plane Development Kit' html_logo = '../logo/DPDK_logo_vertical_rev_small.png' -if LooseVersion(sphinx_version) >= LooseVersion('3.5'): +if Version(sphinx_version) >= Version('3.5'): html_permalinks = False else: html_add_permalinks = ""
@@ -427,7 +427,7 @@ def setup(app): 'Features availability for Timer adapters', 'Feature') - if LooseVersion(sphinx_version) < LooseVersion('1.3.1'): + if Version(sphinx_version) < Version('1.3.1'): print('Upgrade sphinx to version >= 1.3.1 for ' 'improved Figure/Table number handling.', file=stderr)
Signature · 1 line
2.34.1
Quoted 6 lines · Thomas Monjalon
When using Python 3.10, this warning appears:
DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12.
Use setuptools or check PEP 632 for potential alternatives
Quoted 7 lines
The PEP 632 recommends replacing "distutils.version" with "packaging".
Bugzilla ID: 914
Cc: [email protected]Reported-by Jerin Jacob <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
Quoted 61 lines
--- buildtools/call-sphinx-build.py | 4 ++-- doc/guides/conf.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)buildtools/call-sphinx-build.py +2
-2@@ -7,7 +7,7 @@ import os from os.path import join from subprocess import run, PIPE, STDOUT -from distutils.version import StrictVersion +from packaging.version import Version # assign parameters to variables (sphinx, version, src, dst, *extra_args) = sys.argv[1:]@@ -19,7 +19,7 @@ ver = run([sphinx, '--version'], stdout=PIPE, stderr=STDOUT).stdout.decode().split()[-1] sphinx_cmd = [sphinx] + extra_args -if StrictVersion(ver) >= StrictVersion('1.7'): +if Version(ver) >= Version('1.7'): sphinx_cmd += ['-j', 'auto'] # find all the files sphinx will process so we can write them as dependenciesdoc/guides/conf.py +3
-4@@ -3,7 +3,7 @@ # Copyright(c) 2010-2015 Intel Corporation from docutils import nodes -from distutils.version import LooseVersion +from packaging.version import Version from sphinx import __version__ as sphinx_version from os import listdir from os import environ@@ -28,7 +28,7 @@ project = 'Data Plane Development Kit' html_logo = '../logo/DPDK_logo_vertical_rev_small.png' -if LooseVersion(sphinx_version) >= LooseVersion('3.5'): +if Version(sphinx_version) >= Version('3.5'): html_permalinks = False else: html_add_permalinks = ""@@ -427,7 +427,7 @@ def setup(app): 'Features availability for Timer adapters', 'Feature') - if LooseVersion(sphinx_version) < LooseVersion('1.3.1'): + if Version(sphinx_version) < Version('1.3.1'): print('Upgrade sphinx to version >= 1.3.1 for ' 'improved Figure/Table number handling.', file=stderr) --2.34.1
Thomas Monjalon
Applied11/01/2022 14:11, Jerin Jacob:
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
When using Python 3.10, this warning appears:
DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12.
Use setuptools or check PEP 632 for potential alternativesThe PEP 632 recommends replacing "distutils.version" with "packaging".
Quoted 7 lines
Quoted 5 lines
Bugzilla ID: 914
Cc: [email protected]Reported-by Jerin Jacob <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Tested-by Jerin Jacob <[email protected]>
Applied