Пример #1
0
    def __call__(self, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)
        self.parser = ArgumentParser()
        version = pkg_resources.get_distribution("mr.developer").version
        self.parser.add_argument('-v', '--version',
                                 action='version',
                                 version='mr.developer %s' % version)
        self.parsers = self.parser.add_subparsers(title="commands", metavar="")
        CmdActivate(self)
        CmdCheckout(self)
        CmdDeactivate(self)
        CmdHelp(self)
        CmdInfo(self)
        CmdList(self)
        CmdPony(self)
        CmdPurge(self)
        CmdRebuild(self)
        CmdReset(self)
        CmdStatus(self)
        CmdUpdate(self)
        args = self.parser.parse_args()

        try:
            self.buildout_dir = find_base()
        except IOError, e:
            self.parser.print_help()
            print
            logger.error("You are not in a path which has mr.developer installed (%s)." % e)
            return
Пример #2
0
    def __call__(self, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)

        self.cmd_activate = self.alias_a = CmdActivate(self)
        self.cmd_checkout = self.alias_co = CmdCheckout(self)
        self.cmd_deactivate = self.alias_d = CmdDeactivate(self)
        self.cmd_help = self.alias_h = CmdHelp(self)
        self.cmd_info = CmdInfo(self)
        self.cmd_list = self.alias_ls = CmdList(self)
        self.cmd_pony = CmdPony(self)
        self.cmd_purge = CmdPurge(self)
        self.cmd_rebuild = self.alias_rb = CmdRebuild(self)
        self.cmd_reset = CmdReset(self)
        self.cmd_status = self.alias_stat = self.alias_st = CmdStatus(self)
        self.cmd_update = self.alias_up = CmdUpdate(self)

        try:
            self.buildout_dir = find_base()
        except IOError, e:
            self.cmd_help()
            print
            logger.error("You are not in a path which has mr.developer installed (%s)." % e)
            return
Пример #3
0
    def __call__(self, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)
        self.parser = ArgumentParser()
        version = pkg_resources.get_distribution("mr.developer").version
        self.parser.add_argument('-v',
                                 '--version',
                                 action='version',
                                 version='mr.developer %s' % version)
        self.parsers = self.parser.add_subparsers(title="commands", metavar="")
        CmdActivate(self)
        CmdCheckout(self)
        CmdDeactivate(self)
        CmdHelp(self)
        CmdInfo(self)
        CmdList(self)
        CmdPony(self)
        CmdPurge(self)
        CmdRebuild(self)
        CmdReset(self)
        CmdStatus(self)
        CmdUpdate(self)
        args = self.parser.parse_args()

        try:
            self.buildout_dir = find_base()
        except IOError, e:
            self.parser.print_help()
            print
            logger.error(
                "You are not in a path which has mr.developer installed (%s)."
                % e)
            return
Пример #4
0
    def __call__(self, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)

        self.cmd_activate = self.alias_a = CmdActivate(self)
        self.cmd_checkout = self.alias_co = CmdCheckout(self)
        self.cmd_deactivate = self.alias_d = CmdDeactivate(self)
        self.cmd_help = self.alias_h = CmdHelp(self)
        self.cmd_info = CmdInfo(self)
        self.cmd_list = self.alias_ls = CmdList(self)
        self.cmd_pony = CmdPony(self)
        self.cmd_rebuild = self.alias_rb = CmdRebuild(self)
        self.cmd_reset = CmdReset(self)
        self.cmd_status = self.alias_stat = self.alias_st = CmdStatus(self)
        self.cmd_update = self.alias_up = CmdUpdate(self)

        if len(kwargs) == 0:
            try:
                installed = load_installed_cfg()
            except IOError, e:
                self.cmd_help()
                print
                logger.error("You are not in a path which has mr.developer installed (%s)." % e)
                return
            if not installed.has_option(FAKE_PART_ID, "__buildout_installed__"):
                self.cmd_help()
                print
                logger.error("You are not in a path which has mr.developer installed (mr.developer not in buildout).")
                return
            develop = installed.get(FAKE_PART_ID, "__buildout_installed__")
            subprocess.call([develop] + sys.argv[1:])
            return
Пример #5
0
    def __call__(self, *args, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)
        self.parser = ArgumentParser()
        version = pkg_resources.get_distribution("mr.developer").version
        self.parser.add_argument('-v',
                                 '--version',
                                 action='version',
                                 version='mr.developer %s' % version)
        self.parsers = self.parser.add_subparsers(title="commands", metavar="")

        for command in get_commands():
            command(self)

        if not args:
            args = None
        args = self.parser.parse_args(args)

        try:
            self.buildout_dir = find_base()
        except IOError:
            if isinstance(args.func, CmdHelp):
                args.func(args)
                return
            self.parser.print_help()
            print()
            logger.error(
                "You are not in a path which has mr.developer installed (%s)."
                % sys.exc_info()[1])
            return
        if not hasattr(args, 'func'):
            self.parser.print_help()
            return

        self.config = Config(self.buildout_dir)
        self.original_dir = os.getcwd()
        atexit.register(self.restore_original_dir)
        os.chdir(self.buildout_dir)
        buildout = Buildout(self.config.buildout_settings['config_file'],
                            self.config.buildout_options,
                            self.config.buildout_settings['user_defaults'],
                            self.config.buildout_settings['windows_restart'])
        root_logger = logging.getLogger()
        root_logger.handlers = []
        root_logger.setLevel(logging.INFO)
        extension = Extension(buildout)
        self.sources = extension.get_sources()
        self.sources_dir = extension.get_sources_dir()
        self.auto_checkout = extension.get_all_auto_checkout()
        self.always_checkout = extension.get_always_checkout()
        self.update_git_submodules = extension.get_update_git_submodules()
        self.always_accept_server_certificate = extension.get_always_accept_server_certificate(
        )
        develop, self.develeggs, versions = extension.get_develop_info()
        self.threads = extension.get_threads()

        args.func(args)
Пример #6
0
    def __call__(self, **kwargs):
        logger.setLevel(logging.INFO)
        ch = logging.StreamHandler()
        ch.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
        logger.addHandler(ch)
        self.parser = ArgumentParser()
        version = pkg_resources.get_distribution("mr.developer").version
        self.parser.add_argument('-v', '--version',
                                 action='version',
                                 version='mr.developer %s' % version)
        self.parsers = self.parser.add_subparsers(title="commands", metavar="")
        CmdActivate(self)
        CmdArguments(self)
        CmdCheckout(self)
        CmdDeactivate(self)
        CmdHelp(self)
        CmdInfo(self)
        CmdList(self)
        CmdPony(self)
        CmdPurge(self)
        CmdRebuild(self)
        CmdReset(self)
        CmdStatus(self)
        CmdUpdate(self)
        args = self.parser.parse_args()

        try:
            self.buildout_dir = find_base()
        except IOError:
            if isinstance(args.func, CmdHelp):
                args.func(args)
                return
            self.parser.print_help()
            print
            logger.error("You are not in a path which has mr.developer installed (%s)." % sys.exc_info()[1])
            return

        self.config = Config(self.buildout_dir)
        self.original_dir = os.getcwd()
        atexit.register(self.restore_original_dir)
        os.chdir(self.buildout_dir)
        buildout = Buildout(self.config.buildout_settings['config_file'],
                            self.config.buildout_options,
                            self.config.buildout_settings['user_defaults'],
                            self.config.buildout_settings['windows_restart'])
        root_logger = logging.getLogger()
        root_logger.handlers = []
        root_logger.setLevel(logging.INFO)
        extension = Extension(buildout)
        self.sources = extension.get_sources()
        self.sources_dir = extension.get_sources_dir()
        self.auto_checkout = extension.get_auto_checkout()
        self.always_checkout = extension.get_always_checkout()
        self.update_git_submodules = extension.get_update_git_submodules()
        self.always_accept_server_certificate = extension.get_always_accept_server_certificate()
        develop, self.develeggs, versions = extension.get_develop_info()
        self.threads = extension.get_threads()

        args.func(args)