Skip to content

Commit

Permalink
Use system install scheme rather than the incorrect Debian one.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane authored and nirbheek committed Apr 22, 2022
1 parent 3a03457 commit b43a166
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions run_meson_command_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,24 @@
from mesonbuild.mesonlib import windows_proof_rmtree, python_command, is_windows
from mesonbuild.coredata import version as meson_version

# Handle the scheme that Debian patches in the as default
import sysconfig
# This function was renamed and made public in Python 3.10
if hasattr(sysconfig, 'get_default_scheme'):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
if scheme == 'posix_local':
scheme = 'posix_prefix'

def get_pypath():
import sysconfig
pypath = sysconfig.get_path('purelib', vars={'base': ''})
pypath = sysconfig.get_path('purelib', scheme=scheme, vars={'base': ''})
# Ensure that / is the path separator and not \, then strip /
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('\\/')
return sysconfig.get_path('scripts', scheme=scheme, vars={'base': ''}).strip('\\/')

class CommandTests(unittest.TestCase):
'''
Expand Down

0 comments on commit b43a166

Please sign in to comment.