diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-11-16 15:52:47 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-12-07 15:32:13 +0100 |
commit | 30ec2eaef5f1e3c6639304316a12bf01a5cd7150 (patch) | |
tree | b80207195995556afe7c4ee3394f178b75d94d0d /meson.build | |
parent | f4780cbe303c266c3b25a107eb0eb0296c6156da (diff) | |
download | systemd-30ec2eaef5f1e3c6639304316a12bf01a5cd7150.tar.gz |
meson,ukify: hook up ukify, add --version option
The option is added because we have a similar one for kernel-install. This
program requires python, and some people might want to skip it because of this.
The tool is installed in /usr/lib/systemd for now, since the interface might
change.
A template file is used, but there is no .in suffix.
The problem is that we'll later want to import the file as a module
for tests, but recent Python versions make it annoyingly hard to import
a module from a file without a .py suffix. imp.load_sources() works, but it
is deprecated and throws warnings.
importlib.machinery.SourceFileLoader().load_module() works, but is also
deprecated. And the documented replacements are a maze of twisted little
callbacks that result in an empty module.
So let's take the easy way out, and skip the suffix which makes it easy
to import the template as a module after adding the directory to sys.path.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 2fb5102971..84b2a22ebe 100644 --- a/meson.build +++ b/meson.build @@ -712,6 +712,17 @@ if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0 error('python3 jinja2 missing') endif +python_310 = run_command(python, '-c', + 'import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)', + check : false).returncode() == 0 +if get_option('ukify') == 'auto' + want_ukify = python_310 +elif get_option('ukify') == 'true' and not python310 + error('ukify requires Python >= 3.10') +else + want_ukify = get_option('ukify') == 'true' +endif + ############################################################ gperf = find_program('gperf') @@ -3991,6 +4002,18 @@ if want_tests != 'false' and want_kernel_install args : [exe.full_path(), loaderentry_install]) endif +if want_ukify + exe = custom_target( + 'ukify', + input : 'src/ukify/ukify.py', + output : 'ukify', + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], + install : true, + install_mode : 'rwxr-xr-x', + install_dir : rootlibexecdir) + public_programs += exe +endif + ############################################################ runtest_env = custom_target( |