Skip to content

Commit 4360433

Browse files
committed
pkgconf: remove PKG_CONFIG_PATH duplicated entries
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent e42ce55 commit 4360433

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pkgconf/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def run_pkgconf(*args: str, **subprocess_kwargs: Any) -> subprocess.CompletedPro
141141
:param subprocess_kwargs: Keyword arguments to pass to the subprocess.run call.
142142
"""
143143
env = os.environ.copy()
144-
env['PKG_CONFIG_PATH'] = os.pathsep.join(filter(None, (env.get('PKG_CONFIG_PATH'), *get_pkg_config_path())))
144+
PKG_CONFIG_PATH = env.get('PKG_CONFIG_PATH', '').split(os.pathsep) + get_pkg_config_path()
145+
PKG_CONFIG_PATH = list(dict.fromkeys(PKG_CONFIG_PATH)) # Remove duplicated entried
146+
env['PKG_CONFIG_PATH'] = os.pathsep.join(PKG_CONFIG_PATH)
145147
cmd = [os.fspath(get_executable()), *args]
146148
_LOGGER.info('Running the Python pkgconf')
147149
_LOGGER.info('$ ' + shlex.join(('PKG_CONFIG_PATH=' + shlex.quote(env['PKG_CONFIG_PATH']), *cmd)))

0 commit comments

Comments
 (0)