diff options
| author | Jeremy Kloth <jeremy.kloth@gmail.com> | 2010-07-14 10:42:25 -0600 |
|---|---|---|
| committer | Jeremy Kloth <jeremy.kloth@gmail.com> | 2010-07-14 10:42:25 -0600 |
| commit | 75103af3149734f930ac1463331900cd82aee419 (patch) | |
| tree | 76bea20a4f96a092d325f58272d4f054d4ead5a0 /src/distutils2/command | |
| parent | 694b0805a0f53875b1ab2863ac026bfd132eb735 (diff) | |
| download | disutils2-75103af3149734f930ac1463331900cd82aee419.tar.gz | |
`sdist.add_defaults()` now uses source files from all commands.
Updated `sdist` to use `get_source_files()` from all possible
commands instead of the hard-coded subset of commands. This should
help eliminate some required uses of `MANIFEST.in`.
Diffstat (limited to 'src/distutils2/command')
| -rw-r--r-- | src/distutils2/command/build_py.py | 8 | ||||
| -rw-r--r-- | src/distutils2/command/install_data.py | 15 | ||||
| -rw-r--r-- | src/distutils2/command/sdist.py | 45 |
3 files changed, 26 insertions, 42 deletions
diff --git a/src/distutils2/command/build_py.py b/src/distutils2/command/build_py.py index 736c35e..7de2648 100644 --- a/src/distutils2/command/build_py.py +++ b/src/distutils2/command/build_py.py @@ -372,7 +372,13 @@ class build_py(Command, Mixin2to3): return modules def get_source_files(self): - return [module[-1] for module in self.find_all_modules()] + sources = [module[-1] for module in self.find_all_modules()] + sources += [ + os.path.join(src_dir, filename) + for package, src_dir, build_dir, filenames in self.data_files + for filename in filenames + ] + return sources def get_module_outfile(self, build_dir, package, module): outfile_path = [build_dir] + list(package) + [module + ".py"] diff --git a/src/distutils2/command/install_data.py b/src/distutils2/command/install_data.py index 06b0a33..a9980a1 100644 --- a/src/distutils2/command/install_data.py +++ b/src/distutils2/command/install_data.py @@ -74,6 +74,21 @@ class install_data(Command): (out, _) = self.copy_file(data, dir) self.outfiles.append(out) + def get_source_files(self): + sources = [] + for item in self.data_files: + if isinstance(item, str): # plain file + item = convert_path(item) + if os.path.isfile(item): + sources.append(item) + else: # a (dirname, filenames) tuple + dirname, filenames = item + for f in filenames: + f = convert_path(f) + if os.path.isfile(f): + sources.append(f) + return sources + def get_inputs(self): return self.data_files or [] diff --git a/src/distutils2/command/sdist.py b/src/distutils2/command/sdist.py index 7799ea5..b35f4d6 100644 --- a/src/distutils2/command/sdist.py +++ b/src/distutils2/command/sdist.py @@ -244,47 +244,10 @@ 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(): - 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 item in self.distribution.data_files: - if isinstance(item, str): # plain file - item = convert_path(item) - if os.path.isfile(item): - self.filelist.append(item) - else: # a (dirname, filenames) tuple - dirname, filenames = item - for f in filenames: - f = convert_path(f) - if os.path.isfile(f): - self.filelist.append(f) - - 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()) - + for cmd_name in self.distribution.get_command_names(): + cmd_obj = self.get_finalized_command(cmd_name) + self.filelist.extend(cmd_obj.get_source_files()) + def prune_file_list(self): """Prune off branches that might slip into the file list as created |
