Skip to content

Commit

Permalink
Merge pull request #401 from takluyver/i399
Browse files Browse the repository at this point in the history
Only add COPYING* & LICENSE* matches if they are regular files
  • Loading branch information
takluyver committed Mar 21, 2021
2 parents bbd08ed 8f50a67 commit 915e63f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions flit_core/flit_core/tests/samples/inclusion/LICENSES/README
Original file line number Diff line number Diff line change
@@ -0,0 1,2 @@
This directory will match the LICENSE* glob which Flit uses to add license
files to wheel metadata.
12 changes: 12 additions & 0 deletions flit_core/flit_core/tests/test_wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@
from pathlib import Path

from testpath import assert_isfile

from flit_core.wheel import make_wheel_in

samples_dir = Path(__file__).parent / 'samples'

def test_licenses_dir(tmp_path):
# Smoketest for https://github.com/takluyver/flit/issues/399
info = make_wheel_in(samples_dir / 'inclusion' / 'pyproject.toml', tmp_path)
assert_isfile(info.file)
5 changes: 3 additions & 2 deletions flit_core/flit_core/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 197,9 @@ def write_metadata(self):
common.write_entry_points(self.entrypoints, f)

for base in ('COPYING', 'LICENSE'):
for path in sorted(glob(str(self.directory / (base '*')))):
self._add_file(path, '%s/%s' % (self.dist_info, osp.basename(path)))
for path in sorted(self.directory.glob(base '*')):
if path.is_file():
self._add_file(path, '%s/%s' % (self.dist_info, path.name))

with self._write_to_zip(self.dist_info '/WHEEL') as f:
_write_wheel_file(f, supports_py2=self.metadata.supports_py2)
Expand Down

0 comments on commit 915e63f

Please sign in to comment.