-
Notifications
You must be signed in to change notification settings - Fork 251
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
for wheel, not follow symbolic links #481
base: main
Are you sure you want to change the base?
for wheel, not follow symbolic links #481
Conversation
6331f9d
to
d592504
Compare
Path.resolve uses os.path.realpath which "eliminates any symbolic links encountered in the path". symbolic links encountered in the path". The only possibility is to use Path.absolute which is currently not documented/tested
only set resolve_symlinks(BuildIncludeFile) to true when resolve_symlinks(find_files_to_add) is True or file is not a symlink
d592504
to
60d8182
Compare
In the future, please refrain from pinging on PRs that are this new. This change is not obviously correct -- what issue are you trying to solve? Are you attempting to ship symlinks inside a built wheel? What is the use case/is this a common practice permitted by other tools or required for a specific use case? |
In fact, symlinks are currently outside the wheel spec and not supported. See discussion at https://discuss.python.org/t/symbolic-links-in-wheels/1945 for more information. |
@neersighted hello, and thank you for your answer. |
@neersighted This Pr only five the possibility to include the directory (which is a symlink), but without following it and adding only its content, so there is no symlink in the wheel. |
@neersighted i think you can re-open this PR, it's usefull and it doesn't change the current behavior (when there is no symlink), but is more intuitive and expected when there is a symlink |
There is no need to ping three times in 10 minutes 😆 As a participant in this thread I will get a notification every time you comment. There are three possible behaviors for symlinks:
Poetry currently does behavior 3, and as I understand it, you want to do behavior 1. I originally thought you intended to do behavior 2. Can you further explain what workflow this enables? sdists need to be able to produce bdists -- if this is intended to enable out-of-tree symlinks to be built into wheels, I see that as counterproductive. If you need assets that are out of your tree, they should be a dependency or incorporated in tree. Even if we accept it, this will be a breaking change, so I'm not 100% sure about including it before the Poetry 1.3 release at the very least. |
Haha sorry, I like to send multiple comments. Yes it's 1. So the data and src directory is usually at root level. |
Right, but the sdist will only be buildable on your system if it references paths that are not in the tree. Is the intention that sdists also should be transparent, so that the files are captured in the sdist as well as the bdist? What use case do you have where depending on out-of-tree files is necessary and can't be solved by an in-tree method? |
The symlink is in the tree but not inside the package. it's as package data. |
I see -- so you want to include data files that are not in the package, but symlinked from elsewhere in the repo -- This makes more sense now -- I still would like to get some more eyeballs (cc @finswimmer @radoering) on it to decide if it makes sense. Would you mind examining some other common tools (e.g. hatch, setuptools, pipenv) and summarizing their existing behavior so we can compare to the rest of the ecosystem? |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
When a symbolic link is included into a wheel, this link is resolved an it may happen that the resource is not added as expected
I added the possibility to not resolve symbolic link in BuildIncludeFile.
Path.resolve uses os.path.realpath which "eliminates any symbolic links encountered in the path".
The only possibility is to use Path.absolute which is currently not documented/tested
Allow the builder to not resolve symlinks when "find_files_to_add"
Only set resolve_symlinks(BuildIncludeFile) to true when resolve_symlinks(find_files_to_add) is True or file is not a symlink
Only set resolve_symlinks to false when building wheel
Add test_package_with_include_symbolic_links inside tests/masonry/builders/test_complete.py