From 2274817f6c499fd31081d7973b7cbfdca17c44a8 Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 10 May 2023 23:54:22 -0400 Subject: python: add vendor.py utility This is a teeny-tiny script that just downloads any packages we want to vendor from PyPI and stores them in qemu.git/python/wheels/. If I'm hit by a meteor, it'll be easy to replicate what I have done in order to udpate the vendored source. We don't really care which python runs it; it exists as a meta-utility with no external dependencies and we won't package or install it. It will be monitored by the linters/type checkers, though; so it's guaranteed safe on python 3.6+. Signed-off-by: John Snow Message-Id: <20230511035435.734312-15-jsnow@redhat.com> Signed-off-by: Paolo Bonzini --- python/scripts/vendor.py | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 python/scripts/vendor.py (limited to 'python/scripts/vendor.py') diff --git a/python/scripts/vendor.py b/python/scripts/vendor.py new file mode 100755 index 0000000000..23708430ea --- /dev/null +++ b/python/scripts/vendor.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +""" +vendor - QEMU python vendoring utility + +usage: vendor [-h] + +QEMU python vendoring utility + +options: + -h, --help show this help message and exit +""" + +# Copyright (C) 2023 Red Hat, Inc. +# +# Authors: +# John Snow +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import argparse +import os +from pathlib import Path +import subprocess +import sys +import tempfile + + +def main() -> int: + """Run the vendoring utility. See module-level docstring.""" + loud = False + if os.environ.get("DEBUG") or os.environ.get("V"): + loud = True + + # No options or anything for now, but I guess + # you'll figure that out when you run --help. + parser = argparse.ArgumentParser( + prog="vendor", + description="QEMU python vendoring utility", + ) + parser.parse_args() + + packages = { + "meson==0.61.5": + "58c2ddb5f885da0e929f15d89f38d8a7d97f981f56815bcba008414f8511f59a", + } + + vendor_dir = Path(__file__, "..", "..", "wheels").resolve() + + with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8") as file: + for dep_spec, checksum in packages.items(): + file.write(f"{dep_spec} --hash=sha256:{checksum}") + file.flush() + + cli_args = [ + "pip", + "download", + "--dest", + str(vendor_dir), + "--require-hashes", + "-r", + file.name, + ] + if loud: + cli_args.append("-v") + + print(" ".join(cli_args)) + subprocess.run(cli_args, check=True) + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) -- cgit 1.4.1 From 3b087f79a48807f348ea61469175e66b28ba44de Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 23 Dec 2021 15:29:56 +0100 Subject: meson: require 0.63.0 This version allows cleanups in modinfo collection, but they only work with Ninja 1.9.x and 1.8.x is still supported. It also supports the equivalent of QEMU's --static option to configure. The wheel file is bumped to 0.63.3, the last release in the 0.63 branch. Signed-off-by: Paolo Bonzini --- configure | 2 +- meson.build | 2 +- python/scripts/vendor.py | 4 ++-- python/wheels/meson-0.61.5-py3-none-any.whl | Bin 862509 -> 0 bytes python/wheels/meson-0.63.3-py3-none-any.whl | Bin 0 -> 926526 bytes 5 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 python/wheels/meson-0.61.5-py3-none-any.whl create mode 100644 python/wheels/meson-0.63.3-py3-none-any.whl (limited to 'python/scripts/vendor.py') diff --git a/configure b/configure index 1ce0e48f31..590c7717bc 100755 --- a/configure +++ b/configure @@ -1136,7 +1136,7 @@ if ! $mkvenv ensure \ $mkvenv_flags \ --dir "${source_path}/python/wheels" \ --diagnose "meson" \ - "meson>=0.61.5" ; + "meson>=0.63.0" ; then exit 1 fi diff --git a/meson.build b/meson.build index 4dddccb890..d85637edf1 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('qemu', ['c'], meson_version: '>=0.61.3', +project('qemu', ['c'], meson_version: '>=0.63.0', default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto', 'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'], version: files('VERSION')) diff --git a/python/scripts/vendor.py b/python/scripts/vendor.py index 23708430ea..34486a51f4 100755 --- a/python/scripts/vendor.py +++ b/python/scripts/vendor.py @@ -41,8 +41,8 @@ def main() -> int: parser.parse_args() packages = { - "meson==0.61.5": - "58c2ddb5f885da0e929f15d89f38d8a7d97f981f56815bcba008414f8511f59a", + "meson==0.63.3": + "d677b809c4895dcbaac9bf6c43703fcb3609a4b24c6057c78f828590049cf43a", } vendor_dir = Path(__file__, "..", "..", "wheels").resolve() diff --git a/python/wheels/meson-0.61.5-py3-none-any.whl b/python/wheels/meson-0.61.5-py3-none-any.whl deleted file mode 100644 index 04a336a8d0..0000000000 Binary files a/python/wheels/meson-0.61.5-py3-none-any.whl and /dev/null differ diff --git a/python/wheels/meson-0.63.3-py3-none-any.whl b/python/wheels/meson-0.63.3-py3-none-any.whl new file mode 100644 index 0000000000..8a191e3a20 Binary files /dev/null and b/python/wheels/meson-0.63.3-py3-none-any.whl differ -- cgit 1.4.1