Skip to content
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
6 changes: 3 additions & 3 deletions src/poetry/inspection/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import tempfile

from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING
from typing import Any

Expand All @@ -18,7 +19,6 @@
from poetry.core.packages.package import Package
from poetry.core.pyproject.toml import PyProjectTOML
from poetry.core.utils.helpers import parse_requires
from poetry.core.utils.helpers import temporary_directory
from poetry.core.version.markers import InvalidMarkerError
from poetry.core.version.requirements import InvalidRequirementError

Expand Down Expand Up @@ -317,7 +317,7 @@ def _from_sdist_file(cls, path: Path) -> PackageInfo:
elif not zip:
suffix = ".tar.gz"

with temporary_directory() as tmp_str:
with TemporaryDirectory(ignore_cleanup_errors=True) as tmp_str:
tmp = Path(tmp_str)
extractall(source=path, dest=tmp, zip=zip)

Expand Down Expand Up @@ -533,7 +533,7 @@ def get_pep517_metadata(path: Path) -> PackageInfo:
"""
info = None

with tempfile.TemporaryDirectory() as dist:
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as dist:
try:
dest = Path(dist)

Expand Down
5 changes: 2 additions & 3 deletions src/poetry/installation/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import tempfile

from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING

from poetry.core.utils.helpers import temporary_directory

from poetry.utils.helpers import extractall
from poetry.utils.isolated_build import isolated_builder

Expand Down Expand Up @@ -100,7 +99,7 @@ def _prepare_sdist(
suffix = archive.suffix
zip = suffix == ".zip"

with temporary_directory() as tmp_dir:
with TemporaryDirectory(ignore_cleanup_errors=True) as tmp_dir:
archive_dir = Path(tmp_dir)
extractall(source=archive, dest=archive_dir, zip=zip)

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/repositories/http_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from contextlib import contextmanager
from contextlib import suppress
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING
from typing import Any

Expand All @@ -15,7 +16,6 @@
from packaging.metadata import parse_email
from poetry.core.constraints.version import parse_constraint
from poetry.core.packages.dependency import Dependency
from poetry.core.utils.helpers import temporary_directory
from poetry.core.version.markers import parse_marker

from poetry.config.config import Config
Expand Down Expand Up @@ -110,7 +110,7 @@ def _cached_or_downloaded_file(
self, link: Link, *, raise_accepts_ranges: bool = False
) -> Iterator[Path]:
self._log(f"Downloading: {link.url}", level="debug")
with temporary_directory() as temp_dir:
with TemporaryDirectory(ignore_cleanup_errors=True) as temp_dir:
filepath = Path(temp_dir) / link.filename
self._download(
link.url, filepath, raise_accepts_ranges=raise_accepts_ranges
Expand Down
5 changes: 2 additions & 3 deletions src/poetry/utils/env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING

from poetry.core.utils.helpers import temporary_directory

from poetry.utils.env.base_env import Env
from poetry.utils.env.env_manager import EnvManager
from poetry.utils.env.exceptions import EnvCommandError
Expand Down Expand Up @@ -38,7 +37,7 @@ def ephemeral_environment(
executable: Path | None = None,
flags: dict[str, str | bool] | None = None,
) -> Iterator[VirtualEnv]:
with temporary_directory() as tmp_dir:
with TemporaryDirectory(ignore_cleanup_errors=True) as tmp_dir:
# TODO: cache PEP 517 build environment corresponding to each project venv
venv_dir = Path(tmp_dir) / ".venv"
EnvManager.build_venv(
Expand Down