示例#1
0
 def __init__(self, env, rules=None, compat=None, options=None):
     self.__opt = LocalOptions()
     self._env = env
     self.__pkg = {}
     self.__rules = DebianRules(verbose=env.verbose,
                                debug=env.debug) if rules is None else rules
     self.__compat = DebianCompat() if compat is None else compat
     self.__options = DebianOptions() if options is None else options
     self.__generated = [self.__rules, self.__compat, self.__options]
示例#2
0
    def __init__(self, env, optparser, cache):
        self.__env = env
        self.__root = env.getcwd()
        self.__exclude = []
        self.__opt = LocalOptions('coverage')
        cache.register(self.__opt)

        if self.__env.has('tools', 'gcovr'):
            self.__opt.state_merge(
                {'gcovr_path': self.__env.get('tools', 'gcovr')})

        cover = OptionGroup(optparser, "CMake Coverage Options")
        self.__opt.add_bool_option(cover,
                                   '--coverage-xml',
                                   dest='xml',
                                   help='generate XML output',
                                   cache=False)
        self.__opt.add_bool_option(cover,
                                   '--coverage-keep',
                                   dest='keep',
                                   help='keep intermediate output',
                                   cache=False)
        self.__opt.add_option(cover,
                              '--coverage-output',
                              type='string',
                              dest='output',
                              metavar='FILE',
                              help='write output to this file',
                              cache=False)
        self.__opt.add_option(cover,
                              '--coverage-gcovr-path',
                              type='string',
                              default='/usr/bin/gcovr',
                              dest='gcovr_path',
                              metavar='FILE',
                              help='location of gcovr script')
        optparser.add_option_group(cover)
示例#3
0
 def __init__(self, env, default_dependency_class):
     self.__env = env
     self.__default = default_dependency_class
     self.__groups = {}
     self.__opt = LocalOptions()
示例#4
0
 def __init__(self, name):
     Dependency.__init__(self, name)
     self.__opt = LocalOptions(name)
示例#5
0
 def __init__(self, env):
     TestRunner.__init__(self, env)
     self.__opt = LocalOptions('boost')
示例#6
0
    def __init__(self, name, **opts):
        self.__configurecache = mirbuild.cache.Cache(filename='configure.json')
        self.__options = opts
        self.__tests = None
        self.__versions = []
        self.__plugins = []
        self.__install = []
        self.__packagers = {}
        self.__test_runners = {}

        try:
            self.__configurecache.load()
        except Exception:
            # if we can't load the cache, so be it
            pass

        self.__parser = OptionParser(add_help_option=False)
        self.__general_options = OptionGroup(self.__parser, "General Options")
        self.__parser.add_option_group(self.__general_options)

        self.opt = LocalOptions('general')
        self.__configurecache.register(self.opt)

        if self.has_build_configs:
            self.add_option('-c|--configuration',
                            dest='configuration',
                            type='string',
                            defaultstr=False,
                            metavar='CFG',
                            help='selected build configuration')

        self.add_bool_option('-h|--help',
                             dest='help',
                             help='show this help message and exit',
                             cache=False)

        for opt, dest, help in [
            ('-d|--debug', 'debug', 'debug build.py execution'),
            ('-q|--quiet', 'quiet', 'be quiet'),
            ('-v|--verbose', 'verbose', 'verbose compiler/packaging output'),
            ('--trace', 'trace',
             'trace build process (if supported by the builder)'),
            ('--nodeps', 'nodeps', "don't use dependencies from .mirbuildrc"),
            ('--noconfig', 'noconfig', "don't use .mirbuildrc files at all"),
            ('--noenv', 'noenv', "don't honour environment variables"),
            ('--called-by-packager', 'called_by_packager',
             "option indicating that build.py is being invoked by a mirbuild packager"
             ),
        ]:
            self.add_bool_option(opt, dest=dest, help=help, cache=False)
            for o in opt.split('|'):
                if o in sys.argv:
                    self.opt.set_value(dest, True)

        self.__env = self.environment_class(name)
        self.__env.set_options(self.opt)
        self._deps = mirbuild.dependency.Dependencies(
            self.__env, self.default_dependency_class)

        if not self.opt.noconfig:
            self.__env.read_config()
            if self.__env.has('build', 'prefix'):
                self.opt.state_merge(
                    {'prefix': self.__env.get('build', 'prefix')})

        self.opt.ensure_value('jobs',
                              self.__env.get('build', 'parallel', 'auto'))
        self.add_option('-j|--jobs',
                        dest='jobs',
                        type='string',
                        metavar='NUM',
                        cache=False,
                        help='number of parallel jobs to execute if possible')

        self.add_option('--prefix',
                        dest='prefix',
                        type='string',
                        default=self.default_install_path,
                        metavar='PATH',
                        help='install prefix for this project')
        self.add_option('--install-destdir',
                        dest='install_destdir',
                        type='string',
                        metavar='PATH',
                        help='install files to this path')

        self.add_option('-b|--build-mode',
                        dest='build_mode',
                        type='choice',
                        choices=['in', 'out'],
                        default='in',
                        metavar="MODE",
                        help='[in|out] source build mode')

        for o in [('-I|--include-path', 'include',
                   'C_INCLUDE_PATH CPLUS_INCLUDE_PATH'.split()),
                  ('-L|--library-path', 'library', 'LIBRARY_PATH'.split())]:
            var = o[1] + '_path'
            if hasattr(self, 'add_' + var):
                path = []
                if not self.opt.noenv:
                    for e in o[2]:
                        path += [
                            x for x in os.environ.get(e, '').split(
                                os.path.pathsep) if x
                        ]
                path += [
                    x for x in self.env.get('build', var, '').split(
                        os.path.pathsep) if x
                ]
                self.opt.state_merge({var: path})
                self.add_option(o[0],
                                type='string',
                                dest=var,
                                multi=True,
                                metavar='PATH',
                                help='use additional ' + o[1] + ' path')