Skip to content

Commit

Permalink
pkgconfig: Fix machine selection for is_build_only
Browse files Browse the repository at this point in the history
Co-authored-by: Håvard Sørbø <[email protected]>
  • Loading branch information
oleavr and hsorbo committed Oct 9, 2024
1 parent a00ffcc commit c677572
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mesonbuild/dependencies/pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class PkgConfigInterface:
@staticmethod
def instance(env: Environment, for_machine: MachineChoice, silent: bool) -> T.Optional[PkgConfigInterface]:
'''Return a pkg-config implementation singleton'''
for_machine = for_machine if env.is_cross_build() else MachineChoice.HOST
if env.coredata.is_build_only:
for_machine = MachineChoice.BUILD
else:
for_machine = for_machine if env.is_cross_build() else MachineChoice.HOST
impl = PkgConfigInterface.class_impl[for_machine]
if impl is False:
impl = PkgConfigCLI(env, for_machine, silent)
Expand All @@ -50,7 +53,10 @@ def _cli(env: Environment, for_machine: MachineChoice, silent: bool = False) ->
Even when we use another implementation internally, external tools might
still need the CLI implementation.
'''
for_machine = for_machine if env.is_cross_build() else MachineChoice.HOST
if env.coredata.is_build_only:
for_machine = MachineChoice.BUILD
else:
for_machine = for_machine if env.is_cross_build() else MachineChoice.HOST
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):
Expand Down

0 comments on commit c677572

Please sign in to comment.