From 9294929b0028f551a54dd48cc3325581933b3c5f Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 12 Oct 2009 20:00:02 +0000 Subject: 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 --- EasyInstall.txt | 18 +++++- ez_setup.py | 2 +- pkg_resources.py | 109 ++++++++++++++++++++++++----------- pkg_resources.txt | 20 +++---- release.sh | 2 +- setup.py | 4 +- setuptools.egg-info/entry_points.txt | 1 + setuptools.txt | 31 +++++++++- setuptools/__init__.py | 2 +- setuptools/command/alias.py | 4 +- setuptools/command/bdist_egg.py | 6 +- setuptools/command/build_ext.py | 18 +++--- setuptools/command/easy_install.py | 14 ++--- setuptools/command/egg_info.py | 22 +++---- setuptools/command/sdist.py | 83 +++++++++++++++++++------- setuptools/depends.py | 2 +- setuptools/dist.py | 53 +++++++++++++++-- setuptools/package_index.py | 62 ++++++++++---------- setuptools/sandbox.py | 75 ++++++++++++++++++------ version.dat | 2 +- 20 files changed, 368 insertions(+), 162 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index b0341e88..20e2053a 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -256,7 +256,7 @@ or directory (found in the installation directory). If you want to delete the currently installed version of a package (or all versions of a package), you should first run:: - easy_install -m PackageName + easy_install -mxN PackageName This will ensure that Python doesn't continue to search for a package you're planning to remove. After you've done this, you can safely delete the .egg @@ -427,7 +427,7 @@ below, and also the section on the `Package Index "API"`_. Password-Protected Sites ------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~ If a site you want to download from is password-protected using HTTP "Basic" authentication, you can specify your credentials in the URL, like so:: @@ -1217,7 +1217,19 @@ displayed MD5 info (broken onto two lines for readability):: Release Notes/Change History ============================ -0.6final +0.6c10 + * Support for the most recent Sourceforge download link insanity + + * 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 semi-randomly preferring local "-f" packages over + local installed packages + +0.6c9 * Fixed ``win32.exe`` support for .pth files, so unnecessary directory nesting is flattened out in the resulting egg. (There was a case-sensitivity problem that affected some distributions, notably ``pywin32``.) diff --git a/ez_setup.py b/ez_setup.py index d24e845e..f4de7e4b 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -14,7 +14,7 @@ the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6c9" +DEFAULT_VERSION = "0.6c10" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { diff --git a/pkg_resources.py b/pkg_resources.py index 9edb6c0b..baff4225 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -13,7 +13,7 @@ The package resource API is designed to work with normal filesystem packages, method. """ -import sys, os, zipimport, time, re, imp, new +import sys, os, zipimport, time, re, imp try: frozenset @@ -39,6 +39,47 @@ from os import open as os_open +_state_vars = {} + +def _declare_state(vartype, **kw): + g = globals() + for name, val in kw.iteritems(): + g[name] = val + _state_vars[name] = vartype + +def __getstate__(): + state = {} + g = globals() + for k, v in _state_vars.iteritems(): + state[k] = g['_sget_'+v](g[k]) + return state + +def __setstate__(state): + g = globals() + for k, v in state.iteritems(): + g['_sset_'+_state_vars[k]](k, g[k], v) + return state + +def _sget_dict(val): + return val.copy() + +def _sset_dict(key, ob, state): + ob.clear() + ob.update(state) + +def _sget_object(val): + return val.__getstate__() + +def _sset_object(key, ob, state): + ob.__setstate__(state) + +_sget_none = _sset_none = lambda *args: None + + + + + + def get_supported_platform(): """Return this platform's maximum compatible version. @@ -164,14 +205,8 @@ def get_provider(moduleOrReq): def _macosx_vers(_cache=[]): if not _cache: - info = os.popen('/usr/bin/sw_vers').read().splitlines() - for line in info: - key, value = line.split(None, 1) - if key == 'ProductVersion:': - _cache.append(value.strip().split(".")) - break - else: - raise ValueError, "What?!" + from platform import mac_ver + _cache.append(mac_ver()[0].split('.')) return _cache[0] def _macosx_arch(machine): @@ -203,6 +238,12 @@ get_platform = get_build_platform # XXX backward compat + + + + + + def compatible_platforms(provided,required): """Can code for the `provided` platform run on the `required` platform? @@ -387,7 +428,7 @@ class WorkingSet(object): def add_entry(self, entry): """Add a path item to ``.entries``, finding any distributions on it - ``find_distributions(entry,False)`` is used to find distributions + ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already present. (This is because ``sys.path`` can contain the same value more than @@ -622,7 +663,6 @@ class WorkingSet(object): activated to fulfill the requirements; all relevant distributions are included, even if they were already activated in this working set. """ - needed = self.resolve(parse_requirements(requirements)) for dist in needed: @@ -630,7 +670,6 @@ class WorkingSet(object): return needed - def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: @@ -639,19 +678,21 @@ class WorkingSet(object): for dist in self: callback(dist) - def _added_new(self, dist): for callback in self.callbacks: callback(dist) + def __getstate__(self): + return ( + self.entries[:], self.entry_keys.copy(), self.by_key.copy(), + self.callbacks[:] + ) - - - - - - - + def __setstate__(self, (entries, keys, by_key, callbacks)): + self.entries = entries[:] + self.entry_keys = keys.copy() + self.by_key = by_key.copy() + self.callbacks = callbacks[:] class Environment(object): @@ -1597,7 +1638,7 @@ else: -_distribution_finders = {} +_declare_state('dict', _distribution_finders = {}) def register_finder(importer_type, distribution_finder): """Register `distribution_finder` to find distributions in sys.path items @@ -1646,7 +1687,7 @@ def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) - if os.path.isdir(path_item): + if os.path.isdir(path_item) and os.access(path_item, os.R_OK): if path_item.lower().endswith('.egg'): # unpacked egg yield Distribution.from_filename( @@ -1679,8 +1720,8 @@ def find_on_path(importer, path_item, only=False): break register_finder(ImpWrapper,find_on_path) -_namespace_handlers = {} -_namespace_packages = {} +_declare_state('dict', _namespace_handlers = {}) +_declare_state('dict', _namespace_packages = {}) def register_namespace_handler(importer_type, namespace_handler): """Register `namespace_handler` to declare namespace packages @@ -1709,7 +1750,7 @@ def _handle_ns(packageName, path_item): return None module = sys.modules.get(packageName) if module is None: - module = sys.modules[packageName] = new.module(packageName) + module = sys.modules[packageName] = imp.new_module(packageName) module.__path__ = []; _set_parent_ns(packageName) elif not hasattr(module,'__path__'): raise TypeError("Not a package:", packageName) @@ -2220,12 +2261,9 @@ class Distribution(object): if not loc: return - if path is sys.path: - self.check_version_conflict() - nloc = _normalize_cached(loc) bdir = os.path.dirname(nloc) - npath= map(_normalize_cached, path) + npath= [(p and _normalize_cached(p) or p) for p in path] bp = None for p, item in enumerate(npath): @@ -2233,10 +2271,14 @@ class Distribution(object): break elif item==bdir and self.precedence==EGG_DIST: # if it's an .egg, give it precedence over its directory + if path is sys.path: + self.check_version_conflict() path.insert(p, loc) npath.insert(p, nloc) break else: + if path is sys.path: + self.check_version_conflict() path.append(loc) return @@ -2253,7 +2295,6 @@ class Distribution(object): return - def check_version_conflict(self): if self.key=='setuptools': return # ignore the inevitable setuptools self-conflicts :( @@ -2267,7 +2308,7 @@ class Distribution(object): continue fn = getattr(sys.modules[modname], '__file__', None) - if fn and normalize_path(fn).startswith(loc): + if fn and (normalize_path(fn).startswith(loc) or fn.startswith(loc)): continue issue_warning( "Module %s was already imported from %s, but %s is being added" @@ -2444,7 +2485,7 @@ class Requirement: def __contains__(self,item): if isinstance(item,Distribution): - if item.key <> self.key: return False + if item.key != self.key: return False if self.index: item = item.parsed_version # only get if we need it elif isinstance(item,basestring): item = parse_version(item) @@ -2541,7 +2582,7 @@ def _mkstemp(*args,**kw): os.open = old_open # and then put it back -# Set up global resource manager +# Set up global resource manager (deliberately not state-saved) _manager = ResourceManager() def _initialize(g): for name in dir(_manager): @@ -2550,7 +2591,7 @@ def _initialize(g): _initialize(globals()) # Prepare the master working set and make the ``require()`` API available -working_set = WorkingSet() +_declare_state('object', working_set = WorkingSet()) try: # Does the main program list any requirements? from __main__ import __requires__ diff --git a/pkg_resources.txt b/pkg_resources.txt index 7d8afd37..03793b62 100755 --- a/pkg_resources.txt +++ b/pkg_resources.txt @@ -269,7 +269,7 @@ instance: the global ``working_set`` to reflect the change. This method is also called by the ``WorkingSet()`` constructor during initialization. - This method uses ``find_distributions(entry,False)`` to find distributions + This method uses ``find_distributions(entry, True)`` to find distributions corresponding to the path entry, and then ``add()`` them. `entry` is always appended to the ``entries`` attribute, even if it is already present, however. (This is because ``sys.path`` can contain the same value @@ -1661,14 +1661,10 @@ PEP 302 Utilities for obtaining an "importer" object. It first checks for an importer for the path item in ``sys.path_importer_cache``, and if not found it calls each of the ``sys.path_hooks`` and caches the result if a good importer is - found. If no importer is found, this routine returns an ``ImpWrapper`` - instance that wraps the builtin import machinery as a PEP 302-compliant - "importer" object. This ``ImpWrapper`` is *not* cached; instead a new - instance is returned each time. - - (Note: When run under Python 2.5, this function is simply an alias for - ``pkgutil.get_importer()``, and instead of ``pkg_resources.ImpWrapper`` - instances, it may return ``pkgutil.ImpImporter`` instances.) + found. If no importer is found, this routine returns a wrapper object + that wraps the builtin import machinery as a PEP 302-compliant "importer" + object. This wrapper object is *not* cached; instead a new instance is + returned each time. File/Path Utilities @@ -1692,7 +1688,11 @@ File/Path Utilities Release Notes/Change History ---------------------------- -0.6final +0.6c10 + * Prevent lots of spurious "already imported from another path" warnings (e.g. + when pkg_resources is imported late). + +0.6c9 * Fix ``resource_listdir('')`` always returning an empty list for zipped eggs. 0.6c7 diff --git a/release.sh b/release.sh index c53357d9..2d2da5eb 100755 --- a/release.sh +++ b/release.sh @@ -7,7 +7,7 @@ # If your initials aren't PJE, don't run it. :) # -export VERSION="0.6c9" +export VERSION="0.6c10" python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ diff --git a/setup.py b/setup.py index b5da4183..198ae88d 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ d = {} execfile(convert_path('setuptools/command/__init__.py'), d) SETUP_COMMANDS = d['__all__'] -VERSION = "0.6c9" +VERSION = "0.6c10" from setuptools import setup, find_packages import sys @@ -53,8 +53,8 @@ setup( "include_package_data = setuptools.dist:assert_bool", "dependency_links = setuptools.dist:assert_string_list", "test_loader = setuptools.dist:check_importable", + "packages = setuptools.dist:check_packages", ], - "egg_info.writers": [ "PKG-INFO = setuptools.command.egg_info:write_pkg_info", "requires.txt = setuptools.command.egg_info:write_requirements", diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index f7367e0d..10f1da6c 100755 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -49,6 +49,7 @@ test_suite = setuptools.dist:check_test_suite eager_resources = setuptools.dist:assert_string_list zip_safe = setuptools.dist:assert_bool test_loader = setuptools.dist:check_importable +packages = setuptools.dist:check_packages tests_require = setuptools.dist:check_requirements [setuptools.installation] diff --git a/setuptools.txt b/setuptools.txt index d1b25302..93940528 100755 --- a/setuptools.txt +++ b/setuptools.txt @@ -2569,6 +2569,27 @@ A few important points for writing revision control file finders: inform the user of the missing program(s). +A Note Regarding Dependencies +----------------------------- + +If the project *containing* your distutils/setuptools extension(s) depends on +any projects other than setuptools, you *must* also declare those dependencies +as part of your project's ``setup_requires`` keyword, so that they will +already be built (and at least temprorarily installed) before your extension +project is built. + +So, if for example you create a project Foo that includes a new file finder +plugin, and Foo depends on Bar, then you *must* list Bar in both the +``install_requires`` **and** ``setup_requires`` arguments to ``setup()``. + +If you don't do this, then in certain edge cases you may cause setuptools to +try to go into infinite recursion, trying to build your dependencies to resolve +your dependencies, while still building your dependencies. (It probably won't +happen on your development machine, but it *will* happen in a full build +pulling everything from revision control on a clean machine, and then you or +your users will be scratching their heads trying to figure it out!) + + Subclassing ``Command`` ----------------------- @@ -2611,7 +2632,15 @@ XXX Release Notes/Change History ---------------------------- -0.6final +0.6c10 + * Fix for the Python 2.6.3 build_ext API change + + * Ensure C libraries (as opposed to extensions) are also built when doing + bdist_egg + + * Support for SVN 1.6 + +0.6c9 * Fixed a missing files problem when using Windows source distributions on non-Windows platforms, due to distutils not handling manifest file line endings correctly. diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 56cbf767..a9f6544d 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -7,7 +7,7 @@ from distutils.core import Command as _Command from distutils.util import convert_path import os.path -__version__ = '0.6c9' +__version__ = '0.6c10' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' diff --git a/setuptools/command/alias.py b/setuptools/command/alias.py index f5368b29..40c00b55 100755 --- a/setuptools/command/alias.py +++ b/setuptools/command/alias.py @@ -9,7 +9,7 @@ def shquote(arg): """Quote an argument for later parsing by shlex.split()""" for c in '"', "'", "\\", "#": if c in arg: return repr(arg) - if arg.split()<>[arg]: + if arg.split()!=[arg]: return repr(arg) return arg @@ -33,7 +33,7 @@ class alias(option_base): def finalize_options(self): option_base.finalize_options(self) - if self.remove and len(self.args)<>1: + if self.remove and len(self.args)!=1: raise DistutilsOptionError( "Must specify exactly one argument (the alias name) when " "using --remove" diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 9e852a3f..7e5a3799 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -165,12 +165,13 @@ class bdist_egg(Command): def run(self): # Generate metadata first self.run_command("egg_info") - # We run install_lib before install_data, because some data hacks # pull their data path from the install_lib command. log.info("installing library code to %s" % self.bdist_dir) instcmd = self.get_finalized_command('install') old_root = instcmd.root; instcmd.root = None + if self.distribution.has_c_libraries() and not self.skip_build: + self.run_command('build_clib') cmd = self.call_command('install_lib', warn_dir=0) instcmd.root = old_root @@ -190,7 +191,6 @@ class bdist_egg(Command): to_compile.extend(self.make_init_files()) if to_compile: cmd.byte_compile(to_compile) - if self.distribution.data_files: self.do_install_data() @@ -398,7 +398,7 @@ def write_safety_flag(egg_dir, safe): for flag,fn in safety_flags.items(): fn = os.path.join(egg_dir, fn) if os.path.exists(fn): - if safe is None or bool(safe)<>flag: + if safe is None or bool(safe)!=flag: os.unlink(fn) elif safe is not None and bool(safe)==flag: f=open(fn,'wb'); f.write('\n'); f.close() diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index c0aaa8e8..f6f3355d 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -82,15 +82,15 @@ class build_ext(_build_ext): def get_ext_filename(self, fullname): filename = _build_ext.get_ext_filename(self,fullname) - ext = self.ext_map[fullname] - if isinstance(ext,Library): - fn, ext = os.path.splitext(filename) - return self.shlib_compiler.library_filename(fn,libtype) - elif use_stubs and ext._links_to_dynamic: - d,fn = os.path.split(filename) - return os.path.join(d,'dl-'+fn) - else: - return filename + if fullname in self.ext_map: + ext = self.ext_map[fullname] + if isinstance(ext,Library): + fn, ext = os.path.splitext(filename) + return self.shlib_compiler.library_filename(fn,libtype) + elif use_stubs and ext._links_to_dynamic: + d,fn = os.path.split(filename) + return os.path.join(d,'dl-'+fn) + return filename def initialize_options(self): _build_ext.initialize_options(self) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index f06b6ddd..a5a23ad4 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -204,7 +204,7 @@ class easy_install(Command): self.outputs = [] def run(self): - if self.verbose<>self.distribution.verbose: + if self.verbose!=self.distribution.verbose: log.set_verbosity(self.verbose) try: for spec in self.args: @@ -252,7 +252,7 @@ class easy_install(Command): # Is it a configured, PYTHONPATH, implicit, or explicit site dir? is_site_dir = instdir in self.all_site_dirs - if not is_site_dir: + if not is_site_dir and not self.multi_version: # No? Then directly test whether it does .pth file processing is_site_dir = self.check_pth_processing() else: @@ -430,9 +430,9 @@ Please make the appropriate changes for your system and try again. self.check_editable(spec) dist = self.package_index.fetch_distribution( - spec, tmpdir, self.upgrade, self.editable, not self.always_copy + spec, tmpdir, self.upgrade, self.editable, not self.always_copy, + self.local_index ) - if dist is None: msg = "Could not find suitable distribution for %r" % spec if self.always_copy: @@ -722,7 +722,7 @@ Please make the appropriate changes for your system and try again. f = open(pkg_inf,'w') f.write('Metadata-Version: 1.0\n') for k,v in cfg.items('metadata'): - if k<>'target_version': + if k!='target_version': f.write('%s: %s\n' % (k.replace('_','-').title(), v)) f.close() script_dir = os.path.join(egg_info,'scripts') @@ -988,7 +988,6 @@ See the setuptools documentation for the "develop" command for more info. def pf(src,dst): if dst.endswith('.py') and not src.startswith('EGG-INFO/'): to_compile.append(dst) - to_chmod.append(dst) elif dst.endswith('.dll') or dst.endswith('.so'): to_chmod.append(dst) self.unpack_progress(src,dst) @@ -1023,6 +1022,7 @@ See the setuptools documentation for the "develop" command for more info. + def no_default_version_msg(self): return """bad install directory or PYTHONPATH @@ -1286,7 +1286,7 @@ def get_exe_prefixes(exe_filename): if parts[1].endswith('.egg-info'): prefixes.insert(0,('/'.join(parts[:2]), 'EGG-INFO/')) break - if len(parts)<>2 or not name.endswith('.pth'): + if len(parts)!=2 or not name.endswith('.pth'): continue if name.endswith('-nspkg.pth'): continue diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 9741e26a..5a8b2db8 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -217,18 +217,21 @@ class egg_info(Command): data = f.read() f.close() - if data.startswith('9') or data.startswith('8'): + if data.startswith('9 and d[9]]+[0]) - elif data.startswith('=6 and record[5]=="delete": continue # skip deleted yield joinpath(dirname, record[0]) - elif data.startswith('"unknown" and version >= self.requested_version + str(version)!="unknown" and version >= self.requested_version def get_version(self, paths=None, default="unknown"): diff --git a/setuptools/dist.py b/setuptools/dist.py index 30ff35e3..c1218ef2 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -8,7 +8,7 @@ from setuptools.command.install_lib import install_lib from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError import setuptools, pkg_resources, distutils.core, distutils.dist, distutils.cmd -import os, distutils.log +import os, distutils.log, re def _get_unpatched(cls): """Protect against re-patching the distutils if reloaded @@ -61,8 +61,8 @@ def check_nsp(dist, attr, value): parent = '.'.join(nsp.split('.')[:-1]) if parent not in value: distutils.log.warn( - "%r is declared as a package namespace, but %r is not:" - " please correct this in setup.py", nsp, parent + "WARNING: %r is declared as a package namespace, but %r" + " is not: please correct this in setup.py", nsp, parent ) def check_extras(dist, attr, value): @@ -120,6 +120,47 @@ def check_package_data(dist, attr, value): attr+" must be a dictionary mapping package names to lists of " "wildcard patterns" ) + +def check_packages(dist, attr, value): + for pkgname in value: + if not re.match(r'\w+(\.\w+)*', pkgname): + distutils.log.warn( + "WARNING: %r not a valid package name; please use only" + ".-separated package names in setup.py", pkgname + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class Distribution(_Distribution): """Distribution with support for features, tests, and package data @@ -415,19 +456,19 @@ class Distribution(_Distribution): if self.packages: self.packages = [ p for p in self.packages - if p<>package and not p.startswith(pfx) + if p!=package and not p.startswith(pfx) ] if self.py_modules: self.py_modules = [ p for p in self.py_modules - if p<>package and not p.startswith(pfx) + if p!=package and not p.startswith(pfx) ] if self.ext_modules: self.ext_modules = [ p for p in self.ext_modules - if p.name<>package and not p.name.startswith(pfx) + if p.name!=package and not p.name.startswith(pfx) ] diff --git a/setuptools/package_index.py b/setuptools/package_index.py index da3fed12..70b75a6f 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -1,5 +1,6 @@ """PyPI and direct package downloading""" import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO +import httplib from pkg_resources import * from distutils import log from distutils.errors import DistutilsError @@ -8,7 +9,6 @@ try: except ImportError: from md5 import md5 from fnmatch import translate - EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.]+)$') HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) # this is here to fix emacs' cruddy broken syntax highlighting @@ -42,6 +42,8 @@ def parse_bdist_wininst(name): def egg_info_for_url(url): scheme, server, path, parameters, query, fragment = urlparse.urlparse(url) base = urllib2.unquote(path.split('/')[-1]) + if server=='sourceforge.net' and base=='download': # XXX Yuck + base = urllib2.unquote(path.split('/')[-2]) if '#' in base: base, fragment = base.split('#',1) return base,fragment @@ -64,14 +66,12 @@ def distros_for_location(location, basename, metadata=None): if basename.endswith('.egg') and '-' in basename: # only one, unambiguous interpretation return [Distribution.from_location(location, basename, metadata)] - if basename.endswith('.exe'): win_base, py_ver = parse_bdist_wininst(basename) if win_base is not None: return interpret_distro_name( location, win_base, metadata, py_ver, BINARY_DIST, "win32" ) - # Try source distro extensions (.zip, .tgz, etc.) # for ext in EXTENSIONS: @@ -186,10 +186,10 @@ class PackageIndex(Environment): return self.info("Reading %s", url) + self.fetched_urls[url] = True # prevent multiple fetch attempts f = self.open_url(url, "Download error: %s -- Some packages may not be found!") if f is None: return - self.fetched_urls[url] = self.fetched_urls[f.url] = True - + self.fetched_urls[f.url] = True if 'html' not in f.headers.get('content-type', '').lower(): f.close() # not html, we can't process it return @@ -329,7 +329,7 @@ class PackageIndex(Environment): def check_md5(self, cs, info, filename, tfp): if re.match('md5=[0-9a-f]{32}$', info): self.debug("Validating md5 checksum for %s", filename) - if cs.hexdigest()<>info[4:]: + if cs.hexdigest()!=info[4:]: tfp.close() os.unlink(filename) raise DistutilsError( @@ -409,7 +409,8 @@ class PackageIndex(Environment): def fetch_distribution(self, - requirement, tmpdir, force_scan=False, source=False, develop_ok=False + requirement, tmpdir, force_scan=False, source=False, develop_ok=False, + local_index=None, ): """Obtain a distribution suitable for fulfilling `requirement` @@ -427,15 +428,15 @@ class PackageIndex(Environment): set, development and system eggs (i.e., those using the ``.egg-info`` format) will be ignored. """ - # process a Requirement self.info("Searching for %s", requirement) skipped = {} + dist = None - def find(req): + def find(env, req): # Find a matching distribution; may be called more than once - for dist in self[req.key]: + for dist in env[req.key]: if dist.precedence==DEVELOP_DIST and not develop_ok: if dist not in skipped: @@ -444,23 +445,25 @@ class PackageIndex(Environment): continue if dist in req and (dist.precedence<=SOURCE_DIST or not source): - self.info("Best match: %s", dist) - return dist.clone( - location=self.download(dist.location, tmpdir) - ) + return dist + + if force_scan: self.prescan() self.find_packages(requirement) + dist = find(self, requirement) + + if local_index is not None: + dist = dist or find(local_index, requirement) - dist = find(requirement) if dist is None and self.to_scan is not None: self.prescan() - dist = find(requirement) + dist = find(self, requirement) if dist is None and not force_scan: self.find_packages(requirement) - dist = find(requirement) + dist = find(self, requirement) if dist is None: self.warn( @@ -468,7 +471,9 @@ class PackageIndex(Environment): (source and "a source distribution of " or ""), requirement, ) - return dist + self.info("Best match: %s", dist) + return dist.clone(location=self.download(dist.location, tmpdir)) + def fetch(self, requirement, tmpdir, force_scan=False, source=False): """Obtain a file suitable for fulfilling `requirement` @@ -485,11 +490,6 @@ class PackageIndex(Environment): - - - - - def gen_setup(self, filename, fragment, tmpdir): match = EGG_FRAGMENT.match(fragment) dists = match and [d for d in @@ -573,17 +573,19 @@ class PackageIndex(Environment): def open_url(self, url, warning=None): - if url.startswith('file:'): - return local_open(url) + if url.startswith('file:'): return local_open(url) try: return open_with_auth(url) except urllib2.HTTPError, v: return v except urllib2.URLError, v: - if warning: self.warn(warning, v.reason) - else: - raise DistutilsError("Download error for %s: %s" - % (url, v.reason)) + reason = v.reason + except httplib.HTTPException, v: + reason = "%s: %s" % (v.__doc__ or v.__class__.__name__, v) + if warning: + self.warn(warning, reason) + else: + raise DistutilsError("Download error for %s: %s" % (url, reason)) def _download_url(self, scheme, url, tmpdir): # Determine download filename @@ -611,8 +613,6 @@ class PackageIndex(Environment): self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) - - def scan_url(self, url): self.process_url(url, True) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 4db0dbdb..00eb0124 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -1,14 +1,46 @@ -import os, sys, __builtin__, tempfile, operator +import os, sys, __builtin__, tempfile, operator, pkg_resources _os = sys.modules[os.name] _open = open +_file = file + from distutils.errors import DistutilsError +from pkg_resources import working_set + __all__ = [ "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", ] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" - old_dir = os.getcwd() save_argv = sys.argv[:] save_path = sys.path[:] @@ -16,13 +48,16 @@ def run_setup(setup_script, args): temp_dir = os.path.join(setup_dir,'temp') if not os.path.isdir(temp_dir): os.makedirs(temp_dir) save_tmp = tempfile.tempdir - + save_modules = sys.modules.copy() + pr_state = pkg_resources.__getstate__() try: - tempfile.tempdir = temp_dir - os.chdir(setup_dir) + tempfile.tempdir = temp_dir; os.chdir(setup_dir) try: sys.argv[:] = [setup_script]+list(args) sys.path.insert(0, setup_dir) + # reset to include setup dir, w/clean callback list + working_set.__init__() + working_set.callbacks.append(lambda dist:dist.activate()) DirectorySandbox(setup_dir).run( lambda: execfile( "setup.py", @@ -34,11 +69,17 @@ def run_setup(setup_script, args): raise # Normal exit, just return finally: + pkg_resources.__setstate__(pr_state) + sys.modules.update(save_modules) + for key in list(sys.modules): + if key not in save_modules: del sys.modules[key] os.chdir(old_dir) sys.path[:] = save_path sys.argv[:] = save_argv tempfile.tempdir = save_tmp + + class AbstractSandbox: """Wrap 'os' module and 'open()' builtin for virtualizing setup scripts""" @@ -58,15 +99,16 @@ class AbstractSandbox: """Run 'func' under os sandboxing""" try: self._copy(self) - __builtin__.open = __builtin__.file = self._open + __builtin__.file = self._file + __builtin__.open = self._open self._active = True return func() finally: self._active = False - __builtin__.open = __builtin__.file = _open + __builtin__.open = _file + __builtin__.file = _open self._copy(_os) - def _mk_dual_path_wrapper(name): original = getattr(_os,name) def wrap(self,src,dst,*args,**kw): @@ -75,7 +117,6 @@ class AbstractSandbox: return original(src,dst,*args,**kw) return wrap - for name in ["rename", "link", "symlink"]: if hasattr(_os,name): locals()[name] = _mk_dual_path_wrapper(name) @@ -88,7 +129,8 @@ class AbstractSandbox: return original(path,*args,**kw) return wrap - _open = _mk_single_path_wrapper('file', _open) + _open = _mk_single_path_wrapper('open', _open) + _file = _mk_single_path_wrapper('file', _file) for name in [ "stat", "listdir", "chdir", "open", "chmod", "chown", "mkdir", "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat", @@ -96,7 +138,6 @@ class AbstractSandbox: ]: if hasattr(_os,name): locals()[name] = _mk_single_path_wrapper(name) - def _mk_single_with_return(name): original = getattr(_os,name) def wrap(self,path,*args,**kw): @@ -187,22 +228,22 @@ class DirectorySandbox(AbstractSandbox): self._violation(operation, src, dst, *args, **kw) return (src,dst) + def _file(self, path, mode='r', *args, **kw): + if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path): + self._violation("file", path, mode, *args, **kw) + return _file(path,mode,*args,**kw) + def open(self, file, flags, mode=0777): """Called for low-level os.open()""" if flags & WRITE_FLAGS and not self._ok(file): self._violation("os.open", file, flags, mode) return _os.open(file,flags,mode) - WRITE_FLAGS = reduce( - operator.or_, - [getattr(_os, a, 0) for a in + operator.or_, [getattr(_os, a, 0) for a in "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] ) - - - class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" diff --git a/version.dat b/version.dat index 32144c8e..16ecd2aa 100755 --- a/version.dat +++ b/version.dat @@ -1,6 +1,6 @@ [setuptools] status = 'release candidate' major = 0 -build = 9 +build = 10 minor = 6 -- cgit v1.2.3 From 11e0e840b1d2b9b2e4326facb2f05eacec71bafa Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 12 Oct 2009 20:05:56 +0000 Subject: Backport fixes for issues 16 & 23 from trunk --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075386 --- pkg_resources.py | 20 ++++++++++---------- setuptools/archive_util.py | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg_resources.py b/pkg_resources.py index baff4225..79db00b8 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -20,18 +20,18 @@ try: except NameError: from sets import ImmutableSet as frozenset -from os import utime, rename, unlink # capture these to bypass sandboxing +# capture these to bypass sandboxing +from os import utime, rename, unlink, mkdir from os import open as os_open +from os.path import isdir, split - - - - - - - - +def _bypass_ensure_directory(name, mode=0777): + # Sandbox-bypassing version of ensure_directory() + dirname, filename = split(name) + if dirname and filename and not isdir(dirname): + _bypass_ensure_directory(dirname) + mkdir(dirname, mode) @@ -957,7 +957,7 @@ variable to point to an accessible directory. extract_path = self.extraction_path or get_default_cache() target_path = os.path.join(extract_path, archive_name+'-tmp', *names) try: - ensure_directory(target_path) + _bypass_ensure_directory(target_path) except: self.extraction_error() diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index 511f05ad..5d72e7ed 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -189,7 +189,10 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): if dst: if dst.endswith(os.sep): dst = dst[:-1] - tarobj._extract_member(member,dst) # XXX Ugh + try: + tarobj._extract_member(member,dst) # XXX Ugh + except tarfile.ExtractError: + pass # chown/chmod/mkfifo/mknode/makedev failed return True finally: tarobj.close() @@ -200,6 +203,3 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile - - - -- cgit v1.2.3 From 81e2bb6c275be23a335e2735bb346559357b9d7e Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 12 Oct 2009 20:21:43 +0000 Subject: Windows 64/Vista UAC fixes --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075388 --- setuptools/cli.exe | Bin 6656 -> 7168 bytes setuptools/command/easy_install.py | 45 +++++++++++++++++++++++++++++++++++-- setuptools/gui.exe | Bin 7168 -> 7168 bytes 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/setuptools/cli.exe b/setuptools/cli.exe index 3173b2b2..49154400 100755 Binary files a/setuptools/cli.exe and b/setuptools/cli.exe differ diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index a5a23ad4..af4e3497 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1590,12 +1590,53 @@ def get_script_args(dist, executable=sys_executable, wininst=False): yield (name+ext, hdr+script_text, 't', [name+x for x in old]) yield ( name+'.exe', resource_string('setuptools', launcher), - 'b' # write in binary mode - ) + 'b') # write in binary mode + yield (name+'.exe.manifest', _launcher_manifest % (name,), 't') else: # On other platforms, we assume the right thing to do is to # just write the stub with no extension. yield (name, header+script_text) + +_launcher_manifest = """ + + + + + + + + + + + + +""" + + + + + + + + + + + + + + + + + + + + + + + def rmtree(path, ignore_errors=False, onerror=auto_chmod): """Recursively delete a directory tree. diff --git a/setuptools/gui.exe b/setuptools/gui.exe index 53d4ff81..5231ed90 100755 Binary files a/setuptools/gui.exe and b/setuptools/gui.exe differ -- cgit v1.2.3 From da607e59a42f29d99defe7e74cf7321d1d575aaa Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 12 Oct 2009 20:23:55 +0000 Subject: Update change log --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075389 --- EasyInstall.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/EasyInstall.txt b/EasyInstall.txt index 20e2053a..b03a29a1 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1218,6 +1218,10 @@ Release Notes/Change History ============================ 0.6c10 + * Fix easy_install.exe giving UAC errors on Windows Vista + + * Fix installed script .exe files not working with 64-bit Python on Windows + * Support for the most recent Sourceforge download link insanity * Stop crashing on certain types of HTTP error -- cgit v1.2.3 From e3aaece7b04a0947d15862cdcf0baf9900342e13 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 14 Oct 2009 02:53:15 +0000 Subject: Add a better link to the files --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075399 --- README.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 50ef99b3..03a2afcd 100755 --- a/README.txt +++ b/README.txt @@ -90,7 +90,7 @@ Downloads All setuptools downloads can be found at `the project's home page in the Python Package Index`_. Scroll to the very bottom of the page to find the links. -.. _the project's home page in the Python Package Index: http://pypi.python.org/pypi/setuptools +.. _the project's home page in the Python Package Index: http://pypi.python.org/pypi/setuptools#files In addition to the PyPI downloads, the development version of ``setuptools`` is available from the `Python SVN sandbox`_, and in-development versions of the @@ -159,3 +159,4 @@ Credits "Code Bear" Taylor) contributed their time and stress as guinea pigs for the use of eggs and setuptools, even before eggs were "cool". (Thanks, guys!) +.. _files: -- cgit v1.2.3 From de0eb5ca27896c10e01e1686913cbf01f4f540cb Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 19:46:34 +0000 Subject: Release update, fix string.join in README warning --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075540 --- ez_setup.py | 4 ++++ release.sh | 1 + setuptools.egg-info/entry_points.txt | 2 +- setuptools/command/sdist.py | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index f4de7e4b..bb8b5acc 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -28,6 +28,10 @@ md5_data = { 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', + 'setuptools-0.6c10-py2.3.egg': 'cb00cbd3d93b66f6c118a1c042113f93', + 'setuptools-0.6c10-py2.4.egg': 'be702e15b4b61628e059d6ab88335a87', + 'setuptools-0.6c10-py2.5.egg': '79b809922c0ce55e2d8b5b0cc31da0f2', + 'setuptools-0.6c10-py2.6.egg': 'c4b741e774a793609d508ff4a2a21194', 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', diff --git a/release.sh b/release.sh index 2d2da5eb..59558707 100755 --- a/release.sh +++ b/release.sh @@ -12,6 +12,7 @@ export VERSION="0.6c10" python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ python2.5 setup.py -q release binary --target-version=2.5 upload && \ +python2.6 setup.py -q release binary --target-version=2.6 upload && \ python2.3 ez_setup.py --md5update dist/setuptools-$VERSION*-py2.?.egg && \ cp ez_setup.py virtual-python.py ~/distrib/ && \ cp ez_setup.py ~/projects/ez_setup/__init__.py && \ diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index 10f1da6c..2642c316 100755 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -31,7 +31,7 @@ depends.txt = setuptools.command.egg_info:warn_depends_obsolete [console_scripts] easy_install = setuptools.command.easy_install:main -easy_install-2.5 = setuptools.command.easy_install:main +easy_install-2.6 = setuptools.command.easy_install:main [setuptools.file_finders] svn_cvs = setuptools.command.sdist:_default_revctrl diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index d5121de5..d84afdb8 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -181,7 +181,7 @@ class sdist(_sdist): if not got_it: self.warn("standard file not found: should have one of " + - string.join(alts, ', ')) + ', '.join(alts)) else: if os.path.exists(fn): self.filelist.append(fn) -- cgit v1.2.3 From 7742bceaefff829d1c886e410f5124902c52516c Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:03:29 +0000 Subject: Missing launcher fixes --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075544 --- launcher.c | 11 ++++++----- setuptools/cli.exe | Bin 7168 -> 7168 bytes setuptools/gui.exe | Bin 7168 -> 7168 bytes 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/launcher.c b/launcher.c index c8022505..201219cc 100755 --- a/launcher.c +++ b/launcher.c @@ -81,17 +81,18 @@ char *quoted(char *data) { char *loadable_exe(char *exename) { - HINSTANCE hPython; /* DLL handle for python executable */ + /* HINSTANCE hPython; DLL handle for python executable */ char *result; - hPython = LoadLibraryEx(exename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (!hPython) return NULL; + /* hPython = LoadLibraryEx(exename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (!hPython) return NULL; */ /* Return the absolute filename for spawnv */ result = calloc(MAX_PATH, sizeof(char)); - if (result) GetModuleFileName(hPython, result, MAX_PATH); + strncpy(result, exename, MAX_PATH); + /*if (result) GetModuleFileName(hPython, result, MAX_PATH); - FreeLibrary(hPython); + FreeLibrary(hPython); */ return result; } diff --git a/setuptools/cli.exe b/setuptools/cli.exe index 49154400..8906ff77 100755 Binary files a/setuptools/cli.exe and b/setuptools/cli.exe differ diff --git a/setuptools/gui.exe b/setuptools/gui.exe index 5231ed90..474838d5 100755 Binary files a/setuptools/gui.exe and b/setuptools/gui.exe differ -- cgit v1.2.3 From 33415044219744c3d3c27096959f4e5e4fb6998e Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:06:29 +0000 Subject: Update to version 0.6c11 --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075545 --- ez_setup.py | 2 +- release.sh | 2 +- setup.py | 2 +- setuptools/__init__.py | 2 +- version.dat | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index bb8b5acc..3b598c50 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -14,7 +14,7 @@ the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6c10" +DEFAULT_VERSION = "0.6c11" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { diff --git a/release.sh b/release.sh index 59558707..00ffa57d 100755 --- a/release.sh +++ b/release.sh @@ -7,7 +7,7 @@ # If your initials aren't PJE, don't run it. :) # -export VERSION="0.6c10" +export VERSION="0.6c11" python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ diff --git a/setup.py b/setup.py index 198ae88d..b9a40769 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ d = {} execfile(convert_path('setuptools/command/__init__.py'), d) SETUP_COMMANDS = d['__all__'] -VERSION = "0.6c10" +VERSION = "0.6c11" from setuptools import setup, find_packages import sys diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a9f6544d..a314ca7e 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -7,7 +7,7 @@ from distutils.core import Command as _Command from distutils.util import convert_path import os.path -__version__ = '0.6c10' +__version__ = '0.6c11' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' diff --git a/version.dat b/version.dat index 16ecd2aa..d312dddc 100755 --- a/version.dat +++ b/version.dat @@ -1,6 +1,6 @@ [setuptools] status = 'release candidate' major = 0 -build = 10 +build = 11 minor = 6 -- cgit v1.2.3 From 86439f1b2b983c8a41448f86895d9646a3b0568a Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:19:30 +0000 Subject: Build correct filenames for py2.6 "cross-compile" --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075546 --- release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release.sh b/release.sh index 00ffa57d..e184d021 100755 --- a/release.sh +++ b/release.sh @@ -8,11 +8,11 @@ # export VERSION="0.6c11" - +python2.3 setup.py -q egg_info # force upload to be available python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ python2.5 setup.py -q release binary --target-version=2.5 upload && \ -python2.6 setup.py -q release binary --target-version=2.6 upload && \ +python2.6 setup.py -q release binary --target-version=2.6 -p win32 upload && \ python2.3 ez_setup.py --md5update dist/setuptools-$VERSION*-py2.?.egg && \ cp ez_setup.py virtual-python.py ~/distrib/ && \ cp ez_setup.py ~/projects/ez_setup/__init__.py && \ -- cgit v1.2.3 From c5d26a405390ac00223a0a1967e6f134ac69ed5b Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:47:44 +0000 Subject: Fix the elusive "double upload bdist_wininst" bug --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075548 --- setuptools/command/bdist_wininst.py | 67 ++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py index 93e6846d..e8521f83 100755 --- a/setuptools/command/bdist_wininst.py +++ b/setuptools/command/bdist_wininst.py @@ -2,26 +2,24 @@ from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst import os, sys class bdist_wininst(_bdist_wininst): + _good_upload = _bad_upload = None def create_exe(self, arcname, fullname, bitmap=None): _bdist_wininst.create_exe(self, arcname, fullname, bitmap) - dist_files = getattr(self.distribution, 'dist_files', []) - + installer_name = self.get_installer_filename(fullname) if self.target_version: - installer_name = os.path.join(self.dist_dir, - "%s.win32-py%s.exe" % - (fullname, self.target_version)) pyversion = self.target_version - - # fix 2.5 bdist_wininst ignoring --target-version spec - bad = ('bdist_wininst','any',installer_name) - if bad in dist_files: - dist_files.remove(bad) + # fix 2.5+ bdist_wininst ignoring --target-version spec + self._bad_upload = ('bdist_wininst', 'any', installer_name) else: - installer_name = os.path.join(self.dist_dir, - "%s.win32.exe" % fullname) pyversion = 'any' - good = ('bdist_wininst', pyversion, installer_name) + self._good_upload = ('bdist_wininst', pyversion, installer_name) + + def _fix_upload_names(self): + good, bad = self._good_upload, self._bad_upload + dist_files = getattr(self.distribution, 'dist_files', []) + if bad in dist_files: + dist_files.remove(bad) if good not in dist_files: dist_files.append(good) @@ -36,6 +34,49 @@ class bdist_wininst(_bdist_wininst): self._is_running = True try: _bdist_wininst.run(self) + self._fix_upload_names() finally: self._is_running = False + + + if not hasattr(_bdist_wininst, 'get_installer_filename'): + def get_installer_filename(self, fullname): + # Factored out to allow overriding in subclasses + if self.target_version: + # if we create an installer for a specific python version, + # it's better to include this in the name + installer_name = os.path.join(self.dist_dir, + "%s.win32-py%s.exe" % + (fullname, self.target_version)) + else: + installer_name = os.path.join(self.dist_dir, + "%s.win32.exe" % fullname) + return installer_name + # get_installer_filename() + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 0b6145a275ffa6ff89ed286f47b6af033d664c2b Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:49:47 +0000 Subject: Update change logs for release --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075549 --- EasyInstall.txt | 6 ++++-- setuptools.txt | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index b03a29a1..2bf69e90 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1217,11 +1217,13 @@ displayed MD5 info (broken onto two lines for readability):: Release Notes/Change History ============================ +0.6c11 + * Fix installed script .exe files not working with 64-bit Python on Windows + (wasn't actually released in 0.6c10 due to a lost checkin) + 0.6c10 * Fix easy_install.exe giving UAC errors on Windows Vista - * Fix installed script .exe files not working with 64-bit Python on Windows - * Support for the most recent Sourceforge download link insanity * Stop crashing on certain types of HTTP error diff --git a/setuptools.txt b/setuptools.txt index 93940528..c709a908 100755 --- a/setuptools.txt +++ b/setuptools.txt @@ -2632,6 +2632,9 @@ XXX Release Notes/Change History ---------------------------- +0.6c11 + * Fix "bdist_wininst upload" trying to upload same file twice + 0.6c10 * Fix for the Python 2.6.3 build_ext API change -- cgit v1.2.3 From 2015618bf61262dbb18bffd4086b683dd2d0e85d Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 19 Oct 2009 21:51:24 +0000 Subject: Fixed MD5's --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075550 --- ez_setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 3b598c50..7aab12d1 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -28,10 +28,10 @@ md5_data = { 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', - 'setuptools-0.6c10-py2.3.egg': 'cb00cbd3d93b66f6c118a1c042113f93', - 'setuptools-0.6c10-py2.4.egg': 'be702e15b4b61628e059d6ab88335a87', - 'setuptools-0.6c10-py2.5.egg': '79b809922c0ce55e2d8b5b0cc31da0f2', - 'setuptools-0.6c10-py2.6.egg': 'c4b741e774a793609d508ff4a2a21194', + 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', + 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', + 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', + 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', -- cgit v1.2.3 From e3e7199a5e9487b16beb24c59d111303f765c097 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Tue, 20 Oct 2009 14:16:29 +0000 Subject: Update MD5's --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075567 --- ez_setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ez_setup.py b/ez_setup.py index 7aab12d1..1ff1d3e7 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -32,6 +32,10 @@ md5_data = { 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', + 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de', + 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b', + 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2', + 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086', 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', -- cgit v1.2.3 From 2a5eaaedacf84a2992fd800203276b1079b96bd1 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 28 Oct 2009 17:12:45 +0000 Subject: Bump version --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075925 --- ez_setup.py | 2 +- release.sh | 2 +- setup.py | 2 +- setuptools/__init__.py | 2 +- version.dat | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 1ff1d3e7..997c453d 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -14,7 +14,7 @@ the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6c11" +DEFAULT_VERSION = "0.6c12" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { diff --git a/release.sh b/release.sh index e184d021..5e38b70e 100755 --- a/release.sh +++ b/release.sh @@ -7,7 +7,7 @@ # If your initials aren't PJE, don't run it. :) # -export VERSION="0.6c11" +export VERSION="0.6c12" python2.3 setup.py -q egg_info # force upload to be available python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ diff --git a/setup.py b/setup.py index b9a40769..d4962687 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ d = {} execfile(convert_path('setuptools/command/__init__.py'), d) SETUP_COMMANDS = d['__all__'] -VERSION = "0.6c11" +VERSION = "0.6c12" from setuptools import setup, find_packages import sys diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a314ca7e..71eeff49 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -7,7 +7,7 @@ from distutils.core import Command as _Command from distutils.util import convert_path import os.path -__version__ = '0.6c11' +__version__ = '0.6c12' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' diff --git a/version.dat b/version.dat index d312dddc..86f46575 100755 --- a/version.dat +++ b/version.dat @@ -1,6 +1,6 @@ [setuptools] status = 'release candidate' major = 0 -build = 11 +build = 12 minor = 6 -- cgit v1.2.3 From 03cee8b587cf41af1a4ad1071cb6aa7b97c4f182 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 28 Oct 2009 17:12:57 +0000 Subject: Fix for issue 88 --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4075926 --- EasyInstall.txt | 4 ++++ setuptools/package_index.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index 2bf69e90..6dad8c41 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1217,6 +1217,10 @@ displayed MD5 info (broken onto two lines for readability):: Release Notes/Change History ============================ +0.6final + * Fixed AttributeError under Python 2.3 when processing "HTTP authentication" + URLs (i.e., ones with a ``user:password@host``). + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 70b75a6f..1a4fabde 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -1,6 +1,6 @@ """PyPI and direct package downloading""" import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO -import httplib +import httplib, urllib from pkg_resources import * from distutils import log from distutils.errors import DistutilsError @@ -701,7 +701,7 @@ def open_with_auth(url): scheme, netloc, path, params, query, frag = urlparse.urlparse(url) if scheme in ('http', 'https'): - auth, host = urllib2.splituser(netloc) + auth, host = urllib.splituser(netloc) else: auth = None -- cgit v1.2.3 From 4478cdc28c1550f64b7918e3d88af08d0c28a0cb Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Thu, 5 Nov 2009 16:00:25 +0000 Subject: Backport to 0.6 --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4076123 --- EasyInstall.txt | 3 +++ setuptools/package_index.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index 6dad8c41..df11309a 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1221,6 +1221,9 @@ Release Notes/Change History * Fixed AttributeError under Python 2.3 when processing "HTTP authentication" URLs (i.e., ones with a ``user:password@host``). + * Fixed bogus AttributeError when no local or downloadable packages are + available + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 1a4fabde..78b07f4b 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -471,8 +471,9 @@ class PackageIndex(Environment): (source and "a source distribution of " or ""), requirement, ) - self.info("Best match: %s", dist) - return dist.clone(location=self.download(dist.location, tmpdir)) + else: + self.info("Best match: %s", dist) + return dist.clone(location=self.download(dist.location, tmpdir)) def fetch(self, requirement, tmpdir, force_scan=False, source=False): @@ -489,7 +490,6 @@ class PackageIndex(Environment): return None - def gen_setup(self, filename, fragment, tmpdir): match = EGG_FRAGMENT.match(fragment) dists = match and [d for d in -- cgit v1.2.3 From 16dc2a11fb1b33955ad55ab00f186fcc909e35f6 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 1 Feb 2010 16:42:04 +0000 Subject: Backport SF download fix --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4077904 --- EasyInstall.txt | 2 ++ setuptools/package_index.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index df11309a..45bdf0c8 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1224,6 +1224,8 @@ Release Notes/Change History * Fixed bogus AttributeError when no local or downloadable packages are available + * Fix for recent Sourceforge downloading changes + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 78b07f4b..32498d0f 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -590,9 +590,8 @@ class PackageIndex(Environment): def _download_url(self, scheme, url, tmpdir): # Determine download filename # - name = filter(None,urlparse.urlparse(url)[2].split('/')) + name, fragment = egg_info_for_url(url) if name: - name = name[-1] while '..' in name: name = name.replace('..','.').replace('\\','_') else: @@ -613,6 +612,7 @@ class PackageIndex(Environment): self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) + def scan_url(self, url): self.process_url(url, True) -- cgit v1.2.3 From 9e86a83d9b16147dfda3ae2d74c2ed82c1c893a7 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Thu, 29 Apr 2010 16:09:17 +0000 Subject: Fix a problem with sandbox swapping 'open' and 'file' builtins. Support sandbox access to os.devnull. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4080622 --- setuptools/sandbox.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 00eb0124..4c5e7129 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -105,8 +105,8 @@ class AbstractSandbox: return func() finally: self._active = False - __builtin__.open = _file - __builtin__.file = _open + __builtin__.open = _open + __builtin__.file = _file self._copy(_os) def _mk_dual_path_wrapper(name): @@ -203,10 +203,10 @@ class DirectorySandbox(AbstractSandbox): self._violation("open", path, mode, *args, **kw) return _open(path,mode,*args,**kw) - def tmpnam(self): - self._violation("tmpnam") + def tmpnam(self): self._violation("tmpnam") def _ok(self,path): + if hasattr(_os,'devnull') and path==_os.devnull: return True active = self._active try: self._active = False -- cgit v1.2.3 From 97128303bf077da33cc5b30ce71d853fb730b589 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sun, 22 Aug 2010 23:09:12 +0000 Subject: Fix quotes handling for GUI scripts on Windows when Python is in a directory with a space in the name. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4084273 --- setuptools/command/easy_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index af4e3497..014fc70d 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1583,7 +1583,7 @@ def get_script_args(dist, executable=sys_executable, wininst=False): old = ['.py','.pyc','.pyo'] new_header = re.sub('(?i)pythonw.exe','python.exe',header) - if os.path.exists(new_header[2:-1]) or sys.platform!='win32': + if os.path.exists(new_header[2:-1].strip('"')) or sys.platform!='win32': hdr = new_header else: hdr = header -- cgit v1.2.3 From 7cfca7995a9e5de15663ea4f6e754aa001e6ea98 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sat, 2 Oct 2010 19:16:45 +0000 Subject: Tarfile link support, and handle .pyd/.dll files installed as data on win32. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4085190 --- EasyInstall.txt | 5 +++++ setuptools/archive_util.py | 18 +++++++++--------- setuptools/command/easy_install.py | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index 45bdf0c8..96ccc55f 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1226,6 +1226,11 @@ Release Notes/Change History * Fix for recent Sourceforge downloading changes + * Handle .exe's containing .pyd or .dll files installed as "data" on win32 + + * Extract copies of hardlinked and symlinked files in tarballs when extracting + source + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index 5d72e7ed..be813746 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -180,11 +180,15 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): try: tarobj.chown = lambda *args: None # don't do any chowning! for member in tarobj: - if member.isfile() or member.isdir(): - name = member.name - # don't extract absolute paths or ones with .. in them - if not name.startswith('/') and '..' not in name: - dst = os.path.join(extract_dir, *name.split('/')) + name = member.name + # don't extract absolute paths or ones with .. in them + if not name.startswith('/') and '..' not in name: + dst = os.path.join(extract_dir, *name.split('/')) + + while member.islnk() or member.issym(): + member = tarobj._getmember(member.linkname, member) + + if member.isfile() or member.isdir(): dst = progress_filter(name, dst) if dst: if dst.endswith(os.sep): @@ -198,8 +202,4 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): tarobj.close() - - extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile - - diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 014fc70d..90f29320 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1274,7 +1274,7 @@ def get_exe_prefixes(exe_filename): prefixes = [ ('PURELIB/', ''), ('PLATLIB/pywin32_system32', ''), - ('PLATLIB/', ''), + ('PLATLIB/', ''), ('DATA/lib/site-packages/', ''), ('SCRIPTS/', 'EGG-INFO/scripts/') ] z = zipfile.ZipFile(exe_filename) -- cgit v1.2.3 From e6990dd3de14acea85f2285dddc5956318f139ee Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sat, 9 Oct 2010 03:24:25 +0000 Subject: Backport from trunk --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4085332 --- setuptools/archive_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index be813746..15d38de5 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -185,10 +185,10 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): if not name.startswith('/') and '..' not in name: dst = os.path.join(extract_dir, *name.split('/')) - while member.islnk() or member.issym(): + while member is not None and member.islnk() or member.issym(): member = tarobj._getmember(member.linkname, member) - if member.isfile() or member.isdir(): + if member is not None and member.isfile() or member.isdir(): dst = progress_filter(name, dst) if dst: if dst.endswith(os.sep): -- cgit v1.2.3 From f86fa331e8d2165d9aba0bc6d44af1db987d5239 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sat, 9 Oct 2010 03:33:27 +0000 Subject: Backport. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4085334 --- setuptools/archive_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index 15d38de5..eae3729a 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -185,10 +185,10 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): if not name.startswith('/') and '..' not in name: dst = os.path.join(extract_dir, *name.split('/')) - while member is not None and member.islnk() or member.issym(): + while member is not None and (member.islnk() or member.issym()): member = tarobj._getmember(member.linkname, member) - if member is not None and member.isfile() or member.isdir(): + if member is not None and (member.isfile() or member.isdir()): dst = progress_filter(name, dst) if dst: if dst.endswith(os.sep): -- cgit v1.2.3 From ca8f80843db50fd079df0b62180d85c83cd937cc Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Tue, 12 Oct 2010 15:44:18 +0000 Subject: Backport --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4085381 --- setuptools/archive_util.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index eae3729a..d26b383b 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -6,7 +6,7 @@ __all__ = [ "UnrecognizedFormat", "extraction_drivers", "unpack_directory", ] -import zipfile, tarfile, os, shutil +import zipfile, tarfile, os, shutil, posixpath from pkg_resources import ensure_directory from distutils.errors import DistutilsError @@ -169,14 +169,12 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): by ``tarfile.open()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. """ - try: tarobj = tarfile.open(filename) except tarfile.TarError: raise UnrecognizedFormat( "%s is not a compressed or uncompressed tar file" % (filename,) ) - try: tarobj.chown = lambda *args: None # don't do any chowning! for member in tarobj: @@ -184,9 +182,12 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): # don't extract absolute paths or ones with .. in them if not name.startswith('/') and '..' not in name: dst = os.path.join(extract_dir, *name.split('/')) - while member is not None and (member.islnk() or member.issym()): - member = tarobj._getmember(member.linkname, member) + linkpath = member.linkname + if member.issym(): + linkpath = posixpath.join(posixpath.dirname(member.name), linkpath) + linkpath = posixpath.normpath(linkpath) + member = tarobj._getmember(linkpath) if member is not None and (member.isfile() or member.isdir()): dst = progress_filter(name, dst) @@ -201,5 +202,4 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): finally: tarobj.close() - extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile -- cgit v1.2.3 From 2e97ab0fbc5862025968cf6d10b6011f2a585cf1 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Thu, 20 Jan 2011 18:50:00 +0000 Subject: Fix path problems when pkg_resources is installed, but not setuptools. (Also, remove some obsolete MD5s.) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4088124 --- ez_setup.py | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/ez_setup.py b/ez_setup.py index 997c453d..d8d25db1 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -18,16 +18,6 @@ DEFAULT_VERSION = "0.6c12" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { - 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', - 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', - 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', - 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', - 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', - 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', - 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', - 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', - 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', - 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', @@ -36,23 +26,6 @@ md5_data = { 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b', 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2', 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086', - 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', - 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', - 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', - 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', - 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', - 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', - 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', - 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', - 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', - 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', - 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', - 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', - 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', - 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', - 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', - 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', - 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', @@ -112,11 +85,11 @@ def use_setuptools( "\n\n(Currently using %r)" ) % (version, e.args[0]) sys.exit(2) - else: - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return do_download() except pkg_resources.DistributionNotFound: - return do_download() + pass + + del pkg_resources, sys.modules['pkg_resources'] # reload ok + return do_download() def download_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, -- cgit v1.2.3 From 9f3c9810de9de1358d4f62ebd74bdf2c866c7d73 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 23 Mar 2011 20:38:12 +0000 Subject: Backport. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4088793 --- EasyInstall.txt | 4 ++++ setuptools/package_index.py | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index 96ccc55f..91b6cc17 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1231,6 +1231,10 @@ Release Notes/Change History * Extract copies of hardlinked and symlinked files in tarballs when extracting source + * Support HTTP servers that return multiple 'Content-Length' headers + + * Support user/password credentials in Subversion (svnserve) URLs + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 32498d0f..9a9c5d62 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -550,7 +550,7 @@ class PackageIndex(Environment): bs = self.dl_blocksize size = -1 if "content-length" in headers: - size = int(headers["Content-Length"]) + size = max(map(int,headers.getheaders("Content-Length"))) self.reporthook(url, filename, blocknum, bs, size) tfp = open(filename,'wb') while True: @@ -639,10 +639,39 @@ class PackageIndex(Environment): os.unlink(filename) raise DistutilsError("Unexpected HTML page found at "+url) + + + + + + + + + + + + + + + def _download_svn(self, url, filename): url = url.split('#',1)[0] # remove any fragment for svn's sake + creds = '' + if url.lower().startswith('svn:') and '@' in url: + scheme, netloc, path, p, q, f = urlparse.urlparse(url) + if not netloc and path.startswith('//') and '/' in path[2:]: + netloc, path = path[2:].split('/',1) + auth, host = urllib.splituser(netloc) + if auth: + if ':' in auth: + user, pw = auth.split(':',1) + creds = " --username=%s --password=%s" % (user, pw) + else: + creds = " --username="+auth + netloc = host + url = urlparse.urlunparse((scheme, netloc, url, p, q, f)) self.info("Doing subversion checkout from %s to %s", url, filename) - os.system("svn checkout -q %s %s" % (url, filename)) + os.system("svn checkout%s -q %s %s" % (creds, url, filename)) return filename def debug(self, msg, *args): @@ -654,6 +683,18 @@ class PackageIndex(Environment): def warn(self, msg, *args): log.warn(msg, *args) + + + + + + + + + + + + # This pattern matches a character entity reference (a decimal numeric # references, a hexadecimal numeric reference, or a named reference). entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub -- cgit v1.2.3 From 8d7af6e22f1275ac58b3eccfd43db6e83dfc6e33 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 23 Mar 2011 21:09:16 +0000 Subject: Fixed skipping extraction of files or directories containing '..' in their names. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4088795 --- EasyInstall.txt | 6 ++++++ setuptools/archive_util.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EasyInstall.txt b/EasyInstall.txt index 91b6cc17..753baf65 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1235,6 +1235,12 @@ Release Notes/Change History * Support user/password credentials in Subversion (svnserve) URLs + * Fixed problems accessing /dev/null inside the script sandbox, and the sandbox + swapping the ``open`` and file`` builtins. + + * Fixed skipping extraction of files or directories containing '..' in their + names + 0.6c11 * Fix installed script .exe files not working with 64-bit Python on Windows (wasn't actually released in 0.6c10 due to a lost checkin) diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index d26b383b..d44264f8 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -138,7 +138,7 @@ def unpack_zipfile(filename, extract_dir, progress_filter=default_filter): name = info.filename # don't extract absolute paths or ones with .. in them - if name.startswith('/') or '..' in name: + if name.startswith('/') or '..' in name.split('/'): continue target = os.path.join(extract_dir, *name.split('/')) @@ -180,7 +180,7 @@ def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): for member in tarobj: name = member.name # don't extract absolute paths or ones with .. in them - if not name.startswith('/') and '..' not in name: + if not name.startswith('/') and '..' not in name.split('/'): dst = os.path.join(extract_dir, *name.split('/')) while member is not None and (member.islnk() or member.issym()): linkpath = member.linkname -- cgit v1.2.3 From a6e8eec3e46dfa7e37259c63da244049ce08f603 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Tue, 31 May 2011 20:10:56 +0000 Subject: Document 64-bit Windows workaround --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4088846 --- README.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 03a2afcd..22d76da2 100755 --- a/README.txt +++ b/README.txt @@ -12,7 +12,17 @@ Installation Instructions Windows ======= -Install setuptools using the provided ``.exe`` installer. If you've previously +32-bit version of Python + Install setuptools using the provided ``.exe`` installer. + +64-bit versions of Python + Download `ez_setup.py`_ and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided ``.exe`` installer does not support 64-bit versions of Python for Windows, due to a `distutils installer compatibility issue`_ + +.. _ez_setup.py: http://peak.telecommunity.com/dist/ez_setup.py +.. _distutils installer compatibility issue: http://bugs.python.org/issue6792 + + +NOTE: Regardless of what sort of Python you're using, if you've previously installed older versions of setuptools, please delete all ``setuptools*.egg`` and ``setuptools.pth`` files from your system's ``site-packages`` directory (and any other ``sys.path`` directories) FIRST. -- cgit v1.2.3