aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/139 mesonintrospect from scripts
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/common/139 mesonintrospect from scripts')
-rw-r--r--meson/test cases/common/139 mesonintrospect from scripts/check_env.py28
-rw-r--r--meson/test cases/common/139 mesonintrospect from scripts/check_introspection.py18
-rw-r--r--meson/test cases/common/139 mesonintrospect from scripts/meson.build14
3 files changed, 60 insertions, 0 deletions
diff --git a/meson/test cases/common/139 mesonintrospect from scripts/check_env.py b/meson/test cases/common/139 mesonintrospect from scripts/check_env.py
new file mode 100644
index 000000000..61de54674
--- /dev/null
+++ b/meson/test cases/common/139 mesonintrospect from scripts/check_env.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import shlex
+
+do_print = False
+
+if len(sys.argv) > 1:
+ do_print = bool(sys.argv[1])
+
+if 'MESONINTROSPECT' not in os.environ:
+ raise RuntimeError('MESONINTROSPECT not found')
+
+mesonintrospect = os.environ['MESONINTROSPECT']
+
+introspect_arr = shlex.split(mesonintrospect)
+
+# print(mesonintrospect)
+# print(introspect_arr)
+
+some_executable = introspect_arr[0]
+
+if not os.path.isfile(some_executable):
+ raise RuntimeError(f'{mesonintrospect!r} does not exist')
+
+if do_print:
+ print(some_executable, end='')
diff --git a/meson/test cases/common/139 mesonintrospect from scripts/check_introspection.py b/meson/test cases/common/139 mesonintrospect from scripts/check_introspection.py
new file mode 100644
index 000000000..851a415c4
--- /dev/null
+++ b/meson/test cases/common/139 mesonintrospect from scripts/check_introspection.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import os
+import shlex
+import subprocess
+
+
+if 'MESONINTROSPECT' not in os.environ:
+ raise RuntimeError('MESONINTROSPECT not found')
+if 'MESON_BUILD_ROOT' not in os.environ:
+ raise RuntimeError('MESON_BUILD_ROOT not found')
+
+mesonintrospect = os.environ['MESONINTROSPECT']
+introspect_arr = shlex.split(mesonintrospect)
+
+buildroot = os.environ['MESON_BUILD_ROOT']
+
+subprocess.check_output([*introspect_arr, '--all', buildroot])
diff --git a/meson/test cases/common/139 mesonintrospect from scripts/meson.build b/meson/test cases/common/139 mesonintrospect from scripts/meson.build
new file mode 100644
index 000000000..11176727d
--- /dev/null
+++ b/meson/test cases/common/139 mesonintrospect from scripts/meson.build
@@ -0,0 +1,14 @@
+project('mesonintrospect from scripts', 'c')
+
+python = import('python3').find_python()
+
+ret = run_command(python, ['check_env.py', '1'])
+if ret.returncode() == 0
+ find_program(ret.stdout())
+else
+ message(ret.stdout())
+ message(ret.stderr())
+endif
+
+meson.add_postconf_script('check_introspection.py')
+meson.add_install_script('check_env.py')