modules/pkgconfig: Don't insert None into devenv list

When the pkgconfig module is imported, but not used, it will insert None
on the end of the devenv list. This list is not expected to contain
None, and causes Meson to crash. This can happen in complex build setups
(reported from mesa), where pkgconfig is only used in some
configurations

Fixes: #12032
This commit is contained in:
Dylan Baker 2023-07-24 19:34:19 -07:00 committed by Eli Schwartz
parent dd578decdb
commit 020610cfbe
2 changed files with 5 additions and 1 deletions

View File

@ -391,7 +391,8 @@ class PkgConfigModule(NewExtensionModule):
})
def postconf_hook(self, b: build.Build) -> None:
b.devenv.append(self.devenv)
if self.devenv is not 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:

View File

@ -20,3 +20,6 @@ env = environment({'TEST_C': ['/prefix']}, method: 'prepend')
meson.add_devenv(env)
env = environment({'TEST_C': ['/suffix']}, method: 'append')
meson.add_devenv(env)
# Reproducer for https://github.com/mesonbuild/meson/issues/12032
pkgconf = import('pkgconfig')