Skip to content

Comments

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

Merged
radoering merged 1 commit intopython-poetry:mainfrom
radoering:fix-relative-to-system-site-packages
Nov 20, 2024
Merged

env: fix check whether path is relative to system site packages#9861
radoering merged 1 commit intopython-poetry:mainfrom
radoering:fix-relative-to-system-site-packages

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
@github-actions
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
@radoering radoering deleted the fix-relative-to-system-site-packages branch December 13, 2025 17:10
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