[Distutils] patch: ez_setup.py: separate default version and minimum version of setuptools

zooko zooko at zooko.com
Sat Sep 15 08:33:12 CEST 2007


Folks:

Thank you for setuptools!  We are using it in the Allmydata-Tahoe  
project [1].  We've patched ez_setup.py so that installation can  
proceed if an older version of setuptools is already present, as long  
as that version is not too old.  This allows ez_setup.py to work  
seamlessly in more situations.  Please apply.

The patch is in-lined and attached.

Regards,

Zooko

[1] http://allmydata.org

Thu Sep 13 20:20:02 PDT 2007  zooko at zooko.com
   * change the 'ez_setup.py' script to have distinct desired &  
minimum required versions of setuptools

   Note that this preserves backwards compatibility -- if no minimum  
version is
   specified then the default version is used as the minimum version,  
which is
   identical to the behavior before this patch.

   This patch is originally due to Rob Kinninmont.

diff -rN -u old-setuptools/setuptools-0.6c7/ez_setup.py new- 
setuptools/setuptools-0.6c7/ez_setup.py
--- old-setuptools/setuptools-0.6c7/ez_setup.py 2007-09-13  
20:20:58.000000000 -0700
+++ new-setuptools/setuptools-0.6c7/ez_setup.py 2007-09-13  
20:20:58.000000000 -0700
@@ -61,7 +61,7 @@
def use_setuptools(
      version=DEFAULT_VERSION, download_base=DEFAULT_URL,  
to_dir=os.curdir,
-    download_delay=15
+    download_delay=15, min_version=None
):
      """Automatically find/download setuptools and make it available  
on sys.path
@@ -89,7 +89,9 @@
      import pkg_resources
      try:
-        pkg_resources.require("setuptools>="+version)
+        if not min_version:
+            min_version = version
+        pkg_resources.require("setuptools>="+min_version)
      except pkg_resources.VersionConflict, e:
          # XXX could we install in a subprocess here?
@@ -97,7 +99,7 @@
              "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.\n\n(Currently using %r)"
-        ) % (version, e.args[0])
+        ) % (min_version, e.args[0])
          sys.exit(2)
def download_setuptools(

-------------- next part --------------
A non-text attachment was scrubbed...
Name: x
Type: application/octet-stream
Size: 2138 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20070914/40eca90a/attachment.obj 


More information about the Distutils-SIG mailing list