summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Fregtman <941331+darkvertex@users.noreply.github.com>2021-07-21 23:30:32 -0400
committerAlan Fregtman <941331+darkvertex@users.noreply.github.com>2021-07-21 23:30:32 -0400
commitf094b7767b35e23f8e81f2f54c67cac9043e66be (patch)
tree3a1c5d00ff38c39e04472019e1985b0fa86a263c
parentcb05fb0c94716b1d328ecca0573346218505b859 (diff)
downloadpython-setuptools-git-f094b7767b35e23f8e81f2f54c67cac9043e66be.tar.gz
globbing for [options.data_files]: Remove special treatment for filenames with globby characters that exist literally.
-rw-r--r--setuptools/config.py17
-rw-r--r--setuptools/tests/test_config.py3
2 files changed, 4 insertions, 16 deletions
diff --git a/setuptools/config.py b/setuptools/config.py
index 6e7c64e7..5deece38 100644
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -271,24 +271,15 @@ class ConfigHandler:
values = cls._parse_list(value, separator=separator)
expanded_values = []
for value in values:
- trimmed_value = value.strip()
# Has globby characters?
if any(char in value for char in glob_characters):
- value = os.path.abspath(value)
-
- # check if this path has globby characters but does in fact exist:
- if os.path.exists(value):
- # if it does, treat it literally and do not expand any patterns:
- expanded_values.append(get_relpath(value))
- continue
-
- # else expand the glob pattern while keeping paths *relative*:
- value = sorted(
- get_relpath(path) for path in iglob(value))
- expanded_values.extend(value)
+ # then expand the glob pattern while keeping paths *relative*:
+ expanded_values.extend(sorted(
+ get_relpath(path) for path in iglob(os.path.abspath(value))))
else:
+ # take the value as-is:
expanded_values.append(value)
return expanded_values
diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py
index 5172c6de..ec65250e 100644
--- a/setuptools/tests/test_config.py
+++ b/setuptools/tests/test_config.py
@@ -906,7 +906,6 @@ class TestOptions:
'audio = \n'
' *.wav\n'
' sounds.db\n'
- 'strangeness = literal_weird_filename?.txt\n'
)
# Create dummy files for glob()'s sake:
@@ -919,7 +918,6 @@ class TestOptions:
tmpdir.join('beep.wav').write('')
tmpdir.join('boop.wav').write('')
tmpdir.join('sounds.db').write('')
- tmpdir.join('literal_weird_filename?.txt').write('')
with get_dist(tmpdir) as dist:
expected = [
@@ -927,7 +925,6 @@ class TestOptions:
('data', ['a.dat', 'b.dat', 'c.dat']),
('icons', ['a.ico', 'b.ico', 'c.ico']),
('audio', ['beep.wav', 'boop.wav', 'sounds.db']),
- ('strangeness', ['literal_weird_filename?.txt']),
]
assert sorted(dist.data_files) == sorted(expected)