Skip to content

Commit

Permalink
fix(env): always include userbase in paths
Browse files Browse the repository at this point in the history
When executing Python in isolated (-I) mode, user site is disabled. This
should not exclude userbase from generated paths.
  • Loading branch information
abn committed Jan 20, 2025
1 parent 8450523 commit a37988f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/poetry/utils/env/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ def run_pip(self, *args: str, **kwargs: Any) -> str:
return self._run(cmd, **kwargs)

def run_python_script(self, content: str, **kwargs: Any) -> str:
# Options Used:
# -I : Run Python in isolated mode. (#6627)
# -W ignore : Suppress warnings.
#
# TODO: Consider replacing (-I) with (-EP) once support for managing Python <3.11 environments dropped.
# This is useful to prevent user site being disabled over zealously.

return self.run(
self._executable,
"-I",
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/utils/env/script_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def _version_nodot(version):
if site.check_enableusersite():
paths["usersite"] = site.getusersitepackages()
paths["userbase"] = site.getuserbase()
paths["userbase"] = site.getuserbase()
print(json.dumps(paths))
"""

0 comments on commit a37988f

Please sign in to comment.