aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-09-05 20:58:15 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-09-05 20:58:15 -0400
commit7796c53510033888e2602454d52ab20df4919ee2 (patch)
tree52b079573dee6e1af8afbdaafb48b9afab67197b
parent9fbb4e4ac9f4ba7c9e4de2168844bf3e6c64416e (diff)
parent9c822a826b6d0ed1ecd746c6b3f8039054d2c84b (diff)
downloadexternal_python_setuptools-7796c53510033888e2602454d52ab20df4919ee2.tar.gz
external_python_setuptools-7796c53510033888e2602454d52ab20df4919ee2.tar.bz2
external_python_setuptools-7796c53510033888e2602454d52ab20df4919ee2.zip
Merged in pmcnr/distribute (pull request #18)
--HG-- branch : distribute extra : rebase_source : dd2fb9493da6996182784bd56c507b1bd4b14789
-rw-r--r--distribute_setup.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/distribute_setup.py b/distribute_setup.py
index f3199d12..eca355ce 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -19,6 +19,7 @@ import time
import fnmatch
import tempfile
import tarfile
+import optparse
from distutils import log
try:
@@ -495,22 +496,31 @@ def _extractall(self, path=".", members=None):
self._dbg(1, "tarfile: %s" % e)
-def _build_install_args(argv):
+def _build_install_args(user_install):
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')
+ if sys.version_info < (2, 6):
+ log.warn("--user requires Python 2.6 or later")
+ raise SystemExit(1)
+ else:
+ install_args.append('--user')
return install_args
-def main(argv, version=DEFAULT_VERSION):
+def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
- tarball = download_setuptools()
- _install(tarball, _build_install_args(argv))
+ parser = optparse.OptionParser()
+ parser.add_option(
+ '--user', dest='user_install', action='store_true', default=False,
+ help='install in user site package (requires Python 2.6 or later)')
+ parser.add_option(
+ '--download-base', dest='download_base', metavar="URL",
+ default=DEFAULT_URL,
+ help='alternative URL from where to download the distribute package')
+ options, args = parser.parse_args()
+ tarball = download_setuptools(download_base=options.download_base)
+ _install(tarball, _build_install_args(options.user_install))
if __name__ == '__main__':
- main(sys.argv[1:])
+ main()