diff --git a/colcon_core/task/python/build.py b/colcon_core/task/python/build.py index a72c1a54..5320a939 100644 --- a/colcon_core/task/python/build.py +++ b/colcon_core/task/python/build.py @@ -70,6 +70,7 @@ async def build(self, *, additional_hooks=None): # noqa: D102 Path(__file__).parent / 'template' / 'sitecustomize.py.em', prefix_override / 'sitecustomize.py', { + 'current_prefix': sys.prefix, 'site_prefix': args.install_base, }) diff --git a/colcon_core/task/python/template/sitecustomize.py.em b/colcon_core/task/python/template/sitecustomize.py.em index bbcd662c..b6bbe2f0 100644 --- a/colcon_core/task/python/template/sitecustomize.py.em +++ b/colcon_core/task/python/template/sitecustomize.py.em @@ -1,4 +1,4 @@ import sys -if sys.prefix == sys.base_prefix: +if sys.prefix == @repr(current_prefix): sys.real_prefix = sys.prefix sys.prefix = sys.exec_prefix = @repr(site_prefix)