aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-10-14 15:53:16 -0400
committerJason R. Coombs <jaraco@jaraco.com>2016-10-14 15:53:16 -0400
commit17f89f4ffca731f1ee3d49aad717415013d047d2 (patch)
tree45300c9608c044ad482b5a0d93ad34afa47f80b2
parent6b175fcf513fa98f03b4c529cccfa3d256e91e19 (diff)
downloadexternal_python_setuptools-17f89f4ffca731f1ee3d49aad717415013d047d2.tar.gz
external_python_setuptools-17f89f4ffca731f1ee3d49aad717415013d047d2.tar.bz2
external_python_setuptools-17f89f4ffca731f1ee3d49aad717415013d047d2.zip
Update sdist to use sdist_add_defaults forward compatibility.
-rwxr-xr-xsetuptools/command/sdist.py51
-rw-r--r--setuptools/utils.py11
2 files changed, 8 insertions, 54 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index addc6a56..b85d7d03 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -1,4 +1,3 @@
-from glob import glob
from distutils import log
import distutils.command.sdist as orig
import os
@@ -7,9 +6,8 @@ import io
import contextlib
from setuptools.extern import six
-from setuptools.extern.six.moves import filter
-from setuptools.utils import cs_path_exists
+from .py36compat import sdist_add_defaults
import pkg_resources
@@ -23,7 +21,7 @@ def walk_revctrl(dirname=''):
yield item
-class sdist(orig.sdist):
+class sdist(sdist_add_defaults, orig.sdist):
"""Smart sdist that finds anything supported by revision control"""
user_options = [
@@ -127,34 +125,8 @@ class sdist(orig.sdist):
if has_leaky_handle:
read_template = __read_template_hack
- def add_defaults(self):
- standards = [self.READMES,
- self.distribution.script_name]
- for fn in standards:
- if isinstance(fn, tuple):
- alts = fn
- got_it = 0
- for fn in alts:
- if cs_path_exists(fn):
- got_it = 1
- self.filelist.append(fn)
- break
-
- if not got_it:
- self.warn("standard file not found: should have one of " +
- ', '.join(alts))
- else:
- if cs_path_exists(fn):
- self.filelist.append(fn)
- else:
- self.warn("standard file '%s' not found" % fn)
-
- optional = ['test/test*.py', 'setup.cfg']
- for pattern in optional:
- files = filter(cs_path_exists, glob(pattern))
- self.filelist.extend(files)
-
- # getting python files
+ def _add_defaults_python(self):
+ """getting python files"""
if self.distribution.has_pure_modules():
build_py = self.get_finalized_command('build_py')
self.filelist.extend(build_py.get_source_files())
@@ -167,17 +139,10 @@ class sdist(orig.sdist):
self.filelist.extend([os.path.join(src_dir, filename)
for filename in filenames])
- if self.distribution.has_ext_modules():
- build_ext = self.get_finalized_command('build_ext')
- self.filelist.extend(build_ext.get_source_files())
-
- if self.distribution.has_c_libraries():
- build_clib = self.get_finalized_command('build_clib')
- self.filelist.extend(build_clib.get_source_files())
-
- if self.distribution.has_scripts():
- build_scripts = self.get_finalized_command('build_scripts')
- self.filelist.extend(build_scripts.get_source_files())
+ def _add_defaults_data_files(self):
+ """
+ Don't add any data files, but why?
+ """
def check_readme(self):
for f in self.READMES:
diff --git a/setuptools/utils.py b/setuptools/utils.py
deleted file mode 100644
index 080b9a8e..00000000
--- a/setuptools/utils.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import os
-import os.path
-
-
-def cs_path_exists(fspath):
- 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)