def _run(dispatcher, args, **kw): parser = dispatcher.parser args = args[1:] 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 # create the Distribution class # need to feed setup.cfg here ! dist = Distribution() # Find and parse the config file(s): they will override options from # the setup script, but be overridden by the command line. # XXX still need to be extracted from Distribution dist.parse_config_files() 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
def _run_packaging_install(path): # XXX check for a valid setup.cfg? dist = Distribution() dist.parse_config_files() try: dist.run_command('install_dist') 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))