Add case-sensitive file comparison for detecting/adding standard default files.

This commit is contained in:
Jason R. Coombs 2016-10-14 15:39:01 -04:00
parent 00e3cea34f
commit 22dd73a74b
2 changed files with 25 additions and 2 deletions

View File

@ -32,6 +32,24 @@ def show_formats():
FancyGetopt(formats).print_help( FancyGetopt(formats).print_help(
"List of available source distribution formats:") "List of available source distribution formats:")
def cs_path_exists(fspath):
"""
Case-sensitive path existence check
>>> cs_path_exists(__file__)
True
>>> cs_path_exists(__file__.upper())
False
"""
if not os.path.exists(fspath):
return False
# make absolute so we always have a directory
abspath = os.path.abspath(fspath)
directory, filename = os.path.split(abspath)
return filename in os.listdir(directory)
class sdist(Command): class sdist(Command):
description = "create a source distribution (tarball, zip file, etc.)" description = "create a source distribution (tarball, zip file, etc.)"
@ -235,7 +253,7 @@ class sdist(Command):
alts = fn alts = fn
got_it = False got_it = False
for fn in alts: for fn in alts:
if os.path.exists(fn): if cs_path_exists(fn):
got_it = True got_it = True
self.filelist.append(fn) self.filelist.append(fn)
break break
@ -244,7 +262,7 @@ class sdist(Command):
self.warn("standard file not found: should have one of " + self.warn("standard file not found: should have one of " +
', '.join(alts)) ', '.join(alts))
else: else:
if os.path.exists(fn): if cs_path_exists(fn):
self.filelist.append(fn) self.filelist.append(fn)
else: else:
self.warn("standard file '%s' not found" % fn) self.warn("standard file '%s' not found" % fn)

View File

@ -85,6 +85,11 @@ Core and Builtins
Library Library
------- -------
- Distutils.sdist now looks for README and setup.py files with case
sensitivity. This behavior matches that found in Setuptools 6.0 and
later. See `setuptools 100
<https://github.com/pypa/setuptools/issues/100>`_ for rationale.
- Issue #24452: Make webbrowser support Chrome on Mac OS X. - Issue #24452: Make webbrowser support Chrome on Mac OS X.
- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - Issue #20766: Fix references leaked by pdb in the handling of SIGINT