diff options
| -rwxr-xr-x | build/ymake_conf.py | 82 |
1 files changed, 32 insertions, 50 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 7d13fceeaba..655e4646bc5 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -688,10 +688,6 @@ class Build(object): ragel.configure_toolchain(self, compiler) ragel.print_variables() - perl = Perl() - perl.configure_local() - perl.print_variables('LOCAL_') - swiftc = SwiftCompiler(self) swiftc.configure() swiftc.print_compiler() @@ -2217,52 +2213,6 @@ class Python(object): variables.emit() -class Perl(object): - # Parse (key, value) from "version='5.26.0';" lines - PERL_CONFIG_RE = re.compile(r"^(?P<key>\w+)='(?P<value>.*)';$", re.MULTILINE) - - def __init__(self): - self.perl = None - self.version = None - self.privlib = None - self.archlib = None - - def configure_local(self, perl=None): - self.perl = perl or preset('PERL') or which('perl') - if self.perl is None: - return - - # noinspection PyTypeChecker - config = dict(self._iter_config(['version', 'privlibexp', 'archlibexp'])) - self.version = config.get('version') - self.privlib = config.get('privlibexp') - self.archlib = config.get('archlibexp') - - def print_variables(self, prefix=''): - variables = Variables({ - prefix + 'PERL': self.perl, - prefix + 'PERL_VERSION': self.version, - prefix + 'PERL_PRIVLIB': self.privlib, - prefix + 'PERL_ARCHLIB': self.archlib, - }) - - variables.reset_if_any(reset_value='PERL-NOT-FOUND') - variables.emit(with_ignore_comment=variables.keys()) - - def _iter_config(self, config_keys): - # Run perl -V:version -V:etc... - perl_config = [self.perl] + ['-V:{}'.format(key) for key in config_keys] - config = six.ensure_str(get_stdout(perl_config) or '') - - start = 0 - while True: - match = Perl.PERL_CONFIG_RE.search(config, start) - if match is None: - break - yield match.group('key', 'value') - start = match.end() - - class Setting(object): def __init__(self, key, auto=None, convert=None, rewrite=False): self.key = key @@ -2519,9 +2469,37 @@ class CuDNN(object): self.cudnn_version.emit() +def customization(): + if not is_positive('DISABLE_YMAKE_CONF_CUSTOMIZATION'): + try: + sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'internal')) + from custom_conf import CustomConf + logger.debug('Customization extension was successfully loaded') + return CustomConf + except Exception as e: + logger.debug('Customization extension was not found; [{}]'.format(str(e))) + else: + logger.debug('Customization extension was disabled') + + class DummyConf: + def __init__(self, options, helper): + pass + + def print_prologue(self): + pass + + def print_epilogue(self): + pass + + return DummyConf + + def main(): options = opts() + CustomConfig = customization() + custom_conf = CustomConfig(options) + arcadia = Arcadia(options.arcadia_root) ymake = YMake(arcadia) @@ -2533,12 +2511,16 @@ def main(): if internal_conf_full_path and not is_positive('DISABLE_YMAKE_CONF_CUSTOMIZATION'): print('@import "${{CONF_ROOT}}/{}"'.format(_INTERNAL_CONF)) + custom_conf.print_prologue() + ymake.print_presets() ymake.print_settings() build = Build(arcadia, options.build_type, options.toolchain_params, force_ignore_local_files=not options.local_distbuild) build.print_build() + custom_conf.print_epilogue() + emit_with_ignore_comment('CONF_SCRIPT_DEPENDS', __file__) |
