diff options
author | Tarek Ziadé <tarek@ziade.org> | 2009-07-16 11:14:01 +0200 |
---|---|---|
committer | Tarek Ziadé <tarek@ziade.org> | 2009-07-16 11:14:01 +0200 |
commit | 8757d946ddef2c53c9da39f207d79024d6f4d968 (patch) | |
tree | f70f00a5a95edbd8a0e7461b00415143dbee5bc5 /setuptools/command/sdist.py | |
parent | 3c405e47dff2436bc5f1779e0d8272892a1ca6d7 (diff) | |
download | external_python_setuptools-8757d946ddef2c53c9da39f207d79024d6f4d968.tar.gz external_python_setuptools-8757d946ddef2c53c9da39f207d79024d6f4d968.tar.bz2 external_python_setuptools-8757d946ddef2c53c9da39f207d79024d6f4d968.zip |
#2 fixed setuptools for 2.7 (current trunk)
--HG--
branch : distribute
extra : rebase_source : c0d03d39e1e5cdfc10d64fe2902ba583b93ef0ba
Diffstat (limited to 'setuptools/command/sdist.py')
-rwxr-xr-x | setuptools/command/sdist.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 9f692493..50c4c009 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -2,6 +2,7 @@ from distutils.command.sdist import sdist as _sdist from distutils.util import convert_path from distutils import log import os, re, sys, pkg_resources +from glob import glob entities = [ ("<","<"), (">", ">"), (""", '"'), ("'", "'"), @@ -153,6 +154,51 @@ class sdist(_sdist): if data not in dist_files: dist_files.append(data) + def add_defaults(self): + standards = [('README', 'README.txt'), + self.distribution.script_name] + for fn in standards: + if isinstance(fn, tuple): + alts = fn + got_it = 0 + for fn in alts: + if os.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 os.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(os.path.isfile, glob(pattern)) + if files: + self.filelist.extend(files) + + # 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()) + + 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 read_template(self): try: _sdist.read_template(self) |