diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 19:41:42 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 19:41:42 (GMT) |
commit | cf99a348676f3b956d81e200b5fb23e763d6e040 (patch) | |
tree | 70f1ba5b5d14d7ba30247818d6eac2de5294286b | |
parent | 22dd73a74b585501c5e9c7ed738cbedbaf2b2230 (diff) | |
download | cpython-cf99a348676f3b956d81e200b5fb23e763d6e040.zip cpython-cf99a348676f3b956d81e200b5fb23e763d6e040.tar.gz cpython-cf99a348676f3b956d81e200b5fb23e763d6e040.tar.bz2 |
Make cs_path_exists a protected, static method
-rw-r--r-- | Lib/distutils/command/sdist.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 0cc0119..180e286 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -33,23 +33,6 @@ def show_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): description = "create a source distribution (tarball, zip file, etc.)" @@ -246,6 +229,23 @@ class sdist(Command): 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: @@ -253,7 +253,7 @@ class sdist(Command): alts = fn got_it = False for fn in alts: - if cs_path_exists(fn): + if self._cs_path_exists(fn): got_it = True self.filelist.append(fn) break @@ -262,7 +262,7 @@ class sdist(Command): self.warn("standard file not found: should have one of " + ', '.join(alts)) else: - if cs_path_exists(fn): + if self._cs_path_exists(fn): self.filelist.append(fn) else: self.warn("standard file '%s' not found" % fn) |