示例#1
0
def _run(dispatcher, args, **kw):
    parser = dispatcher.parser
    args = args[1:]

    # Find and parse the config file(s): they will override options from
    # the setup script, but be overridden by the command line.
    # XXX call the functions from config and kill the Distribution class
    # (merging it into Dispatcher)
    dist = Distribution()
    dist.parse_config_files()

    commands = STANDARD_COMMANDS  # FIXME display extra commands

    if args == ['--list-commands']:
        print('List of available commands:')
        for cmd in commands:
            cls = dispatcher.cmdclass.get(cmd) or get_command_class(cmd)
            desc = getattr(cls, 'description', '(no description available)')
            print('  %s: %s' % (cmd, desc))
        return

    while args:
        args = dispatcher._parse_command_opts(parser, args)
        if args is None:
            return

    for cmd in dispatcher.commands:
        # FIXME need to catch MetadataMissingError here (from the check command
        # e.g.)--or catch any exception, print an error message and exit with 1
        dist.run_command(cmd, dispatcher.command_options[cmd])

    return 0
示例#2
0
文件: run.py 项目: dstufft/distutils2
def _run(dispatcher, args, **kw):
    parser = dispatcher.parser
    args = args[1:]

    # Find and parse the config file(s): they will override options from
    # the setup script, but be overridden by the command line.
    # XXX call the functions from config and kill the Distribution class
    # (merging it into Dispatcher)
    dist = Distribution()
    dist.parse_config_files()

    commands = STANDARD_COMMANDS  # FIXME display extra commands

    if args == ['--list-commands']:
        print 'List of available commands:'
        for cmd in commands:
            cls = dispatcher.cmdclass.get(cmd) or get_command_class(cmd)
            desc = getattr(cls, 'description', '(no description available)')
            print '  %s: %s' % (cmd, desc)
        return

    while args:
        args = dispatcher._parse_command_opts(parser, args)
        if args is None:
            return

    for cmd in dispatcher.commands:
        # FIXME need to catch MetadataMissingError here (from the check command
        # e.g.)--or catch any exception, print an error message and exit with 1
        dist.run_command(cmd, dispatcher.command_options[cmd])

    return 0
示例#3
0
def _run_packaging_install(path, dest):
    # XXX check for a valid setup.cfg?
    dist = Distribution()
    dist.parse_config_files()
    try:
        dist.run_command('install_dist', {'prefix': (None, dest)})
        name = dist.metadata['Name']
        return database.get_distribution(name) is not None
    except (IOError, os.error, PackagingError, CCompilerError) as msg:
        raise ValueError("Failed to install, " + str(msg))
示例#4
0
def _run_packaging_install(path, dest):
    # XXX check for a valid setup.cfg?
    dist = Distribution()
    dist.parse_config_files()
    try:
        dist.run_command('install_dist', {'prefix': (None, dest)})
        name = dist.metadata['Name']
        return database.get_distribution(name) is not None
    except (IOError, os.error, PackagingError, CCompilerError), msg:
        raise ValueError("Failed to install, " + str(msg))