aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorsnermolaev <snermolaev@yandex-team.com>2023-09-21 09:50:31 +0300
committersnermolaev <snermolaev@yandex-team.com>2023-09-21 10:11:56 +0300
commit1044aaa315b23073610c1aa2c8d91c03e95a32db (patch)
tree01f618c6b31a48cb74e3c37908028e33d4ccafa2 /build
parentff79b3e9fcd5a59bed95feaa6ffb29691841c89d (diff)
downloadydb-1044aaa315b23073610c1aa2c8d91c03e95a32db.tar.gz
Revert commit rXXXXXX, ymake_conf.py customization extension
Diffstat (limited to 'build')
-rwxr-xr-xbuild/ymake_conf.py82
1 files changed, 50 insertions, 32 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index 655e4646bc..7d13fceeab 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -688,6 +688,10 @@ 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()
@@ -2213,6 +2217,52 @@ 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
@@ -2469,37 +2519,9 @@ 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)
@@ -2511,16 +2533,12 @@ 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__)