From a7ad70c13b0c04528db430bc1b650fe29a7f3d82 Mon Sep 17 00:00:00 2001 From: Peter Urban Date: Fri, 25 Nov 2022 16:20:03 +0100 Subject: [PATCH 1/2] add unofficial 'install-tags' option --- mesonpy/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index f3c5ec807..a810f71ee 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -543,7 +543,7 @@ def build(self, directory: Path) -> pathlib.Path: return wheel_file -MesonArgsKeys = Literal['dist', 'setup', 'compile', 'install'] +MesonArgsKeys = Literal['dist', 'setup', 'compile', 'install', 'install-tags'] MesonArgs = Mapping[MesonArgsKeys, Collection[str]] @@ -735,7 +735,11 @@ def _wheel_builder(self) -> _WheelBuilder: def build(self) -> None: """Trigger the Meson build.""" self._meson('compile', *self._meson_args['compile'],) - self._meson('install', '--destdir', os.fspath(self._install_dir), *self._meson_args['install'],) + if self._meson_args['install-tags']: + install_tags = '--tags=' + ','.join(self._meson_args['install-tags']) + self._meson('install', '--destdir', os.fspath(self._install_dir), install_tags, *self._meson_args['install'],) + else: + self._meson('install', '--destdir', os.fspath(self._install_dir), *self._meson_args['install'],) @classmethod @contextlib.contextmanager @@ -760,6 +764,12 @@ def _info(self, name: str) -> Dict[str, Any]: @property def _install_plan(self) -> Dict[str, Dict[str, Dict[str, str]]]: + install_plan = self._info('intro-install_plan').copy() + + for files in install_plan.values(): + for file,details in list(files.items()): + if details['tag'] not in self._meson_args['install-tags']: + del files[file] """Meson install_plan metadata.""" return self._info('intro-install_plan').copy() From 794bf782b449e4657fce604bc55d46560f22b111 Mon Sep 17 00:00:00 2001 From: Brishen Hawkins Date: Tue, 17 Jan 2023 11:58:30 -0700 Subject: [PATCH 2/2] Update formatting in __init__.py --- mesonpy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index 2457e5f5c..09a844958 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -910,7 +910,7 @@ def _install_plan(self) -> Dict[str, Dict[str, Dict[str, str]]]: install_plan = self._info('intro-install_plan').copy() for files in install_plan.values(): - for file,details in list(files.items()): + for file, details in list(files.items()): if details['tag'] not in self._meson_args['install-tags']: del files[file] """Meson install_plan metadata."""