[Python-checkins] distutils2: Make test_manifest pass on 2.4 and 2.5 (fixes #11751).

eric.araujo python-checkins at python.org
Mon Nov 21 14:21:37 CET 2011


http://hg.python.org/distutils2/rev/723517bf6708
changeset:   1258:723517bf6708
user:        Éric Araujo <merwok at netwok.org>
date:        Sun Nov 20 19:02:08 2011 +0100
summary:
  Make test_manifest pass on 2.4 and 2.5 (fixes #11751).

The code added massages the output of fnmatch in old Pythons to make it
match more recent behavior (it was changed in 2.6 to append '\Z(?ms)'
instead of '$', to support newline characters in filenames).  I could
have changed the tests, but I prefer having the code do the same thing
for all versions as far as possible.

files:
  distutils2/manifest.py |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/distutils2/manifest.py b/distutils2/manifest.py
--- a/distutils2/manifest.py
+++ b/distutils2/manifest.py
@@ -346,6 +346,10 @@
     # Unix-only.
     pattern_re = re.sub(r'((?<!\\)(\\\\)*)\.', r'\1[^/]', pattern_re)
 
+    if pattern_re.endswith('$'):
+        # make it look like fnmatch in Python 2.6 and newer
+        pattern_re = pattern_re[:-1] + r'\Z(?ms)'
+
     return pattern_re
 
 

-- 
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list