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
3 changes: 2 additions & 1 deletion src/pdm/installers/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from installer.sources import WheelFile as _WheelFile

from pdm.models.cached_package import CachedPackage
from pdm.utils import make_file_executable

if TYPE_CHECKING:
from typing import Any, BinaryIO, Iterable, Literal
Expand Down Expand Up @@ -100,7 +101,7 @@ def __init__(

def write_to_fs(self, scheme: Scheme, path: str, stream: BinaryIO, is_executable: bool) -> RecordEntry:
from installer.records import Hash
from installer.utils import copyfileobj_with_hashing, make_file_executable
from installer.utils import copyfileobj_with_hashing

target_path = os.path.join(self.scheme_dict[scheme], path)
if os.path.exists(target_path):
Expand Down
4 changes: 1 addition & 3 deletions src/pdm/models/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pdm.models.candidates import Candidate
from pdm.models.markers import EnvSpec
from pdm.termui import logger
from pdm.utils import atomic_open_for_write, create_tracked_tempdir
from pdm.utils import atomic_open_for_write, create_tracked_tempdir, make_file_executable

if TYPE_CHECKING:
from httpx import Client
Expand Down Expand Up @@ -278,8 +278,6 @@ def cache_wheel(self, wheel: Path) -> CachedPackage:
"""Create a CachedPackage instance from a wheel file"""
import zipfile

from installer.utils import make_file_executable

dest = self.root.joinpath(f"{wheel.name}.cache")
pkg = CachedPackage(dest, original_wheel=wheel)
if dest.exists():
Expand Down
6 changes: 6 additions & 0 deletions src/pdm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,3 +605,9 @@ def hide_url(url: str) -> HiddenText:
netloc = f"*****@{netloc}"
redacted = parse.urlunsplit((parsed.scheme, netloc, parsed.path, parsed.query, parsed.fragment))
return HiddenText(url, redacted)


def make_file_executable(path: str | Path) -> None:
"""Make the file at the provided path executable."""
path_ = Path(path)
path_.chmod(path_.stat().st_mode | 0o111)
Loading