Skip to content

Commit

Permalink
Use native path separator on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou committed Jun 28, 2024
1 parent b6bcf9e commit 54ddf75
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2641,13 +2641,20 @@ def add_link(tar: tarfile.TarFile, name: str, linktype: str, target: str) -> Non
add_file(sdist_tar, "src/linktest/sub/__init__.py", "")
add_file(sdist_tar, "src/linktest/sub/inner.dat", "Data")
linknames = []

# Windows requires native path separators in symlink targets.
# (see https://github.com/python/cpython/issues/57911)
# (This is not needed for hardlinks, nor for the workaround tarfile
# uses if symlinking is disabled.)
SEP = os.path.sep

pkg_root = f"{common_prefix}src/linktest"
for prefix, target_tag, linktype, target in [
("", "root", "sym", "root.dat"),
("", "root", "hard", f"{pkg_root}/root.dat"),
("", "inner", "sym", "sub/inner.dat"),
("", "inner", "sym", f"sub{SEP}inner.dat"),
("", "inner", "hard", f"{pkg_root}/sub/inner.dat"),
("sub/", "root", "sym", "../root.dat"),
("sub/", "root", "sym", f"..{SEP}root.dat"),
("sub/", "root", "hard", f"{pkg_root}/root.dat"),
("sub/", "inner", "sym", "inner.dat"),
("sub/", "inner", "hard", f"{pkg_root}/sub/inner.dat"),
Expand Down

0 comments on commit 54ddf75

Please sign in to comment.