X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fpython-lttngust%2Fsetup.py.in;fp=src%2Fpython-lttngust%2Fsetup.py.in;h=b11be1d9a09e11770b9c7b0c7a5ee8b74575f4cb;hb=245091df0d4f5a5862b4ff554fbcd476a681604b;hp=c5ce059b5a4df935051537aef16126e381cd4379;hpb=2d061cf42b91907c457f1dff542cf0bbc6856dcb;p=lttng-ust.git diff --git a/src/python-lttngust/setup.py.in b/src/python-lttngust/setup.py.in index c5ce059b..b11be1d9 100644 --- a/src/python-lttngust/setup.py.in +++ b/src/python-lttngust/setup.py.in @@ -12,6 +12,28 @@ if sys.version_info < (3, 12): else: from setuptools import setup, Extension +# Starting with Debian's Python 3.10, the default install scheme is +# 'posix_local' which is a Debian specific scheme based on 'posix_prefix' but +# with an added 'local' prefix. This is the default so users doing system wide +# manual installations of python modules end up in '/usr/local'. This +# interferes with our autotools based install which already defaults to +# '/usr/local' and expect a provided prefix to be used verbatim. +# +# Monkeypatch sysconfig to override this scheme and use 'posix_prefix' instead. +if sys.version_info >= (3, 10): + import sysconfig + + original_get_preferred_scheme = sysconfig.get_preferred_scheme + + def our_get_preferred_scheme(key): + scheme = original_get_preferred_scheme(key) + if scheme == "posix_local": + return "posix_prefix" + else: + return scheme + + sysconfig.get_preferred_scheme = our_get_preferred_scheme + PY_PATH_WARN_MSG = """ -------------------------------------WARNING------------------------------------ The install directory used:\n ({0})\nis not included in your PYTHONPATH.