Did I find the right examples for you? yes no

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)

        def main(argv=None, **kw):
    import sys
    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

    from merlin.dist import Distribution
    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:]

    def usage():
        print >> sys.stderr, "Usage: merlin [merlin-options]  [command-options-and-arguments]"
        sys.exit(1)

    def help():
        # NYI
        usage()

    def install():
        with_ei_usage(lambda:
            setup(
                script_args = ['-q','easy_install', '-v']+argv,
                script_name = sys.argv[0] or 'easy_install',
                distclass=DistributionWithoutHelpCommands, **kw
            )
        )
    
    if not argv:
        usage()

    command = argv.pop(0)
    if command == 'help':
        help()
    elif command == 'install':
        install()
    else:
        usage()
    
    return
        


src/m/e/merlin-1-1.0/merlin/archimedes/__init__.py   merlin(Download)
            egg = download_merlin(delay=0)
            sys.path.insert(0,egg)
            from merlin import main
            return main(['install'] + list(argv) + [egg])   # we're done here
        finally:
        merlin.require(reqSpec)
    except merlin.VersionConflict:
        from merlin import main
        main(list(argv)+[download_merlin(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from merlin import main