diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 15:39:01 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 15:39:01 -0400 |
commit | 3b05fac47289e9835e5bd6f2efb130df59a73ffb (patch) | |
tree | 3553581c82cf7b9c55f59443428ed8b26ecdf907 | |
parent | 8ed698da6784b13344a63c9988faa00d281bc6d9 (diff) | |
download | python-setuptools-git-3b05fac47289e9835e5bd6f2efb130df59a73ffb.tar.gz |
Add case-sensitive file comparison for detecting/adding standard default files.
-rw-r--r-- | command/sdist.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/command/sdist.py b/command/sdist.py index c66d8271..0cc01192 100644 --- a/command/sdist.py +++ b/command/sdist.py @@ -32,6 +32,24 @@ def show_formats(): 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 @@ class sdist(Command): 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 @@ class sdist(Command): 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) |