From 2e0a0e1640e89bec7da985534411c464d3d30df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Sat, 25 Feb 2012 16:28:05 +0100 Subject: Fix long-standing bugs with MANIFEST.in parsing on Windows (#6884). These regex changes fix a number of issues for distutils on Windows: - #6884: impossible to include a file starting with 'build' - #9691 and #14004: sdist includes too many files - #13193: test_filelist failures This commit replaces the incorrect changes done in 0a94e2f807c7 and 90b30d62caf2 to fix #13193; we were too eager to fix the test failures and I did not study the code enough before greenlighting patches. This time we have unit tests from the problems reported by users to be sure we have the right fix. Thanks to Nadeem Vawda for his help. --- Lib/distutils/filelist.py | 22 +++--- Lib/distutils/tests/test_filelist.py | 130 +++++++++++++++++++++++++++-------- Lib/distutils/tests/test_sdist.py | 27 +++++--- Misc/NEWS | 3 + 4 files changed, 134 insertions(+), 48 deletions(-) diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py index 9122032..db3f7a9 100644 --- a/Lib/distutils/filelist.py +++ b/Lib/distutils/filelist.py @@ -201,6 +201,7 @@ class FileList: Return True if files are found, False otherwise. """ + # XXX docstring lying about what the special chars are? files_found = False pattern_re = translate_pattern(pattern, anchor, prefix, is_regex) self.debug_print("include_pattern: applying regex r'%s'" % @@ -284,11 +285,14 @@ def glob_to_re(pattern): # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix, # and by extension they shouldn't match such "special characters" under # any OS. So change all non-escaped dots in the RE to match any - # character except the special characters. - # XXX currently the "special characters" are just slash -- i.e. this is - # Unix-only. - pattern_re = re.sub(r'((?