aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2011-11-29 09:55:28 -0500
committerJason R. Coombs <jaraco@jaraco.com>2011-11-29 09:55:28 -0500
commit70177237f6549f0647b490b2dc6a06ff14f0b321 (patch)
treec9b4cd0cf6ec0af3ed4624fe07ebf2e1f98fa370
parent7ee58aa10f38d16c8e2525509b4cb24a11f8f6b3 (diff)
downloadexternal_python_setuptools-70177237f6549f0647b490b2dc6a06ff14f0b321.tar.gz
external_python_setuptools-70177237f6549f0647b490b2dc6a06ff14f0b321.tar.bz2
external_python_setuptools-70177237f6549f0647b490b2dc6a06ff14f0b321.zip
distribute_setup.py now accepts the --user argument for installing to the user-local environment on Python 2.6 and later. Fixes #260.
--HG-- branch : distribute extra : rebase_source : 7435c8b7f4d8eb6308cf7d5d9578f79c91f6b18b
-rw-r--r--CHANGES.txt2
-rw-r--r--distribute_setup.py15
2 files changed, 14 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index a44b0481..b857227d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,8 @@ CHANGES
------
* Issue #258: Workaround a cache issue
+* Issue #260: distribute_setup.py now accepts the --user parameter for
+ Python 2.6 and later.
------
0.6.24
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__':