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 Jul 2, 2024
1 parent cf72387 commit 4fd295e
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 4fd295e

Please sign in to comment.