Commit 36bcc35f authored by Jason R. Coombs's avatar Jason R. Coombs

Update sdist_add_defaults to match CPython db8bb1bd6ac5

parent 57b4b845
...@@ -3,6 +3,8 @@ from glob import glob ...@@ -3,6 +3,8 @@ from glob import glob
from distutils.util import convert_path from distutils.util import convert_path
from distutils.command import sdist from distutils.command import sdist
from setuptools.extern.six.moves import filter
class sdist_add_defaults: class sdist_add_defaults:
""" """
...@@ -32,6 +34,23 @@ class sdist_add_defaults: ...@@ -32,6 +34,23 @@ class sdist_add_defaults:
self._add_defaults_c_libs() self._add_defaults_c_libs()
self._add_defaults_scripts() self._add_defaults_scripts()
@staticmethod
def _cs_path_exists(fspath):
"""
Case-sensitive path existence check
>>> sdist._cs_path_exists(__file__)
True
>>> sdist._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)
def _add_defaults_standards(self): def _add_defaults_standards(self):
standards = [self.READMES, self.distribution.script_name] standards = [self.READMES, self.distribution.script_name]
for fn in standards: for fn in standards:
...@@ -39,7 +58,7 @@ class sdist_add_defaults: ...@@ -39,7 +58,7 @@ class sdist_add_defaults:
alts = fn alts = fn
got_it = False got_it = False
for fn in alts: for fn in alts:
if os.path.exists(fn): if self._cs_path_exists(fn):
got_it = True got_it = True
self.filelist.append(fn) self.filelist.append(fn)
break break
...@@ -48,7 +67,7 @@ class sdist_add_defaults: ...@@ -48,7 +67,7 @@ class sdist_add_defaults:
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 self._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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment