diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 15:43:01 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 15:43:01 -0400 |
| commit | 36bcc35f0cf0d99d20fe9610f4001c513d851cfd (patch) | |
| tree | a5952fe28ab9da73852f2d2bcd161b721e8f88f5 /setuptools/command/py36compat.py | |
| parent | 57b4b8456508a65861aaf46e8a17c2d7361daed7 (diff) | |
| download | python-setuptools-git-36bcc35f0cf0d99d20fe9610f4001c513d851cfd.tar.gz | |
Update sdist_add_defaults to match CPython db8bb1bd6ac5
Diffstat (limited to 'setuptools/command/py36compat.py')
| -rw-r--r-- | setuptools/command/py36compat.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/setuptools/command/py36compat.py b/setuptools/command/py36compat.py index d92b9d48..883221da 100644 --- a/setuptools/command/py36compat.py +++ b/setuptools/command/py36compat.py @@ -3,6 +3,8 @@ from glob import glob from distutils.util import convert_path from distutils.command import sdist +from setuptools.extern.six.moves import filter + class sdist_add_defaults: """ @@ -32,6 +34,23 @@ class sdist_add_defaults: self._add_defaults_c_libs() 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): standards = [self.READMES, self.distribution.script_name] for fn in standards: @@ -39,7 +58,7 @@ class sdist_add_defaults: alts = fn got_it = False for fn in alts: - if os.path.exists(fn): + if self._cs_path_exists(fn): got_it = True self.filelist.append(fn) break @@ -48,7 +67,7 @@ class sdist_add_defaults: self.warn("standard file not found: should have one of " + ', '.join(alts)) else: - if os.path.exists(fn): + if self._cs_path_exists(fn): self.filelist.append(fn) else: self.warn("standard file '%s' not found" % fn) |
