diff options
| -rw-r--r-- | mesonbuild/dependencies/pkgconfig.py | 15 | ||||
| -rwxr-xr-x | run_project_tests.py | 4 | ||||
| -rwxr-xr-x | run_tests.py | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py index a0727f60f..012b716f6 100644 --- a/mesonbuild/dependencies/pkgconfig.py +++ b/mesonbuild/dependencies/pkgconfig.py @@ -29,8 +29,9 @@ if T.TYPE_CHECKING: class PkgConfigInterface: '''Base class wrapping a pkg-config implementation''' - class_impl: PerMachine[T.Union[Literal[False], T.Optional[PkgConfigInterface]]] = PerMachine(False, False) - class_cli_impl: PerMachine[T.Union[Literal[False], T.Optional[PkgConfigCLI]]] = PerMachine(False, False) + # keyed on machine and extra_paths + class_impl: PerMachine[T.Dict[T.Optional[T.Tuple[str, ...]], T.Union[Literal[False], T.Optional[PkgConfigInterface]]]] = PerMachine({}, {}) + class_cli_impl: PerMachine[T.Dict[T.Optional[T.Tuple[str, ...]], T.Union[Literal[False], T.Optional[PkgConfigCLI]]]] = PerMachine({}, {}) pkg_bin_per_machine: PerMachine[T.Optional[ExternalProgram]] = PerMachine(None, None) @staticmethod @@ -45,14 +46,15 @@ class PkgConfigInterface: extra_paths: T.Optional[T.List[str]] = None) -> T.Optional[PkgConfigInterface]: '''Return a pkg-config implementation singleton''' for_machine = for_machine if env.is_cross_build() else MachineChoice.HOST - impl = PkgConfigInterface.class_impl[for_machine] + extra_paths_key = tuple(extra_paths) if extra_paths is not None else None + impl = PkgConfigInterface.class_impl[for_machine].get(extra_paths_key, False) if impl is False: impl = PkgConfigCLI(env, for_machine, silent, PkgConfigInterface.pkg_bin_per_machine[for_machine], extra_paths) if not impl.found(): impl = None if not impl and not silent: mlog.log('Found pkg-config:', mlog.red('NO')) - PkgConfigInterface.class_impl[for_machine] = impl + PkgConfigInterface.class_impl[for_machine][extra_paths_key] = impl return impl @staticmethod @@ -67,12 +69,13 @@ class PkgConfigInterface: impl: T.Union[Literal[False], T.Optional[PkgConfigInterface]] # Help confused mypy impl = PkgConfigInterface.instance(env, for_machine, silent) if impl and not isinstance(impl, PkgConfigCLI): - impl = PkgConfigInterface.class_cli_impl[for_machine] + extra_paths_key = tuple(extra_paths) if extra_paths is not None else None + impl = PkgConfigInterface.class_cli_impl[for_machine].get(extra_paths_key, False) if impl is False: impl = PkgConfigCLI(env, for_machine, silent, PkgConfigInterface.pkg_bin_per_machine[for_machine], extra_paths) if not impl.found(): impl = None - PkgConfigInterface.class_cli_impl[for_machine] = impl + PkgConfigInterface.class_cli_impl[for_machine][extra_paths_key] = impl return T.cast('T.Optional[PkgConfigCLI]', impl) # Trust me, mypy @staticmethod diff --git a/run_project_tests.py b/run_project_tests.py index ce6e5c2da..b2442703e 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -555,8 +555,8 @@ def clear_internal_caches() -> None: from mesonbuild.mesonlib import PerMachine mesonbuild.interpreterbase.FeatureNew.feature_registry = {} CMakeDependency.class_cmakeinfo = PerMachine(None, None) - PkgConfigInterface.class_impl = PerMachine(False, False) - PkgConfigInterface.class_cli_impl = PerMachine(False, False) + PkgConfigInterface.class_impl = PerMachine({}, {}) + PkgConfigInterface.class_cli_impl = PerMachine({}, {}) PkgConfigInterface.pkg_bin_per_machine = PerMachine(None, None) diff --git a/run_tests.py b/run_tests.py index 6ca84f07f..ed224f817 100755 --- a/run_tests.py +++ b/run_tests.py @@ -289,7 +289,7 @@ def run_mtest_inprocess(commandlist: T.List[str]) -> T.Tuple[int, str]: def clear_meson_configure_class_caches() -> None: CCompiler.find_library_cache.clear() CCompiler.find_framework_cache.clear() - PkgConfigInterface.class_impl.assign(False, False) + PkgConfigInterface.class_impl.assign({}, {}) mesonlib.project_meson_versions.clear() def run_configure_inprocess(commandlist: T.List[str], env: T.Optional[T.Dict[str, str]] = None, catch_exception: bool = False) -> T.Tuple[int, str, str]: |
