Skip to content

Commit 3e6669a

Browse files
authored
Merge pull request #853 from timheap/global-exclude-glob
Fix #849 global-exclude globbing
2 parents 2e0b4d4 + 23aba91 commit 3e6669a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

setuptools/command/egg_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def global_include(self, pattern):
457457
"""
458458
if self.allfiles is None:
459459
self.findall()
460-
match = translate_pattern(os.path.join('**', pattern))
460+
match = translate_pattern(os.path.join('**', '*' + pattern))
461461
found = [f for f in self.allfiles if match.match(f)]
462462
self.extend(found)
463463
return bool(found)
@@ -466,7 +466,7 @@ def global_exclude(self, pattern):
466466
"""
467467
Exclude all files anywhere that match the pattern.
468468
"""
469-
match = translate_pattern(os.path.join('**', pattern))
469+
match = translate_pattern(os.path.join('**', '*' + pattern))
470470
return self._remove_files(match.match)
471471

472472
def append(self, item):

setuptools/tests/test_manifest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,11 @@ def test_global_include(self):
449449
assert file_list.files == ['a.py', l('d/c.py')]
450450
self.assertWarnings()
451451

452+
file_list.process_template_line('global-include .txt')
453+
file_list.sort()
454+
assert file_list.files == ['a.py', 'b.txt', l('d/c.py')]
455+
self.assertNoWarnings()
456+
452457
def test_global_exclude(self):
453458
l = make_local_path
454459
# global-exclude
@@ -465,6 +470,13 @@ def test_global_exclude(self):
465470
assert file_list.files == ['b.txt']
466471
self.assertWarnings()
467472

473+
file_list = FileList()
474+
file_list.files = ['a.py', 'b.txt', l('d/c.pyc'), 'e.pyo']
475+
file_list.process_template_line('global-exclude .py[co]')
476+
file_list.sort()
477+
assert file_list.files == ['a.py', 'b.txt']
478+
self.assertNoWarnings()
479+
468480
def test_recursive_include(self):
469481
l = make_local_path
470482
# recursive-include

0 commit comments

Comments
 (0)