summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_sdist.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2012-02-25 15:28:05 (GMT)
committerÉric Araujo <merwok@netwok.org>2012-02-25 15:28:05 (GMT)
commit2e0a0e1640e89bec7da985534411c464d3d30df2 (patch)
treec41aa74a2c3a09350d0909befb2c3a2c0f029fe6 /Lib/distutils/tests/test_sdist.py
parent3d4809f4645db6d38be098399164735bc6cc32f6 (diff)
downloadcpython-2e0a0e1640e89bec7da985534411c464d3d30df2.zip
cpython-2e0a0e1640e89bec7da985534411c464d3d30df2.tar.gz
cpython-2e0a0e1640e89bec7da985534411c464d3d30df2.tar.bz2
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.
Diffstat (limited to 'Lib/distutils/tests/test_sdist.py')
-rw-r--r--Lib/distutils/tests/test_sdist.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
index d0d16b2..fd71dac 100644
--- 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:
+ import zlib
+ ZLIB_SUPPORT = True
+except ImportError:
+ ZLIB_SUPPORT = False
+
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 = """\
# 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:
- import zlib
- ZLIB_SUPPORT = True
-except ImportError:
- ZLIB_SUPPORT = False
-
-
class SDistTestCase(PyPIRCCommandTestCase):
def setUp(self):
@@ -143,7 +143,7 @@ class SDistTestCase(PyPIRCCommandTestCase):
dist_folder = join(self.tmp_dir, 'dist')
result = os.listdir(dist_folder)
result.sort()
- self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'] )
+ self.assertEqual(result, ['fake-1.0.tar', 'fake-1.0.tar.gz'])
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(PyPIRCCommandTestCase):
self.write_file((data_dir, 'data.dt'), '#')
some_dir = join(self.tmp_dir, 'some')
os.mkdir(some_dir)
+ # make sure VCS directories are pruned (#14004)
+ hg_dir = join(self.tmp_dir, '.hg')
+ os.mkdir(hg_dir)
+ self.write_file((hg_dir, 'last-message.txt'), '#')
+ # a buggy regex used to prevent this from working on windows (#6884)
+ self.write_file((self.tmp_dir, 'buildout.cfg'), '#')
self.write_file((self.tmp_dir, 'inroot.txt'), '#')
self.write_file((some_dir, 'file.txt'), '#')
self.write_file((some_dir, 'other_file.txt'), '#')
dist.data_files = [('data', ['data/data.dt',
+ 'buildout.cfg',
'inroot.txt',
'notexisting']),
'some/file.txt',
@@ -214,15 +221,15 @@ class SDistTestCase(PyPIRCCommandTestCase):
zip_file.close()
# making sure everything was added
- self.assertEqual(len(content), 11)
+ self.assertEqual(len(content), 12)
# checking the MANIFEST
f = open(join(self.tmp_dir, 'MANIFEST'))
try:
manifest = f.read()
- self.assertEqual(manifest, MANIFEST % {'sep': os.sep})
finally:
f.close()
+ self.assertEqual(manifest, MANIFEST % {'sep': os.sep})
@unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
def test_metadata_check_option(self):