Example #1
0
    def _configure_options(self, uplid):

        self.uplid = uplid
        self.option_mask = OptionMask(self.uplid, self.ufid)

        # Get the path of default.opts. Assume the directory containing this
        # script is <repo_root>/bin/tools/waf/bde and default.opts is located
        # in the directory <repo_root>/etc.
        upd = os.path.dirname

        bde_root = os.environ.get('BDE_ROOT')
        repo_root = upd(upd(upd(upd(upd(os.path.realpath(__file__))))))
        default_opts_path = os.path.join(repo_root, 'etc', 'default.opts')

        default_opts_flag = os.path.isfile(default_opts_path)
        if not default_opts_flag and bde_root:
            default_opts_path = os.path.join(bde_root, 'etc', 'default.opts')
            default_opts_flag = os.path.isfile(default_opts_path)

        if not default_opts_flag:
            self.ctx.fatal("Can not find default.opts from the /etc directory "
                           "of the waf executable, nor the BDE_ROOT "
                           "environment variable.")

        raw_options = RawOptions()
        raw_options.read(default_opts_path)

        # At BB, default_internal.opts contains some variables that is required
        # for building bde-bb.
        if bde_root:
            default_internal_opts_path = os.path.join(bde_root, 'etc',
                                                      'default_internal.opts')
            raw_options.read(default_internal_opts_path)

        debug_opt_keys = self.ctx.options.debug_opt_keys
        if debug_opt_keys:
            debug_opt_keys = debug_opt_keys.split(',')

        self.default_opts = Options(self.option_mask)
        self.default_opts.read(raw_options.options, self.ctx,
                               debug_opt_keys=debug_opt_keys)

        for g in self.group_dep:
            self.ctx.start_msg("Evaluating options for '%s'" % g)
            status_msg = self._evaluate_group_options(g)
            self.ctx.end_msg(status_msg)

        tmp_opts = copy.deepcopy(self.default_opts)
        tmp_opts.evaluate()

        env_variables = ('SET_TMPDIR', 'XLC_LIBPATH')
        setenv_re = re.compile(r'^([^=]+)=(.*)$')
        for e in env_variables:
            if e in tmp_opts.options:
                m = setenv_re.match(tmp_opts.options[e])
                self.custom_envs[m.group(1)] = m.group(2)
Example #2
0
    def configure_options(self, uplid):

        self.uplid = uplid
        self.option_mask = OptionMask(self.uplid, self.ufid)

        default_opts_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.opts')
        raw_options = RawOptions()
        raw_options.read(default_opts_path)


        debug_opt_keys = self.ctx.options.debug_opt_keys
        if debug_opt_keys:
            debug_opt_keys = debug_opt_keys.split(',')

        self.default_opts = Options(self.option_mask)
        self.default_opts.read(raw_options.options, self.ctx, debug_opt_keys=debug_opt_keys)

        for g in self.group_dep:
            self.ctx.start_msg("Evaluating options for '%s'" % g)
            self._evaluate_group_options(g)
            self.ctx.end_msg('ok')
Example #3
0
    def configure_options(self, uplid):

        self.uplid = uplid
        self.option_mask = OptionMask(self.uplid, self.ufid)

        default_opts_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.opts')
        raw_options = RawOptions()
        raw_options.read(default_opts_path)

        # At BB, default_internal.opts contains some variables that is required for building bde-bb.
        bde_root = os.environ.get('BDE_ROOT')

        if bde_root:
            default_internal_opts_path = os.path.join(bde_root, 'etc', 'default_internal.opts')
            raw_options.read(default_internal_opts_path)

        debug_opt_keys = self.ctx.options.debug_opt_keys
        if debug_opt_keys:
            debug_opt_keys = debug_opt_keys.split(',')

        self.default_opts = Options(self.option_mask)
        self.default_opts.read(raw_options.options, self.ctx, debug_opt_keys=debug_opt_keys)

        for g in self.group_dep:
            self.ctx.start_msg("Evaluating options for '%s'" % g)
            status_msg = self._evaluate_group_options(g)
            self.ctx.end_msg(status_msg)

        tmp_opts = copy.deepcopy(self.default_opts)
        tmp_opts.evaluate()

        env_variables = ('SET_TMPDIR', 'XLC_LIBPATH')
        setenv_re = re.compile(r'^([^=]+)=(.*)$')
        for e in env_variables:
            if e in tmp_opts.options:
                m = setenv_re.match(tmp_opts.options[e])
                self.custom_envs[m.group(1)] = m.group(2)
Example #4
0
    def _get_raw_options(self, node, metadir, metatype):
        metafile = node.make_node([metadir, node.name + '.' + metatype])
        raw_options = RawOptions()
        raw_options.read(metafile.abspath())

        return raw_options.options
Example #5
0
    def _get_raw_options(self, node, metadir, metatype):
        metafile = node.make_node([metadir, node.name + '.' + metatype])
        raw_options = RawOptions()
        raw_options.read(metafile.abspath())

        return raw_options.options
Example #6
0
    usage = \
        """Usage: cat <opts_file> | bde_opts_format.py

Format the text from stdin in the options file format, which is used by opts
and defs meta-data files, and print the result to stdout.

The formatter aligns each section of the option rules using two spaces as
padding. Comments and blank lines will be left in-place unmodified.

"""

    if len(sys.argv) > 1:
        print >>sys.stderr, usage
        sys.exit(1)

    raw_options = RawOptions()
    raw_options.read_handle(sys.stdin)

    max_field_widths = [2, 0, 0, 0]
    option_field_index = {
        'modifier': 0,
        'platform': 1,
        'config': 2,
        'key': 3,
    }

    for option in raw_options.options:
        for name in option_field_index:
            attr = getattr(option, name)
            attr = attr if attr else ''
            index = option_field_index[name]