summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/sdist.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/command/sdist.py')
-rw-r--r--Lib/distutils/command/sdist.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
index 054fe19..c057b66 100644
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -252,6 +252,9 @@ class sdist (Command):
- setup.py
- test/test*.py
- all pure Python modules mentioned in setup script
+ - all files pointed by package_data (build_py)
+ - all files defined in data_files.
+ - all files defined as scripts.
- all C sources listed as part of extensions or C libraries
in the setup script (doesn't catch C headers!)
Warns if (README or README.txt) or setup.py are missing; everything
@@ -283,10 +286,27 @@ class sdist (Command):
if files:
self.filelist.extend(files)
+ # build_py is used to get:
+ # - python modules
+ # - files defined in package_data
+ build_py = self.get_finalized_command('build_py')
+
+ # 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())
+ # getting package_data files
+ # (computed in build_py.data_files by build_py.finalize_options)
+ for pkg, src_dir, build_dir, filenames in build_py.data_files:
+ for filename in filenames:
+ self.filelist.append(os.path.join(src_dir, filename))
+
+ # getting distribution.data_files
+ if self.distribution.has_data_files():
+ for dirname, filenames in self.distribution.data_files:
+ for filename in filenames:
+ self.filelist.append(os.path.join(dirname, filename))
+
if self.distribution.has_ext_modules():
build_ext = self.get_finalized_command('build_ext')
self.filelist.extend(build_ext.get_source_files())