[Python-checkins] cpython: Add case-sensitive file comparison for detecting/adding standard default files.
jason.coombs
python-checkins at python.org
Fri Oct 14 15:39:07 EDT 2016
https://hg.python.org/cpython/rev/ed95bb0d7572
changeset: 104495:ed95bb0d7572
user: Jason R. Coombs <jaraco at jaraco.com>
date: Fri Oct 14 15:39:01 2016 -0400
summary:
Add case-sensitive file comparison for detecting/adding standard default files.
files:
Lib/distutils/command/sdist.py | 22 ++++++++++++++++++++--
Misc/NEWS | 5 +++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -32,6 +32,24 @@
FancyGetopt(formats).print_help(
"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):
description = "create a source distribution (tarball, zip file, etc.)"
@@ -235,7 +253,7 @@
alts = fn
got_it = False
for fn in alts:
- if os.path.exists(fn):
+ if cs_path_exists(fn):
got_it = True
self.filelist.append(fn)
break
@@ -244,7 +262,7 @@
self.warn("standard file not found: should have one of " +
', '.join(alts))
else:
- if os.path.exists(fn):
+ if cs_path_exists(fn):
self.filelist.append(fn)
else:
self.warn("standard file '%s' not found" % fn)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -85,6 +85,11 @@
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 #20766: Fix references leaked by pdb in the handling of SIGINT
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list