[Python-checkins] r42312 - in sandbox/trunk/setuptools: EasyInstall.txt setuptools/command/easy_install.py
phillip.eby
python-checkins at python.org
Fri Feb 10 23:23:48 CET 2006
Author: phillip.eby
Date: Fri Feb 10 23:23:48 2006
New Revision: 42312
Modified:
sandbox/trunk/setuptools/EasyInstall.txt
sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Fixed the annoying ``--help-commands`` wart, albeit in a most
unfortunately kludgy fashion.
Modified: sandbox/trunk/setuptools/EasyInstall.txt
==============================================================================
--- sandbox/trunk/setuptools/EasyInstall.txt (original)
+++ sandbox/trunk/setuptools/EasyInstall.txt Fri Feb 10 23:23:48 2006
@@ -1009,6 +1009,7 @@
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
Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py Fri Feb 10 23:23:48 2006
@@ -1254,12 +1254,6 @@
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 @@
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 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
+ )
+ )
+
+
+
+
+
+
More information about the Python-checkins
mailing list