1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Description: Do not use the deprecated distutils module
distutils.sysconfig.get_config_var ⇒ sysconfig.get_config_var
distutils.sysconfig.get_python_lib ⇒ sysconfig.get_path
distutils.version.LooseVersion ⇒ packaging.version.Version
Author: Rafael Laboissière <rafael@debian.org>
Forwarded: https://sourceforge.net/p/xmds/mailman/message/59239079/
Last-Update: 2025-09-25
--- xmds2-3.1.0+dfsg2.orig/xpdeint/waf/waflib/Tools/python.py
+++ xmds2-3.1.0+dfsg2/xpdeint/waf/waflib/Tools/python.py
@@ -53,7 +53,7 @@ py_compile.compile(sys.argv[1], sys.argv
Piece of Python code used in :py:class:`waflib.Tools.python.pyo` and :py:class:`waflib.Tools.python.pyc` for byte-compiling python files
"""
-DISTUTILS_IMP = ['from distutils.sysconfig import get_config_var, get_python_lib']
+DISTUTILS_IMP = ['from sysconfig import get_config_var, get_path']
@before_method('process_source')
@feature('py')
@@ -490,10 +491,10 @@ def check_python_version(conf, minver=No
if Utils.is_win32:
(python_LIBDEST, pydir) = conf.get_python_variables(
["get_config_var('LIBDEST') or ''",
- "get_python_lib(standard_lib=0) or ''"])
+ "get_path(standard_lib=0) or ''"])
else:
python_LIBDEST = None
- (pydir,) = conf.get_python_variables( ["get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX])
+ (pydir,) = conf.get_python_variables( ["get_path(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX])
if python_LIBDEST is None:
if conf.env.LIBDIR:
python_LIBDEST = os.path.join(conf.env.LIBDIR, 'python' + pyver)
@@ -508,7 +509,7 @@ def check_python_version(conf, minver=No
pyarchdir = conf.environ['PYTHONARCHDIR']
else:
# Finally, try to guess
- (pyarchdir, ) = conf.get_python_variables( ["get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX])
+ (pyarchdir, ) = conf.get_python_variables( ["get_path(plat_specific=1, standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX])
if not pyarchdir:
pyarchdir = pydir
@@ -567,7 +567,10 @@ def check_python_module(conf, module_nam
if ret == 'unknown version':
conf.fatal('Could not check the %s version' % module_name)
- from distutils.version import LooseVersion
+ try:
+ from packaging.version import Version as LooseVersion
+ except ModuleNotFound:
+ from distutils.version import LooseVersion
def num(*k):
if isinstance(k[0], int):
return LooseVersion('.'.join([str(x) for x in k]))
|