Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable sitecustomize paths if in virtual env #623

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions colcon_core/task/python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

Expand Down
5 changes: 3 additions & 2 deletions colcon_core/task/python/template/sitecustomize.py.em
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
sys.real_prefix = sys.prefix
sys.prefix = sys.exec_prefix = @repr(site_prefix)
if sys.prefix == @repr(current_prefix):
sys.real_prefix = sys.prefix
sys.prefix = sys.exec_prefix = @repr(site_prefix)
Loading