summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2020-03-24 11:45:08 +0000
committerGitHub <noreply@github.com>2020-03-24 13:45:08 +0200
commitb74eeb72ea09f70076ba72779a7a331f8e009708 (patch)
tree59aa449e74faf5bec645d4f214fa61363a53b942
parente5d869715e17bc7c5426c52904027602067e0fb7 (diff)
downloadwheel-git-b74eeb72ea09f70076ba72779a7a331f8e009708.tar.gz
Ignore files terminating in ~. (#347)
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.
-rw-r--r--src/wheel/bdist_wheel.py4
-rw-r--r--tests/test_bdist_wheel.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/wheel/bdist_wheel.py b/src/wheel/bdist_wheel.py
index 5cece1f..5bc9265 100644
--- a/src/wheel/bdist_wheel.py
+++ b/src/wheel/bdist_wheel.py
@@ -339,6 +339,10 @@ class bdist_wheel(Command):
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)
diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py
index 67df435..91eb8c1 100644
--- a/tests/test_bdist_wheel.py
+++ b/tests/test_bdist_wheel.py
@@ -21,6 +21,9 @@ DEFAULT_LICENSE_FILES = {
'LICENSE', 'LICENSE.txt', 'LICENCE', 'LICENCE.txt', 'COPYING',
'COPYING.md', 'NOTICE', 'NOTICE.rst', 'AUTHORS', 'AUTHORS.txt'
}
+OTHER_IGNORED_FILES = {
+ 'LICENSE~', 'AUTHORS~',
+}
@pytest.fixture
@@ -34,7 +37,7 @@ setup(
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('')