From fb51b205b4cdcfd6c53e88048157f1bdbb5857ff Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Thu, 21 Apr 2022 19:15:57 +0300 Subject: String "local" bits from system paths. Starting with Python 3.10 Debian changed how it reports paths via sysconfig. They now have a 'local' path segment in them, presumably to match that when installed system-wide things to go "/usr/local". When you install in a custom dir, though, the "local" part is not actually used. So don't use that then. --- run_meson_command_tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py index 36cb02e..54d0268 100755 --- a/run_meson_command_tests.py +++ b/run_meson_command_tests.py @@ -27,14 +27,22 @@ from mesonbuild.coredata import version as meson_version def get_pypath(): import sysconfig - pypath = sysconfig.get_path('purelib', vars={'base': ''}) + pypath = sysconfig.get_path('purelib', vars={'base': ''}).replace('dist-packages', 'site-packages') # Ensure that / is the path separator and not \, then strip / + # Starting with Python 3.10 the Debian installation returns paths like + # '/usr/local', even though it does the installation to just ''/usr'. + if pypath.startswith('/local'): + pypath = pypath.split('/', 2)[-1] return Path(pypath).as_posix().strip('/') def get_pybindir(): import sysconfig # 'Scripts' on Windows and 'bin' on other platforms including MSYS - return sysconfig.get_path('scripts', vars={'base': ''}).strip('\\/') + # See above for note about Python 3.10. + raw_path = sysconfig.get_path('scripts', vars={'base': ''}) + if raw_path.startswith('/local'): + return raw_path.split('/', 2)[-1] + return raw_path.strip('\\/') class CommandTests(unittest.TestCase): ''' -- cgit v1.1