Anonymous committed 87688b4

Unified the bootstrap file so it works on both py2.x and py3k without 2to3 (patch by Holger Krekel)

  • Participants
  • Parent commits ef3923a
  • Branches 0.6-maintenance

Comments (0)

Files changed (3)

     $ curl -O
     $ python
-Notice that both files are provided in the source release.
+Notice this file is also provided in the source release.
 easy_install or pip

-        except pkg_resources.VersionConflict, e:
+        except pkg_resources.VersionConflict:
+            e = sys.exc_info()[1]
             if was_imported:
-                print >>sys.stderr, (
+                sys.stderr.write(
                 "The required version of distribute (>=%s) is not available,\n"
                 "and can't be installed while this script is running. Please\n"
                 "install a more recent version first, using\n"
                 "'easy_install -U distribute'."
-                "\n\n(Currently using %r)") % (version, e.args[0])
+                "\n\n(Currently using %r)\n" % (version, e.args[0]))
                 del pkg_resources, sys.modules['pkg_resources']    # reload ok
     # making sure we use the absolute path
     to_dir = os.path.abspath(to_dir)
-    import urllib2
+    try:
+        from urllib.request import urlopen
+    except ImportError:
+        from urllib2 import urlopen
     tgz_name = "distribute-%s.tar.gz" % version
     url = download_base + tgz_name
     saveto = os.path.join(to_dir, tgz_name)
     if not os.path.exists(saveto):  # Avoid repeated downloads
             log.warn("Downloading %s", url)
-            src = urllib2.urlopen(url)
+            src = urlopen(url)
             # Read/write all in one block, so we don't create a corrupt file
             # if the download is interrupted.
             data =
             # Extract directories with a safe mode.
             tarinfo = copy.copy(tarinfo)
-            tarinfo.mode = 0700
+            tarinfo.mode = 448 # decimal for oct 0700
         self.extract(tarinfo, path)
     # Reverse sort directories.
             self.chown(tarinfo, dirpath)
             self.utime(tarinfo, dirpath)
             self.chmod(tarinfo, dirpath)
-        except ExtractError, e:
+        except ExtractError:
+            e = sys.exc_info()[1]
             if self.errorlevel > 1:
 hg tag $VERSION
 hg ci -m "bumped revision"
-# creating the 3k script
-mkdir ./temp
-cp ./temp/
-cd ./temp
-2to3 -w > /dev/null
-mv ../
-cd ..
-rm -rf ./temp
 # creating the releases
 rm -rf ./dist
 python2.6 -q egg_info -RDb '' sdist register upload
 python2.6 build_sphinx upload_docs
-# pushing the bootstrap scripts
+# pushing the bootstrap script
 # starting the new dev