From 90a489fc5b056b08bc77452361a68b51614615f1 Mon Sep 17 00:00:00 2001 From: Allison Karlitskaya Date: Mon, 30 Jan 2023 16:54:11 +0100 Subject: [PATCH] build: add tools/make-wheel This is the entrypoint for building a wheel from the current checked out source tree. It makes sure systemd_ctypes is available. This is intended to be used as an API from various subprojects that want to test against the Python bridge. --- test/image-prepare | 11 ++--------- tools/make-wheel | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100755 tools/make-wheel diff --git a/test/image-prepare b/test/image-prepare index 36aeb7029..5788a1894 100755 --- a/test/image-prepare +++ b/test/image-prepare @@ -19,7 +19,6 @@ # along with Cockpit; If not, see . import argparse -import glob import os import shlex import shutil @@ -199,14 +198,8 @@ def validate_packages(): def install_python_bridge(): - subprocess.run([f'{BASE_DIR}/tools/systemd_ctypes'], check=True) - - shutil.rmtree('tmp/wheel', ignore_errors=True) - subprocess.run([sys.executable, '-m', 'build', '--no-isolation', '--wheel', '--outdir', 'tmp/wheel'], check=True) - wheels = glob.glob('tmp/wheel/*.whl') - assert len(wheels) == 1 - - return ['--install', *wheels] + wheel = subprocess.check_output([f'{BASE_DIR}/tools/make-wheel'], universal_newlines=True) + return ['--install', wheel.strip()] def main(): diff --git a/tools/make-wheel b/tools/make-wheel new file mode 100755 index 000000000..582009ba5 --- /dev/null +++ b/tools/make-wheel @@ -0,0 +1,9 @@ +#!/bin/sh + +set -eu +cd "$(realpath -m "$0"/../..)" + +tools/systemd_ctypes +rm -rf tmp/wheel build +python3 -m build --no-isolation --wheel --outdir tmp/wheel . >&2 +realpath tmp/wheel/*.whl