diff options
| author | PJ Eby <distutils-sig@python.org> | 2009-10-12 20:00:02 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2009-10-12 20:00:02 +0000 |
| commit | 9294929b0028f551a54dd48cc3325581933b3c5f (patch) | |
| tree | e07221c46c7f32ac39160b3f2cb50e649cd5cc2e /setuptools/command/sdist.py | |
| parent | 20a0abd3d0f10198d6c21033ad2c11db2edbad71 (diff) | |
| download | python-setuptools-git-9294929b0028f551a54dd48cc3325581933b3c5f.tar.gz | |
Major updates and fixes include:
* Fix for the Python 2.6.3 build_ext API change
* Support for the most recent Sourceforge download link insanity
* Support for SVN 1.6
* Stop crashing on certain types of HTTP error
* Stop re-trying URLs that already failed retrieval once
* Fixes for various dependency management problems such as looping
builds, re-downloading packages already present on sys.path (but not
in a registered "site" directory), and randomly preferring local -f
packages over local installed packages
* Prevent lots of spurious "already imported from another path" warnings
(e.g. when pkg_resources is imported late)
* Ensure C libraries (as opposed to extensions) are also built when
doing bdist_egg
Other changes:
* Misc. documentation fixes
* Improved Jython support
* Fewer warnings under Python 2.6+
* Warn when 'packages' uses paths instead of package names (because it
causes other problems, like spurious "already imported" warnings)
* Stop using /usr/bin/sw_vers on Mac OS (replaced w/'platform' module
calls)
Note: This is NOT a merge from Distribute; upon review, many of the
tracker-submitted patches used as a basis for forking were incorrect,
incomplete, introduced new bugs, or were not addressing the root
causes. (E.g., one of the changes in this patch fixes three superficially
unrelated issues in the setuptools bug tracker.) Careful review will be
required if you want to merge this work back into Distribute.
--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075385
Diffstat (limited to 'setuptools/command/sdist.py')
| -rwxr-xr-x | setuptools/command/sdist.py | 83 |
1 files changed, 62 insertions, 21 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 5bd5ebd4..d5121de5 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -1,6 +1,7 @@ from distutils.command.sdist import sdist as _sdist from distutils.util import convert_path from distutils import log +from glob import glob import os, re, sys, pkg_resources entities = [ @@ -38,7 +39,6 @@ def joinpath(prefix,suffix): - def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): @@ -86,17 +86,21 @@ def entries_finder(dirname, filename): f = open(filename,'rU') data = f.read() f.close() - if data.startswith('9') or data.startswith('8'): # subversion 1.5/1.4 + if data.startswith('<?xml'): + for match in entries_pattern.finditer(data): + yield joinpath(dirname,unescape(match.group(1))) + else: + svnver=-1 + try: svnver = int(data.splitlines()[0]) + except: pass + if svnver<8: + log.warn("unrecognized .svn/entries format in %s", dirname) + return for record in map(str.splitlines, data.split('\n\x0c\n')[1:]): if not record or len(record)>=6 and record[5]=="delete": continue # skip deleted yield joinpath(dirname, record[0]) - elif data.startswith('<?xml'): - for match in entries_pattern.finditer(data): - yield joinpath(dirname,unescape(match.group(1))) - else: - log.warn("unrecognized .svn/entries format in %s", dirname) - + finders = [ (convert_path('CVS/Entries'), @@ -117,10 +121,6 @@ finders = [ - - - - class sdist(_sdist): """Smart sdist that finds anything supported by revision control""" @@ -162,6 +162,56 @@ class sdist(_sdist): sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close() raise + # Cribbed from old distutils code, to work around new distutils code + # that tries to do some of the same stuff as we do, in a way that makes + # us loop. + + def add_defaults (self): + standards = [('README', 'README.txt'), self.distribution.script_name] + + for fn in standards: + if type(fn) is 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 " + + string.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) + + 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 check_readme(self): alts = ("README", "README.txt") for f in alts: @@ -193,13 +243,4 @@ class sdist(_sdist): - - - - - - - - - # |
