diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-03-05 14:38:57 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-06-26 13:10:25 -0400 |
commit | 418063cc472aa12aca9253c3970486ca5a90b70e (patch) | |
tree | e72d3f4b57c777c5d32206bcc52609d7c6eeecea /mesonbuild/modules/pkgconfig.py | |
parent | 620bdf5895131f9e58da4c980a28dc96986d0b57 (diff) | |
download | meson-418063cc472aa12aca9253c3970486ca5a90b70e.zip meson-418063cc472aa12aca9253c3970486ca5a90b70e.tar.gz meson-418063cc472aa12aca9253c3970486ca5a90b70e.tar.bz2 |
pkgconfig: move uninstalled devenv handling from setup to the module hook
msetup.py doesn't need to know the gory details of PkgConfigDependency,
or directly import it at program startup. It's also slightly wasteful to
generate a devenv for the -uninstalled directory when a project doesn't
even, in the end, use the pkgconfig module anyway.
Diffstat (limited to 'mesonbuild/modules/pkgconfig.py')
-rw-r--r-- | mesonbuild/modules/pkgconfig.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index ce27f1e..714955d 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -27,6 +27,7 @@ from .. import mesonlib from .. import mlog from ..coredata import BUILTIN_DIR_OPTIONS from ..dependencies import ThreadDependency +from ..dependencies.pkgconfig import PkgConfigDependency from ..interpreter.type_checking import D_MODULE_VERSIONS_KW, INSTALL_DIR_KW, VARIABLES_KW, NoneType from ..interpreterbase import FeatureNew, FeatureDeprecated from ..interpreterbase.decorators import ContainerTypeInfo, KwargInfo, typed_kwargs, typed_pos_args @@ -153,7 +154,7 @@ class DependenciesHelper: and obj.get_id() in self.metadata): self._check_generated_pc_deprecation(obj) processed_reqs.append(self.metadata[obj.get_id()].filebase) - elif isinstance(obj, dependencies.PkgConfigDependency): + elif isinstance(obj, PkgConfigDependency): if obj.found(): processed_reqs.append(obj.name) self.add_version_reqs(obj.name, obj.version_reqs) @@ -197,7 +198,7 @@ class DependenciesHelper: processed_reqs.append(self.metadata[obj.get_id()].filebase) elif isinstance(obj, dependencies.ValgrindDependency): pass - elif isinstance(obj, dependencies.PkgConfigDependency): + elif isinstance(obj, PkgConfigDependency): if obj.found(): processed_reqs.append(obj.name) self.add_version_reqs(obj.name, obj.version_reqs) @@ -381,6 +382,7 @@ class PkgConfigModule(NewExtensionModule): # Track already generated pkg-config files This is stored as a class # variable so that multiple `import()`s share metadata + devenv: T.Optional[build.EnvironmentVariables] = None _metadata: T.ClassVar[T.Dict[str, MetaData]] = {} def __init__(self) -> None: @@ -389,6 +391,9 @@ class PkgConfigModule(NewExtensionModule): 'generate': self.generate, }) + def postconf_hook(self, b: build.Build) -> None: + b.devenv.append(self.devenv) + def _get_lname(self, l: T.Union[build.SharedLibrary, build.StaticLibrary, build.CustomTarget, build.CustomTargetIndex], msg: str, pcfile: str) -> str: if isinstance(l, (build.CustomTargetIndex, build.CustomTarget)): @@ -734,6 +739,8 @@ class PkgConfigModule(NewExtensionModule): if not isinstance(lib, str) and lib.get_id() not in self._metadata: self._metadata[lib.get_id()] = MetaData( filebase, name, state.current_node) + if self.devenv is None: + self.devenv = PkgConfigDependency.get_env(state.environment, mesonlib.MachineChoice.HOST, uninstalled=True) return ModuleReturnValue(res, [res]) |