Skip to content

Commit 7230e18

Browse files
authored
Add Python 'platlib' directory to PYTHONPATH (#709)
Existing code looks for packages in paths like `.../lib/python3.X/site-packages`, but packages can also be installed to locations like `../lib64/python3.X/site-packages`. We should look there as well.
1 parent a56aed4 commit 7230e18

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

colcon_core/environment/pythonpath.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ def create_environment_hooks(self, prefix_path, pkg_name): # noqa: D102
2727
'pythonpath', prefix_path, pkg_name,
2828
'PYTHONPATH', str(rel_python_path), mode='prepend')
2929

30+
platlib_path = get_python_install_path(
31+
'platlib', {'base': prefix_path, 'platbase': prefix_path})
32+
if python_path != platlib_path:
33+
logger.log(1, "checking '%s'" % platlib_path)
34+
if platlib_path.exists():
35+
rel_platlib_path = platlib_path.relative_to(prefix_path)
36+
hooks += shell.create_environment_hook(
37+
'pythonpath', prefix_path, pkg_name,
38+
'PYTHONPATH', str(rel_platlib_path), mode='prepend')
39+
3040
return hooks

test/spell_check.words

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ optionxform
7878
pathlib
7979
pkgname
8080
pkgs
81+
platbase
82+
platlib
8183
plugin
8284
popitem
8385
prepend

0 commit comments

Comments
 (0)