summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xEasyInstall.txt1
-rwxr-xr-xsetuptools/command/easy_install.py53
2 files changed, 48 insertions, 6 deletions
diff --git a/EasyInstall.txt b/EasyInstall.txt
index cb9e2bc9..3e5eadec 100755
--- a/EasyInstall.txt
+++ b/EasyInstall.txt
@@ -1009,6 +1009,7 @@ Known Issues
package search was already going to go online due to a package not being
available locally, or due to the use of the ``--update`` or ``-U`` option.
+ * Fixed the annoying ``--help-commands`` wart.
0.6a9
* Fixed ``.pth`` file processing picking up nested eggs (i.e. ones inside
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
+ )
+ )
+
+
+
+
+
+