Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
from . import _dist_info as di


def _is_windows():
return platform.system() == "Windows"


def get_devel_root() -> Path:
try:
import rocm_sdk_devel
Expand Down Expand Up @@ -159,6 +163,16 @@ def _clean_dir(dir: Path):
# hash (empty)
# size (empty)
record_file.write(f"{ti.name},,\n")
if _is_windows() and ti.issym():
# Convert symlinks into hardlinks on Windows.
# This saves disk space while improving compatibility
# on systems without as robust symlink support.
# As needed, we could also generate tarfiles with
# copies instead of symlinks, at the cost of disk space.
symlink_target = dest_path.readlink()
hardlink_target = dest_path.parent / symlink_target
dest_path.unlink()
dest_path.hardlink_to(hardlink_target)
elif ti.isdir():
# We don't generally have directory entries, but handle
# them if we do.
Expand All @@ -170,10 +184,6 @@ def _clean_dir(dir: Path):
file_lock.unlock()


def _is_windows():
return platform.system() == "Windows"


class FileLock:
"""Small portability shim between fcntl.lockf and msvcrt.locking for our uses."""

Expand Down