Commit 8b28bf85 authored by PJ Eby's avatar PJ Eby

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
parent ee68f241
...@@ -1009,6 +1009,7 @@ Known Issues ...@@ -1009,6 +1009,7 @@ Known Issues
package search was already going to go online due to a package not being 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. available locally, or due to the use of the ``--update`` or ``-U`` option.
* Fixed the annoying ``--help-commands`` wart.
0.6a9 0.6a9
* Fixed ``.pth`` file processing picking up nested eggs (i.e. ones inside * Fixed ``.pth`` file processing picking up nested eggs (i.e. ones inside
......
...@@ -1254,12 +1254,6 @@ def get_script_header(script_text, executable=sys_executable): ...@@ -1254,12 +1254,6 @@ def get_script_header(script_text, executable=sys_executable):
options = ' '+options options = ' '+options
return "#!%(executable)s%(options)s\n" % locals() 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): def auto_chmod(func, arg, exc):
if func is os.remove and os.name=='nt': if func is os.remove and os.name=='nt':
...@@ -1269,6 +1263,12 @@ def auto_chmod(func, arg, exc): ...@@ -1269,6 +1263,12 @@ def auto_chmod(func, arg, exc):
raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg)))
def get_script_args(dist, executable=sys_executable): def get_script_args(dist, executable=sys_executable):
"""Yield write_script() argument tuples for a distribution's entrypoints""" """Yield write_script() argument tuples for a distribution's entrypoints"""
spec = str(dist.as_requirement()) spec = str(dist.as_requirement())
...@@ -1351,3 +1351,44 @@ def rmtree(path, ignore_errors=False, onerror=auto_chmod): ...@@ -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
)
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment