aboutsummaryrefslogtreecommitdiffstats
path: root/distribute_setup.py
diff options
context:
space:
mode:
authortarek <none@none>2009-09-25 23:34:18 +0200
committertarek <none@none>2009-09-25 23:34:18 +0200
commit5c6e640a15aacaaa551f2e2ce0b8b94ebb42ef2a (patch)
treeec9e1a2af0d4b24d0656cb4e2c88be5edbe9ebc4 /distribute_setup.py
parentefa78ba0a0e1f89b92da4fa0fa6e5e029efecf3f (diff)
downloadexternal_python_setuptools-5c6e640a15aacaaa551f2e2ce0b8b94ebb42ef2a.tar.gz
external_python_setuptools-5c6e640a15aacaaa551f2e2ce0b8b94ebb42ef2a.tar.bz2
external_python_setuptools-5c6e640a15aacaaa551f2e2ce0b8b94ebb42ef2a.zip
make the bootstrap file py2.3+win32 compatible
--HG-- branch : distribute extra : rebase_source : d75b734c889c3d23ad4df95066745d0d76588813
Diffstat (limited to 'distribute_setup.py')
-rw-r--r--distribute_setup.py41
1 files changed, 28 insertions, 13 deletions
diff --git a/distribute_setup.py b/distribute_setup.py
index 3ed5bfb8..4fe04875 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -13,20 +13,38 @@ the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
-try:
- from site import USER_SITE
-except ImportError:
- USER_SITE = None
-
-import sys
import os
+import sys
import time
import fnmatch
import tempfile
import tarfile
-import subprocess
from distutils import log
+try:
+ from site import USER_SITE
+except ImportError:
+ USER_SITE = None
+
+try:
+ import subprocess
+
+ def python_cmd(*args):
+ args = (sys.executable,) + args
+ return subprocess.call(args) == 0
+
+except ImportError:
+ # will be used for python 2.3
+ def python_cmd(*args):
+ args = (sys.executable,) + args
+ # quoting arguments if windows
+ if sys.platform == 'win32':
+ def quote(arg):
+ if ' ' in arg:
+ return '"%s"' % arg
+ return arg
+ args = [quote(arg) for arg in args]
+ return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.2"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
@@ -43,11 +61,6 @@ Description: xxx
"""
-def python_cmd(*args):
- args = (sys.executable,) + args
- return subprocess.call(args) == 0
-
-
def _install(tarball):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
@@ -386,7 +399,9 @@ def extractall(self, path=".", members=None):
self.extract(tarinfo, path)
# Reverse sort directories.
- directories.sort(key=operator.attrgetter('name'))
+ def sorter(dir1, dir2):
+ return cmp(dir1.name, dir2.name)
+ directories.sort(sorter)
directories.reverse()
# Set correct owner, mtime and filemode on directories.