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
include license file in wheels #99
Conversation
@@ -3,6 +3,7 @@ module=flit | |||
author=Thomas Kluyver | |||
author-email=thomas@kluyver.me.uk | |||
home-page=https://github.com/takluyver/flit | |||
license=LICENSE |
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.
The license field is intended for the name or description of a license (see metadata 1.2), not a path.
I think I'd rather this was a convention-over-configuration thing, looking for a file called LICENSE
adjacent to the module.
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.
Sure. Updated to grab LICENSE*
or COPYING*
to follow existing conventions.
include any LICENSE or COPYING files
@@ -155,6 +156,9 @@ def write_metadata(self): | |||
elif self.ini_info['entry_points_file'] is not None: | |||
self._add_file(self.ini_info['entry_points_file'], | |||
dist_info + '/entry_points.txt') | |||
for name in ('LICENSE', 'COPYING'): | |||
for fname in glob.glob(name + '*'): |
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.
Can we sort the globbed files? For reproducible builds, we want to ensure files are added in a predictable order, and I don't think there's any guarantee about the return order from glob().
Also, this currently takes files from the working directory, which is usually but not always correct. self.directory
is a Path object, so you should be able to use its glob method.
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.
Good call, done.
@@ -155,6 +156,9 @@ def write_metadata(self): | |||
elif self.ini_info['entry_points_file'] is not None: | |||
self._add_file(self.ini_info['entry_points_file'], | |||
dist_info + '/entry_points.txt') | |||
for base in ('COPYING', 'LICENSE'): | |||
for fname in sorted(self.directory.glob(base + '*')): | |||
self._add_file(fname, '%s/%s' % (dist_info, fname)) |
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.
If the directory is not the cwd, its path will be added between dist_info and the filename. We can avoid this by taking fname.name
for the second formatting argument (that's equivalent to os.path.basename()
).
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.
Indeed. Sorry, I'm still not used to Path objects.
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.
No problem, thanks for your patience.
metadata 2.0 specifies an extension for where to put this info, but it should work okay this way while flit is implementing 1.2.