예제 #1
0
파일: builder.py 프로젝트: bazsi/codega
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            if not kwargs.get('guarded', True):
                raise

            return False
예제 #2
0
파일: build.py 프로젝트: bazsi/codega
    def execute(self):
        config_builder = StructureBuilder()
        config_builder.add_source('source', self.opts.source, parser=self.opts.parser)
        config_builder.add_target('source', self.opts.target, self.opts.generator)
        config_builder.set_destination('.')

        for inc in self.opts.include:
            config_builder.add_include(inc)

        for setting in self.opts.set:
            if '=' not in setting:
                logger.critical('Invalid setting %r' % setting)
                return False

            key, value = setting.split('=', 1)
            config_builder.add_setting(self.opts.target, key, value)

        config = config_builder.config

        # Save config if requested
        if self.opts.config is not None:
            conf_xml = save_config(config)
            with open(self.opts.config, 'w') as out:
                out.write(conf_xml)

        return BuildRunner(config).run_task('build', force=True)
예제 #3
0
    def prepare(self, argv):
        if len(argv) != 1:
            logger.critical("Wrong number of arguments (usage: pack <output>)")
            return False

        self._arg = argv[0]
        return True
예제 #4
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
예제 #5
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
예제 #6
0
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(
                BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            return False
예제 #7
0
파일: base.py 프로젝트: bazsi/codega
    def prepare(self, argv):
        if len(argv) != 0:
            logger.critical("Help takes no arguments")
            return False

        return True