Skip to content

Commit

Permalink
Cache the includes_system_site_packages property
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed Aug 25, 2023
1 parent 40bd409 commit a34e7ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/poetry/utils/env/virtual_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from contextlib import contextmanager
from copy import deepcopy
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
Expand Down Expand Up @@ -136,6 +137,7 @@ def temp_environ(self) -> Iterator[None]:
def _updated_path(self) -> str:
return os.pathsep.join([str(self._bin_dir), os.environ.get("PATH", "")])

@cached_property
def includes_system_site_packages(self) -> bool:
pyvenv_cfg = self._path / "pyvenv.cfg"
return "include-system-site-packages = true" in pyvenv_cfg.read_text()
Expand Down

0 comments on commit a34e7ce

Please sign in to comment.