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

env: fix check whether path is relative to system site packages #9861

Merged

Conversation

radoering
Copy link
Member

We are looking into the wrong environment.

We must not use SystemEnv, which is Poetry's own env, but env.parent_env, which is the base env.

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

…ust not use SystemEnv, which is Poetry's own env, but env.parent_env, which is the base env)
@radoering radoering requested a review from a team November 20, 2024 10:00
Copy link
Member

@Secrus Secrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code seems fine to me, but I am not sure I get what is wrong here. Could you add some more context on what the bug is?

@radoering
Copy link
Member Author

Could you add some more context on what the bug is?

The method is used to determine if a package is in the env's site packages or - if the env is a virtual env created with include-system-site-packages = true - in the env's or system site packages. The bug is that SystemEnv(Path(sys.prefix) is Poetry's own env and not the env where the system site packages are (in the context of the virtual env).

@radoering radoering merged commit c70cbf4 into python-poetry:main Nov 20, 2024
73 checks passed
Copy link

github-actions bot commented Jan 4, 2025

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants