def _store_option_rule(self, rule, debug_keys=[]): """Store the key and value of an option rule. """ match = self._match_rule(rule) if rule.key in debug_keys: if match: logutil.info('Accept: %s' % rule) else: logutil.warn('Ingore: %s' % rule) if not match: return mc = self._OPT_INLINE_COMMAND_RE.search(rule.value) if mc: v = rule.value out = sysutil.shell_command(mc.group(1)).rstrip() rule.value = '%s"%s"%s' % (v[:mc.start(1) - 3], out, v[mc.end(1) + 3:]) mc2 = self._OPT_INLINE_COMMAND_RE2.match(rule.value) if mc2: out = sysutil.shell_command(mc2.group(1)).rstrip() rule.value = out key = rule.key value = rule.value if key == 'BDE_COMPILER_FLAG': global DEFAULT_COMPILER DEFAULT_COMPILER = value if key not in self.results: self.results[key] = value else: orig = self.results[key] if rule.command == optiontypes.OptionCommand.ADD: if orig: self.results[key] = orig + ' ' + value else: self.results[key] = value elif rule.command == optiontypes.OptionCommand.INSERT: if orig: self.results[key] = value + ' ' + orig else: self.results[key] = value elif rule.command == optiontypes.OptionCommand.APPEND: self.results[key] = orig + value elif rule.command == optiontypes.OptionCommand.PREPEND: self.results[key] = value + orig elif rule.command == optiontypes.OptionCommand.OVERRIDE: self.results[key] = value if rule.key in debug_keys: logutil.info('Update: %s -> %s\n' % (rule.key, self.results[rule.key]))
def print_envs(options, info): ufid = optionsutil.make_ufid_from_cmdline_options(options) os_type, os_name, cpu_type, os_ver = get_os_info() uplid = optiontypes.Uplid(os_type, os_name, cpu_type, os_ver, info.type_, info.version) print('Using compiler: %s' % info.description(), file=sys.stderr) print('Using ufid: %s' % ufid, file=sys.stderr) print('export BDE_WAF_UPLID=%s' % uplid) print('export BDE_WAF_UFID=%s' % ufid) id_str = '%s-%s' % (uplid, ufid) print('export BDE_WAF_BUILD_DIR="_build/%s"' % id_str) print('export WAFLOCK=".lock-waf-%s"' % id_str) if os_type != 'windows': print('export CXX=%s' % info.cxx_path) print('export CC=%s' % info.c_path) if info.flags: print('export BDE_WAF_COMP_FLAGS="%s"' % info.flags) else: print('unset BDE_WAF_COMP_FLAGS') if options.install_dir: install_dir = options.install_dir else: install_dir = _determine_installation_location( os.environ.get('PREFIX'), uplid) if install_dir: print('Using install directory: %s' % install_dir, file=sys.stderr) PREFIX = os.path.join(install_dir, id_str) if sysutil.unversioned_platform() == 'cygwin': PREFIX = sysutil.shell_command('cygpath -m "%s"' % PREFIX).rstrip() print('export PREFIX="%s"' % PREFIX) pkg_path = '%s/lib/pkgconfig' % PREFIX extra_pkg_path = os.environ.get('BDE_WAF_EXTRA_PKG_CONFIG_PATH') if extra_pkg_path: pkg_path += ':' + extra_pkg_path print('export PKG_CONFIG_PATH="%s"' % pkg_path)
def _store_option_rule(self, rule, debug_keys=[]): """Store the key and value of an option rule. """ match = self._match_rule(rule) if rule.key in debug_keys: if match: logutil.info('Accept: %s' % rule) else: logutil.warn('Ignore: %s' % rule) if not match: return # `subst` was a hack to remove a flag from the list of compiler flags # when building test drivers. This is no longer needed and will be # removed from opts files in BDE. It is explicitly ignored here for # backward compatibliity. if self._OPT_INLINE_SUBST_RE.match(rule.value): if rule.key in debug_keys: logutil.warn('Skipping rule: %s' % rule) return # `shell` returns output of a terminal command. It is used as part of a # hack to build bde-bb. mc = self._OPT_INLINE_COMMAND_RE.search(rule.value) if mc: v = rule.value out = sysutil.shell_command(mc.group(1)).rstrip() rule.value = '%s"%s"%s' % (v[:mc.start(1) - 3], out, v[mc.end(1) + 3:]) mc2 = self._OPT_INLINE_COMMAND_RE2.match(rule.value) if mc2: out = sysutil.shell_command(mc2.group(1)).rstrip() rule.value = out key = rule.key value = rule.value if key not in self.options: self.options[key] = value else: orig = self.options[key] if rule.command == optiontypes.OptionCommand.ADD: if orig: self.options[key] = orig + ' ' + value else: self.options[key] = value elif rule.command == optiontypes.OptionCommand.INSERT: if orig: self.options[key] = value + ' ' + orig else: self.options[key] = value elif rule.command == optiontypes.OptionCommand.APPEND: self.options[key] = orig + value elif rule.command == optiontypes.OptionCommand.PREPEND: self.options[key] = value + orig elif rule.command == optiontypes.OptionCommand.OVERRIDE: self.options[key] = value if rule.key in debug_keys: logutil.info('Update: %s -> %s\n' % (rule.key, self.options[rule.key]))