Skip to content

Commit

Permalink
Ignore files terminating in ~. (#347)
Browse files Browse the repository at this point in the history
This is Unix's most common pattern for backup files. They are often
present, but I can't think of a good reason for them to be distributed.
  • Loading branch information
Flameeyes authored Mar 24, 2020
1 parent e5d8697 commit b74eeb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ def license_paths(self):

for pattern in patterns:
for path in iglob(pattern):
if path.endswith('~'):
logger.debug('ignoring license file "%s" as it looks like a backup', path)
continue

if path not in files and os.path.isfile(path):
logger.info('adding license file "%s" (matched pattern "%s")', path, pattern)
files.add(path)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
'LICENSE', 'LICENSE.txt', 'LICENCE', 'LICENCE.txt', 'COPYING',
'COPYING.md', 'NOTICE', 'NOTICE.rst', 'AUTHORS', 'AUTHORS.txt'
}
OTHER_IGNORED_FILES = {
'LICENSE~', 'AUTHORS~',
}


@pytest.fixture
Expand All @@ -34,7 +37,7 @@ def dummy_dist(tmpdir_factory):
version='1.0'
)
""")
for fname in DEFAULT_LICENSE_FILES:
for fname in DEFAULT_LICENSE_FILES | OTHER_IGNORED_FILES:
basedir.join(fname).write('')

basedir.join('licenses').mkdir().join('DUMMYFILE').write('')
Expand Down

0 comments on commit b74eeb7

Please sign in to comment.