diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-07-30 21:27:50 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-08-03 14:44:03 -0400 |
commit | 3f71779f8a94a448b490401432db5aa47f306662 (patch) | |
tree | 289dab9aa32649c63b471362d502972336283086 /mesonbuild | |
parent | c0350d61a39e0a52e5caea20c4d6dd0074a47600 (diff) | |
download | meson-3f71779f8a94a448b490401432db5aa47f306662.zip meson-3f71779f8a94a448b490401432db5aa47f306662.tar.gz meson-3f71779f8a94a448b490401432db5aa47f306662.tar.bz2 |
Fix python module leaving PKG_CONFIG_LIBDIR set in os.environ.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/python.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 450991b..f38becf 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -247,10 +247,13 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', try: return PythonPkgConfigDependency(name, env, kwargs, installation) finally: - if old_pkg_libdir is not None: - os.environ['PKG_CONFIG_LIBDIR'] = old_pkg_libdir - if old_pkg_path is not None: - os.environ['PKG_CONFIG_PATH'] = old_pkg_path + def set_env(name, value): + if value is not None: + os.environ[name] = value + elif name in os.environ: + del os.environ[name] + set_env('PKG_CONFIG_LIBDIR', old_pkg_libdir) + set_env('PKG_CONFIG_PATH', old_pkg_path) candidates.extend([ functools.partial(wrap_in_pythons_pc_dir, pkg_name, env, kwargs, installation), |