diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 18:53:32 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-14 18:53:32 (GMT) |
commit | 00e3cea34fd3c74b897f39d8bee4a701b75c79c2 (patch) | |
tree | 45a9bc7bfd10ee48f8c6165958901f20fa405a28 /Lib/distutils/command | |
parent | 10d5eef8e53a968efc3aff1153a9eb8c6e3e59f3 (diff) | |
download | cpython-00e3cea34fd3c74b897f39d8bee4a701b75c79c2.zip cpython-00e3cea34fd3c74b897f39d8bee4a701b75c79c2.tar.gz cpython-00e3cea34fd3c74b897f39d8bee4a701b75c79c2.tar.bz2 |
Extract methods from sdist.add_defaults, allowing subclasses to override or inject different behaviors.
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r-- | Lib/distutils/command/sdist.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index e512166..c66d827 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -220,6 +220,15 @@ class sdist(Command): Warns if (README or README.txt) or setup.py are missing; everything else is optional. """ + self._add_defaults_standards() + self._add_defaults_optional() + self._add_defaults_python() + self._add_defaults_data_files() + self._add_defaults_ext() + self._add_defaults_c_libs() + self._add_defaults_scripts() + + def _add_defaults_standards(self): standards = [self.READMES, self.distribution.script_name] for fn in standards: if isinstance(fn, tuple): @@ -240,11 +249,13 @@ class sdist(Command): else: self.warn("standard file '%s' not found" % fn) + def _add_defaults_optional(self): optional = ['test/test*.py', 'setup.cfg'] for pattern in optional: files = filter(os.path.isfile, glob(pattern)) self.filelist.extend(files) + def _add_defaults_python(self): # build_py is used to get: # - python modules # - files defined in package_data @@ -260,6 +271,7 @@ class sdist(Command): for filename in filenames: self.filelist.append(os.path.join(src_dir, filename)) + def _add_defaults_data_files(self): # getting distribution.data_files if self.distribution.has_data_files(): for item in self.distribution.data_files: @@ -276,14 +288,17 @@ class sdist(Command): if os.path.isfile(f): self.filelist.append(f) + def _add_defaults_ext(self): if self.distribution.has_ext_modules(): build_ext = self.get_finalized_command('build_ext') self.filelist.extend(build_ext.get_source_files()) + def _add_defaults_c_libs(self): if self.distribution.has_c_libraries(): build_clib = self.get_finalized_command('build_clib') self.filelist.extend(build_clib.get_source_files()) + def _add_defaults_scripts(self): if self.distribution.has_scripts(): build_scripts = self.get_finalized_command('build_scripts') self.filelist.extend(build_scripts.get_source_files()) |