[Python-checkins] r51778 - sandbox/branches/setuptools-0.6/EasyInstall.txt sandbox/branches/setuptools-0.6/ez_setup.py sandbox/branches/setuptools-0.6/setuptools.txt

phillip.eby python-checkins at python.org
Wed Sep 6 20:14:35 CEST 2006


Author: phillip.eby
Date: Wed Sep  6 20:14:34 2006
New Revision: 51778

Modified:
   sandbox/branches/setuptools-0.6/EasyInstall.txt
   sandbox/branches/setuptools-0.6/ez_setup.py
   sandbox/branches/setuptools-0.6/setuptools.txt
Log:
Support setuptools .egg being in current directory when bootstrapping on
an offline machine.  Output what version/location is conflicting when a
newer version of setuptools is requested.


Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/EasyInstall.txt	(original)
+++ sandbox/branches/setuptools-0.6/EasyInstall.txt	Wed Sep  6 20:14:34 2006
@@ -1194,6 +1194,9 @@
  * Windows script wrappers now support quoted arguments and arguments
    containing spaces.  (Patch contributed by Jim Fulton.)
 
+ * The ``ez_setup.py`` script now actually works when you put a setuptools
+   ``.egg`` alongside it for bootstrapping an offline machine.
+
 0.6c1
  * EasyInstall now includes setuptools version information in the
    ``User-Agent`` string sent to websites it visits.

Modified: sandbox/branches/setuptools-0.6/ez_setup.py
==============================================================================
--- sandbox/branches/setuptools-0.6/ez_setup.py	(original)
+++ sandbox/branches/setuptools-0.6/ez_setup.py	Wed Sep  6 20:14:34 2006
@@ -77,13 +77,13 @@
     try:
         pkg_resources.require("setuptools>="+version)
 
-    except pkg_resources.VersionConflict:
+    except pkg_resources.VersionConflict, e:
         # XXX could we install in a subprocess here?
         print >>sys.stderr, (
             "The required version of setuptools (>=%s) is not available, and\n"
             "can't be installed while this script is running. Please install\n"
-            " a more recent version first."
-        ) % version
+            " a more recent version first.\n\n(Currently using %r)"
+        ) % (version, e.args[0])
         sys.exit(2)
 
 def download_setuptools(
@@ -139,15 +139,15 @@
     try:
         import setuptools
     except ImportError:
-        import tempfile, shutil
-        tmpdir = tempfile.mkdtemp(prefix="easy_install-")
+        egg = None
         try:
-            egg = download_setuptools(version, to_dir=tmpdir, delay=0)
+            egg = download_setuptools(version, delay=0)
             sys.path.insert(0,egg)
             from setuptools.command.easy_install import main
             return main(list(argv)+[egg])   # we're done here
         finally:
-            shutil.rmtree(tmpdir)
+            if egg and os.path.exists(egg):
+                os.unlink(egg)
     else:
         if setuptools.__version__ == '0.0.1':
             # tell the user to uninstall obsolete version

Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt	(original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt	Wed Sep  6 20:14:34 2006
@@ -2563,6 +2563,11 @@
 Release Notes/Change History
 ----------------------------
 
+0.6c2
+ * The ``ez_setup`` module displays the conflicting version of setuptools (and
+   its installation location) when a script requests a version that's not
+   available.
+
 0.6c1
  * Fixed ``AttributeError`` when trying to download a ``setup_requires``
    dependency when a distribution lacks a ``dependency_links`` setting.


More information about the Python-checkins mailing list