Пример #1
0
def run_command(command, args):
    """Run paster command asynchronously"""
    mod, cls = command.rsplit('.', 1)
    mod = __import__(mod, fromlist=[str(cls)])
    command = getattr(mod, cls)
    command = command(command.__name__)
    arg_list = shlex.split(args or '')
    try:
        command.parser.parse_args(arg_list)
    except SystemExit:
        raise Exception("Error parsing args: '%s'" % args)
    return command.run(arg_list)
Пример #2
0
def paster(cmd):
    print "paster %s" % cmd
    from paste.script import command
    args = cmd.split()
    options, args = command.parser.parse_args(args)
    options.base_parser = command.parser
    command.system_plugins.extend(options.plugins or [])
    commands = command.get_commands()
    command_name = args[0]
    if command_name not in commands:
        command = command.NotFoundCommand
    else:
        command = commands[command_name].load()
    runner = command(command_name)
    runner.run(args[1:])
Пример #3
0
def paster(cmd):
    print "paster %s" % cmd
    from paste.script import command
    args = cmd.split()
    options, args = command.parser.parse_args(args)
    options.base_parser = command.parser
    command.system_plugins.extend(options.plugins or [])
    commands = command.get_commands()
    command_name = args[0]
    if command_name not in commands:
        command = command.NotFoundCommand
    else:
        command = commands[command_name].load()
    runner = command(command_name)
    runner.run(args[1:])
Пример #4
0
 def paster(self, cmd, cmdplugin=None, template_vars={}):
     from paste.script import command
     args = cmd.split()
     options, args = command.parser.parse_args(args)
     options.base_parser = command.parser
     command.system_plugins.extend(options.plugins or [])
     cmmds = command.get_commands()
     command_name = args[0]
     if cmdplugin:
         runner = cmdplugin(command_name)
     else:
         command = cmmds[command_name].load()
         runner = command(command_name)
     if hasattr(runner, 'template_vars'):
         runner.template_vars.update(template_vars)
     runner.run(args[1:])
Пример #5
0
 def paster(self, cmd, cmdplugin=None, template_vars={}):
     from paste.script import command
     args = cmd.split()
     options, args = command.parser.parse_args(args)
     options.base_parser = command.parser
     command.system_plugins.extend(options.plugins or [])
     cmmds = command.get_commands()
     command_name = args[0]
     if cmdplugin:
         runner = cmdplugin(command_name)
     else:
         command = cmmds[command_name].load()
         runner = command(command_name)
     if hasattr(runner, 'template_vars'):
         runner.template_vars.update(template_vars)
     runner.run(args[1:])
Пример #6
0
def paster(cmd):
    print "paster %s" % cmd
    from paste.script import command
    #the overwite option for the create command defaults to True
    #but in the paste.script.command it defaults to False.
    #so we fixe it here
    if 'create' in cmd:
        cmd += " --overwrite=1"
    args = cmd.split()
    options, args = command.parser.parse_args(args)
    options.base_parser = command.parser
    command.system_plugins.extend(options.plugins or [])
    commands = command.get_commands()
    command_name = args[0]
    if command_name not in commands:
        command = command.NotFoundCommand
    else:
        command = commands[command_name].load()
    runner = command(command_name)
    runner.run(args[1:])
Пример #7
0
def paster(cmd):
    print "paster %s" % cmd
    from paste.script import command
    #the overwite option for the create command defaults to True
    #but in the paste.script.command it defaults to False.
    #so we fixe it here
    if 'create' in cmd:
        cmd += " --overwrite=1"
    args = cmd.split()
    options, args = command.parser.parse_args(args)
    options.base_parser = command.parser
    command.system_plugins.extend(options.plugins or [])
    commands = command.get_commands()
    command_name = args[0]
    if command_name not in commands:
        command = command.NotFoundCommand
    else:
        command = commands[command_name].load()
    runner = command(command_name)
    runner.run(args[1:])