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

include license file in wheels #99

Merged
merged 4 commits into from Jan 26, 2017
Merged

include license file in wheels #99

merged 4 commits into from Jan 26, 2017

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Jan 12, 2017

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.

This was referenced Jan 12, 2017
@@ -3,6 +3,7 @@ module=flit
author=Thomas Kluyver
author-email=thomas@kluyver.me.uk
home-page=https://github.com/takluyver/flit
license=LICENSE
Copy link
Member

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.

Copy link
Contributor Author

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 + '*'):
Copy link
Member

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.

Copy link
Contributor Author

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))
Copy link
Member

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()).

Copy link
Contributor Author

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.

Copy link
Member

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.

@takluyver takluyver merged commit 27b2d04 into pypa:master Jan 26, 2017
@minrk minrk deleted the license-file branch June 28, 2017 21:02
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

Successfully merging this pull request may close these issues.

None yet

2 participants