aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-08-01 23:51:43 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-08-22 14:15:22 -0400
commit3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6 (patch)
tree1657528ecf739758e226827e9e8f3eae1d3419c5 /mesonbuild/modules
parente19e9ce6f196f7c127a2668b5df0ada1d50806df (diff)
downloadmeson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.zip
meson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.tar.gz
meson-3e73d4d77d1d36b15d06c8b3c4a7ee6ad77847b6.tar.bz2
introspection: untangle install_plan implemetation, fix a bunch of wrong ones
Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/python.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 91443b8..9b50de4 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -30,6 +30,7 @@ from ..dependencies.base import process_method_kw
from ..dependencies.detect import get_dep_identifier
from ..environment import detect_cpu_family
from ..interpreter import ExternalProgramHolder, extract_required_kwarg, permitted_dependency_kwargs
+from ..interpreter import primitives as P_OBJ
from ..interpreter.type_checking import NoneType, PRESERVE_PATH_KW
from ..interpreterbase import (
noPosargs, noKwargs, permittedKwargs, ContainerTypeInfo,
@@ -514,7 +515,7 @@ class PythonInstallation(ExternalProgramHolder):
if not isinstance(subdir, str):
raise InvalidArguments('"subdir" argument must be a string.')
- kwargs['install_dir'] = os.path.join(self.platlib_install_path, subdir)
+ kwargs['install_dir'] = self._get_install_dir_impl(False, subdir)
new_deps = []
has_pydep = False
@@ -598,11 +599,12 @@ class PythonInstallation(ExternalProgramHolder):
def install_sources_method(self, args: T.Tuple[T.List[T.Union[str, mesonlib.File]]],
kwargs: 'PyInstallKw') -> 'Data':
tag = kwargs['install_tag'] or 'runtime'
+ install_dir = self._get_install_dir_impl(kwargs['pure'], kwargs['subdir'])
return self.interpreter.install_data_impl(
self.interpreter.source_strings_to_files(args[0]),
- self._get_install_dir_impl(kwargs['pure'], kwargs['subdir']),
+ install_dir,
mesonlib.FileMode(), rename=None, tag=tag, install_data_type='python',
- install_dir_name=self._get_install_dir_name_impl(kwargs['pure'], kwargs['subdir']),
+ install_dir_name=install_dir.optname,
preserve_path=kwargs['preserve_path'])
@noPosargs
@@ -610,12 +612,15 @@ class PythonInstallation(ExternalProgramHolder):
def get_install_dir_method(self, args: T.List['TYPE_var'], kwargs: 'PyInstallKw') -> str:
return self._get_install_dir_impl(kwargs['pure'], kwargs['subdir'])
- def _get_install_dir_impl(self, pure: bool, subdir: str) -> str:
- return os.path.join(
- self.purelib_install_path if pure else self.platlib_install_path, subdir)
+ def _get_install_dir_impl(self, pure: bool, subdir: str) -> P_OBJ.OptionString:
+ if pure:
+ base = self.purelib_install_path
+ name = '{py_purelib}'
+ else:
+ base = self.platlib_install_path
+ name = '{py_platlib}'
- def _get_install_dir_name_impl(self, pure: bool, subdir: str) -> str:
- return os.path.join('{py_purelib}' if pure else '{py_platlib}', subdir)
+ return P_OBJ.OptionString(os.path.join(base, subdir), os.path.join(name, subdir))
@noPosargs
@noKwargs