aboutsummaryrefslogtreecommitdiffstats
path: root/distribute_setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'distribute_setup.py')
-rw-r--r--distribute_setup.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/distribute_setup.py b/distribute_setup.py
index f0bfa25a..d2c2899a 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -63,7 +63,7 @@ Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
-def _install(tarball):
+def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
@@ -81,7 +81,7 @@ def _install(tarball):
# installing
log.warn('Installing Distribute')
- if not _python_cmd('setup.py', 'install'):
+ if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
finally:
@@ -474,11 +474,20 @@ def _extractall(self, path=".", members=None):
else:
self._dbg(1, "tarfile: %s" % e)
+def _build_install_args(argv):
+ install_args = []
+ user_install = '--user' in argv
+ if user_install and sys.version_info < (2,6):
+ log.warn("--user requires Python 2.6 or later")
+ raise SystemExit(1)
+ if user_install:
+ install_args.append('--user')
+ return install_args
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
tarball = download_setuptools()
- _install(tarball)
+ _install(tarball, _build_install_args(argv))
if __name__ == '__main__':