aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-02-10 22:23:48 +0000
committerPJ Eby <distutils-sig@python.org>2006-02-10 22:23:48 +0000
commit8b28bf851c354c849fa0ea861d9a4661f14202a1 (patch)
treed4e52e8f48d1030b2bf815d86e30a1dedb5e7e7b /setuptools/command/easy_install.py
parentee68f241feb1442ac6f1288cb945258b7ed0e70a (diff)
downloadexternal_python_setuptools-8b28bf851c354c849fa0ea861d9a4661f14202a1.tar.gz
external_python_setuptools-8b28bf851c354c849fa0ea861d9a4661f14202a1.tar.bz2
external_python_setuptools-8b28bf851c354c849fa0ea861d9a4661f14202a1.zip
Fixed the annoying ``--help-commands`` wart, albeit in a most
unfortunately kludgy fashion. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4042312
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py53
1 files changed, 47 insertions, 6 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 89940965..45b204a5 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1254,12 +1254,6 @@ def get_script_header(script_text, executable=sys_executable):
options = ' '+options
return "#!%(executable)s%(options)s\n" % locals()
-def main(argv=None, **kw):
- from setuptools import setup
- if argv is None:
- argv = sys.argv[1:]
- setup(script_args = ['-q','easy_install', '-v']+argv, **kw)
-
def auto_chmod(func, arg, exc):
if func is os.remove and os.name=='nt':
@@ -1269,6 +1263,12 @@ def auto_chmod(func, arg, exc):
raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg)))
+
+
+
+
+
+
def get_script_args(dist, executable=sys_executable):
"""Yield write_script() argument tuples for a distribution's entrypoints"""
spec = str(dist.as_requirement())
@@ -1351,3 +1351,44 @@ def rmtree(path, ignore_errors=False, onerror=auto_chmod):
+def main(argv=None, **kw):
+ from setuptools import setup
+ from setuptools.dist import Distribution
+ import distutils.core
+
+ USAGE = """\
+usage: %(script)s [options] requirement_or_url ...
+ or: %(script)s --help
+"""
+
+ def gen_usage (script_name):
+ script = os.path.basename(script_name)
+ return USAGE % vars()
+
+ def with_ei_usage(f):
+ old_gen_usage = distutils.core.gen_usage
+ try:
+ distutils.core.gen_usage = gen_usage
+ return f()
+ finally:
+ distutils.core.gen_usage = old_gen_usage
+
+ class DistributionWithoutHelpCommands(Distribution):
+ def _show_help(self,*args,**kw):
+ with_ei_usage(lambda: Distribution._show_help(self,*args,**kw))
+
+ if argv is None:
+ argv = sys.argv[1:]
+
+ with_ei_usage(lambda:
+ setup(
+ script_args = ['-q','easy_install', '-v']+argv,
+ distclass=DistributionWithoutHelpCommands, **kw
+ )
+ )
+
+
+
+
+
+