cpython: 47788c90f80b (original) (raw)

--- a/Lib/distutils/filelist.py +++ b/Lib/distutils/filelist.py @@ -210,6 +210,7 @@ class FileList: Return 1 if files are found. """

@@ -297,11 +298,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

-

--- a/Lib/distutils/tests/test_filelist.py +++ b/Lib/distutils/tests/test_filelist.py @@ -1,4 +1,5 @@ """Tests for distutils.filelist.""" +import os import re import unittest from distutils import debug @@ -14,6 +15,7 @@ include ok include xo exclude xo include foo.tmp +include buildout.cfg global-include *.x global-include *.txt global-exclude *.tmp @@ -24,6 +26,11 @@ prune dir3 """ +def make_local_path(s):

+ + class FileListTestCase(support.LoggingSilencer, unittest.TestCase): @@ -36,41 +43,60 @@ class FileListTestCase(support.LoggingSi self.clear_logs() def test_glob_to_re(self):

def test_process_template_line(self): # testing all MANIFEST.in template patterns file_list = FileList()

# simulated file list file_list.allfiles = ['foo.tmp', 'ok', 'xo', 'four.txt',

for line in MANIFEST_IN.split('\n'): if line.strip() == '': continue file_list.process_template_line(line)

self.assertEqual(file_list.files, wanted) @@ -158,6 +184,7 @@ class FileListTestCase(support.LoggingSi self.assertEqual(file_list.allfiles, ['a.py', 'b.txt']) def test_process_template(self):

@@ -168,7 +195,7 @@ class FileListTestCase(support.LoggingSi # include file_list = FileList()

file_list.process_template_line('include *.py') self.assertEqual(file_list.files, ['a.py']) @@ -180,31 +207,31 @@ class FileListTestCase(support.LoggingSi # exclude file_list = FileList()

file_list.process_template_line('exclude *.py')

file_list.process_template_line('exclude *.rb')

# global-include file_list = FileList()

file_list.process_template_line('global-include *.py')

file_list.process_template_line('global-include *.rb')

# global-exclude file_list = FileList()

file_list.process_template_line('global-exclude *.py') self.assertEqual(file_list.files, ['b.txt']) @@ -216,50 +243,52 @@ class FileListTestCase(support.LoggingSi # recursive-include file_list = FileList()

file_list.process_template_line('recursive-include d *.py')

file_list.process_template_line('recursive-include e *.py')

# recursive-exclude file_list = FileList()

file_list.process_template_line('recursive-exclude d *.py')

file_list.process_template_line('recursive-exclude e *.py')

# graft file_list = FileList()

file_list.process_template_line('graft d')

file_list.process_template_line('graft e')

# prune file_list = FileList()

file_list.process_template_line('prune d')

file_list.process_template_line('prune e')

--- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -42,6 +42,7 @@ setup(name='fake') MANIFEST = """[](#l3.4)

file GENERATED by distutils, do NOT edit

README +buildout.cfg inroot.txt setup.py data%(sep)sdata.dt @@ -150,7 +151,7 @@ class SDistTestCase(PyPIRCCommandTestCas dist_folder = join(self.tmp_dir, 'dist') result = os.listdir(dist_folder) result.sort()

os.remove(join(dist_folder, 'fake-1.0.tar')) os.remove(join(dist_folder, 'fake-1.0.tar.gz')) @@ -209,11 +210,18 @@ class SDistTestCase(PyPIRCCommandTestCas self.write_file((data_dir, 'data.dt'), '#') some_dir = join(self.tmp_dir, 'some') os.mkdir(some_dir)

dist.data_files = [('data', ['data/data.dt',

@@ -243,15 +251,15 @@ class SDistTestCase(PyPIRCCommandTestCas zip_file.close() # making sure everything was added

# checking the MANIFEST f = open(join(self.tmp_dir, 'MANIFEST')) try: manifest = f.read()

@unittest.skipUnless(zlib, "requires zlib") def test_metadata_check_option(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -98,6 +98,9 @@ Core and Builtins Library ------- +- Issue #6884: Fix long-standing bugs with MANIFEST.in parsing in distutils