scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

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

Open hesyifei opened this issue 1 year ago • 3 comments
trafficstars

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 https://github.com/scikit-build/scikit-build-core/issues/359 but that fix only addresses the folder symlink, not the file symlink.

(NOT A CONTRIBUTION)

hesyifei avatar Jul 08 '24 17:07 hesyifei

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?

henryiii avatar Jul 10 '24 04:07 henryiii

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.

LecrisUT avatar Jul 10 '24 06:07 LecrisUT

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.

henryiii avatar Jul 10 '24 14:07 henryiii