diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-21 19:15:57 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-21 19:15:57 +0300 |
commit | fb51b205b4cdcfd6c53e88048157f1bdbb5857ff (patch) | |
tree | 6d31a7d12f90471ae496661cc781975f4380a532 | |
parent | 39dd1ff9e83acfdc8c532604b20cb7b774727334 (diff) | |
download | meson-fb51b205b4cdcfd6c53e88048157f1bdbb5857ff.zip meson-fb51b205b4cdcfd6c53e88048157f1bdbb5857ff.tar.gz meson-fb51b205b4cdcfd6c53e88048157f1bdbb5857ff.tar.bz2 |
String "local" bits from system paths.debpy310
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.
-rwxr-xr-x | run_meson_command_tests.py | 12 |
1 files 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): ''' |