-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Store license-files in licenses subfolder #4728
Conversation
b35bf9e
to
939f374
Compare
0bb22ba
to
c47ade2
Compare
c47ade2
to
75b3169
Compare
setuptools/dist.py
Outdated
@@ -418,7 +418,10 @@ def _finalize_license_files(self) -> None: | |||
patterns = ['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*'] | |||
|
|||
self.metadata.license_files = list( | |||
unique_everseen(self._expand_patterns(patterns)) | |||
map( | |||
lambda path: path.replace("\\", "/"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use os.sep
here instead of \\
(e.g. if somehow \\
ends showing up on a linux build, we want the build to crash right, because it would mean incorrect input from the user)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe that's necessary here. path
isn't a user input but rather the glob matched license path from self._expand_patterns
. The idea with this line is just to normalize the separator since the core metadata field only allows forward /
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about valid paths in linux containing \
? (e.g. mkdir 'hello\world' && touch 'hello\world/LICENSE.txt'
)... It is a bit of a problematic choice if the user decides to do that, but os.sep
would be less error prone in that case, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I've ever seen that in the wild but you're right it's a possibility. Pushed 3e9b9c7 to use os.sep
instead.
1c02ce4
to
fe63c2f
Compare
Thank you! |
Summary of changes
The initial draft of PEP 639 specified that license files should be written directly to the
.dist-info
folder. This was changed in later iterations. The files should now be written to.dist-info/licenses
and the root folder structure should be recreated to avoid name conflicts.Additional changes to be spec compliant:
license_files
specifier, e.g.**/LICENSE
.License-File
path delimiter.Closes #3596
Refs #4629