summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_sdist.py
diff options
context:
space:
mode:
authorRandy Syring <randy.syring@lev12.com>2014-09-20 16:29:41 -0400
committerRandy Syring <randy.syring@lev12.com>2014-09-20 16:29:41 -0400
commit4e5c7d0657a9719d2fa961c852daf0926de91ae3 (patch)
tree61201fb51fa5291806e2d4d7b88a1794137172b6 /setuptools/tests/test_sdist.py
parent394ea0c104e7da5cf583680b418c3e5e4b9858d4 (diff)
downloadpython-setuptools-git-4e5c7d0657a9719d2fa961c852daf0926de91ae3.tar.gz
sdist command: fix case insensitivity when adding some files to filelist
This should fix the problem in Bitbucket issue #100. It gives the same behavior for inclusion of default files (README*, etc.) on Windows as Linux. BACKWARDS INCOMPATABILITY: This may result in a backwards incompatible change for users on a case insensitive file system. If they were relying on some files getting included in their distribution due to setuptools defaults, and their files do not have the same case as the files being looked for in setuptools, those files will no longer be included in the package. For example, if a package had a file: readme.rst Previous to this commit, that file would have been included in the distribution as: README.rst But it will now no longer be included at all. To get the file included in the package, it can be added to the package's MANIFEST.in file: include readme.rst Files affected by this change will have a case variant of the files or patterns listed below: README README.txt README.rst setup.py (or whatever your setuptools script is named) setup.cfg test/test*.py
Diffstat (limited to 'setuptools/tests/test_sdist.py')
-rw-r--r--setuptools/tests/test_sdist.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 5b3862e9..5f8a190f 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -86,6 +86,7 @@ class TestSdistTest(unittest.TestCase):
f = open(os.path.join(self.temp_dir, 'setup.py'), 'w')
f.write(SETUP_PY)
f.close()
+
# Set up the rest of the test package
test_pkg = os.path.join(self.temp_dir, 'sdist_test')
os.mkdir(test_pkg)
@@ -121,6 +122,33 @@ class TestSdistTest(unittest.TestCase):
self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
+
+ def test_defaults_case_sensitivity(self):
+ """
+ Make sure default files (README.*, etc.) are added in a case-sensitive
+ way to avoid problems with packages built on Windows.
+ """
+
+ open(os.path.join(self.temp_dir, 'readme.rst'), 'w').close()
+ open(os.path.join(self.temp_dir, 'SETUP.cfg'), 'w').close()
+
+ dist = Distribution(SETUP_ATTRS)
+ # the extension deliberately capitalized for this test
+ # to make sure the actual filename (not capitalized) gets added
+ # to the manifest
+ dist.script_name = 'setup.PY'
+ cmd = sdist(dist)
+ cmd.ensure_finalized()
+
+ with quiet():
+ cmd.run()
+
+ # lowercase all names so we can test in a case-insensitive way to make sure the files are not included
+ manifest = map(lambda x: x.lower(), cmd.filelist.files)
+ self.assertFalse('readme.rst' in manifest, manifest)
+ self.assertFalse('setup.py' in manifest, manifest)
+ self.assertFalse('setup.cfg' in manifest, manifest)
+
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)