OSDN Git Service

mkvenv: add ensure subcommand
authorJohn Snow <jsnow@redhat.com>
Thu, 11 May 2023 03:54:14 +0000 (23:54 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 May 2023 06:53:51 +0000 (08:53 +0200)
commitc5538eed12e2e427e3715b39cca46c00afcde78d
treef02238ca08789fb946c5e3956f6f07404c48eee9
parentdee01b827ffc26577217697074052b8b7f4770dc
mkvenv: add ensure subcommand

This command is to be used to add various packages (or ensure they're
already present) into the configure-provided venv in a modular fashion.

Examples:

mkvenv ensure --online --dir "${source_dir}/python/wheels/" "meson>=0.61.5"
mkvenv ensure --online "sphinx>=1.6.0"
mkvenv ensure "qemu.qmp==0.0.2"

It's designed to look for packages in three places, in order:

(1) In system packages, if the version installed is already good
enough. This way your distribution-provided meson, sphinx, etc are
always used as first preference.

(2) In a vendored packages directory. Here I am suggesting
qemu.git/python/wheels/ as that directory. This is intended to serve as
a replacement for vendoring the meson source for QEMU tarballs. It is
also highly likely to be extremely useful for packaging the "qemu.qmp"
package in source distributions for platforms that do not yet package
qemu.qmp separately.

(3) Online, via PyPI, ***only when "--online" is passed***. This is only
ever used as a fallback if the first two sources do not have an
appropriate package that meets the requirement. The ability to build
QEMU and run tests *completely offline* is not impinged.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20230511035435.734312-7-jsnow@redhat.com>
[Use distlib to lookup distributions. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
python/scripts/mkvenv.py
python/setup.cfg
python/tests/minreqs.txt