[PATCH v3 05/15] meson, mkvenv: add checktests and functests custom targets

John Snow posted 15 patches 1 week, 2 days ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Ed Maste <emaste@freebsd.org>, Li-Wen Hsu <lwhsu@freebsd.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
[PATCH v3 05/15] meson, mkvenv: add checktests and functests custom targets
Posted by John Snow 1 week, 2 days ago
add "pyvenv_checktests_group" and "pyvenv_functests_group" targets to
meson. These targets will invoke mkvenv.py to install the associated
dependency group to the build/pyvenv directory.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 meson.build        |  1 +
 pyvenv/meson.build | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 pyvenv/meson.build

diff --git a/meson.build b/meson.build
index d9293294d8e..d7f06b8392b 100644
--- a/meson.build
+++ b/meson.build
@@ -4587,6 +4587,7 @@ subdir('scripts')
 subdir('tools')
 subdir('pc-bios')
 subdir('docs')
+subdir('pyvenv')
 # Tests are disabled on emscripten because they rely on host features that aren't
 # supported by emscripten (e.g. fork and unix socket).
 if host_os != 'emscripten'
diff --git a/pyvenv/meson.build b/pyvenv/meson.build
new file mode 100644
index 00000000000..6e8acd9f2b8
--- /dev/null
+++ b/pyvenv/meson.build
@@ -0,0 +1,40 @@
+# Note that this file only controls "optional" dependency groups; groups
+# *required* for the build are handled directly in configure instead:
+# namely, meson and sphinx.
+
+# NB: This command may or may not include the "--online" flag, depending
+# on the results of configure.
+ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()
+
+pyvenv_common_deps = files(
+    meson.project_source_root() + '/pythondeps.toml',
+    meson.project_source_root() + '/python/scripts/mkvenv.py'
+)
+pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels'
+
+
+# This group *must* be available offline, for "make check"
+pyvenv_checktests_group = custom_target(
+    'pyvenv_checktests_group',
+    output: 'checktests.group',
+    input: pyvenv_common_deps,
+    command: ensuregroup_cmd + [
+        '--dir', pyvenv_wheel_dir,
+        '@INPUT0@',
+        'checktests',
+    ],
+)
+
+# This group is allowed to rely on internet, to fetch from PyPI.
+pyvenv_functests_group = custom_target(
+    'pyvenv_functests_group',
+    output: 'functests.group',
+    input: pyvenv_common_deps,
+    depends: pyvenv_checktests_group,
+    command: ensuregroup_cmd + [
+        '--online',
+        '--dir', pyvenv_wheel_dir,
+        '@INPUT0@',
+        'functests',
+    ],
+)
-- 
2.51.1