cpython: 73aa4c9305b3 (original) (raw)

--- a/Lib/distutils/filelist.py +++ b/Lib/distutils/filelist.py @@ -201,6 +201,7 @@ class FileList: Return True if files are found, False otherwise. """

@@ -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

-

--- 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 @@ -9,6 +10,26 @@ from distutils.filelist import glob_to_r from test.support import captured_stdout, run_unittest from distutils.tests import support +MANIFEST_IN = """[](#l2.13) +include ok +include xo +exclude xo +include foo.tmp +include buildout.cfg +global-include *.x +global-include *.txt +global-exclude *.tmp +recursive-include f *.oo +recursive-exclude global *.x +graft dir +prune dir3 +""" + + +def make_local_path(s):

+ class FileListTestCase(support.LoggingSilencer, unittest.TestCase): @@ -22,16 +43,62 @@ class FileListTestCase(support.LoggingSi self.clear_logs() def test_glob_to_re(self):

+

+

+

+

+

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

@@ -127,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']) @@ -139,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']) @@ -175,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 @@ -7,6 +7,12 @@ import zipfile from os.path import join from textwrap import dedent +try:

+except ImportError:

+ from test.support import captured_stdout, check_warnings, run_unittest from distutils.command.sdist import sdist, show_formats @@ -28,6 +34,7 @@ setup(name='fake') MANIFEST = """[](#l3.17)

file GENERATED by distutils, do NOT edit

README +buildout.cfg inroot.txt setup.py data%(sep)sdata.dt @@ -39,13 +46,6 @@ somecode%(sep)sdoc.dat somecode%(sep)sdoc.txt """ -try:

-except ImportError:

- - class SDistTestCase(PyPIRCCommandTestCase): def setUp(self): @@ -143,7 +143,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')) @@ -180,11 +180,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',

@@ -214,15 +221,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_SUPPORT, 'Need zlib support to run') def test_metadata_check_option(self):

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