Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building sdist, file symlink remains a symlink instead of being copied to a concrete file #801

Open
hesyifei opened this issue Jul 8, 2024 · 3 comments

Comments

@hesyifei
Copy link

hesyifei commented Jul 8, 2024

symlink-repro-1.zip

In the attached sample project, my package looks something like this

-rw-r--r-- 1 user user 150 Jul 2 14:15 pyproject.toml
lrwxr-xr-x 1 user user 16 Jul 2 14:16 some-file.txt -> ../some-file.txt
lrwxr-xr-x 1 user user 20 Jul 2 14:16 some-other-folder -> ../some-other-folder

When I run in my-python-package folder

python -m build --sdist

the source distribution file scikit_build_simplest-0.0.1.tar.gz in the dist folder (also included in the attached zip) looks like this

-rw-r--r-- 1 user user 65 Nov 9 2022 PKG-INFO
-rw-r--r-- 1 user user 150 Nov 9 2022 pyproject.toml
lrwxr-xr-x 1 user user 16 Nov 9 2022 some-file.txt -> ../some-file.txt
drwxr-xr-x 3 user user 96 Jul 2 14:20 some-other-folder

Notice how the folder symlink is correctly copied over as real folders, but the file symlink remains a file symlink instead of the real content. This makes this sdist unusable because some-file.txt is pointing to some path outside the sdist.

I believe this is related to #359 but that fix only addresses the folder symlink, not the file symlink.

(NOT A CONTRIBUTION)

@henryiii
Copy link
Collaborator

henryiii commented Jul 10, 2024

Makes sense; the test matched the problem, which was a folder and not a file. One question though; would it make sense to leave symlinks that point to files that are in the SDist?

@LecrisUT
Copy link
Collaborator

I thoughts simlinks are not respected or is this only for wheels? If possible preserving symlinks within the sdist would be nice. One of the checks in Fedora is if files are bitwise identical which triggers warnings. Preserving the symlink would help if files in the sdist are to be installed.

@henryiii
Copy link
Collaborator

Symlinks are not possible in wheels, as they are based on zips (currently, there's a proposal to add a way to do it via marker file(s) being prepared, last I heard). SDists can contain them, in theory. It might be a problem on some Windows boxes since symlinks may be off. By the time you install (will go though a wheel), they will have to be real files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants