python3Packages.qemu: fix shadowed qemu; improve expression

- fix all shadowed references of qemu in python-packages.nix
- migrate to pyproject = true
- add a check to ensure that the version attribute is up to date
- implement check phase testing all executables
- enable tui and fuse support by default for the application only
- if fuse/tui disabled, ensure that corresponding executables are not exported
This commit is contained in:
DavHau 2024-02-02 15:36:08 +07:00
parent 9c4a65790a
commit 11749a4e25
3 changed files with 48 additions and 10 deletions

View File

@ -1,32 +1,59 @@
{ lib
, pkgs
, buildPythonPackage
, pythonOlder
, qemu
, setuptools
, fuseSupport ? false, fusepy
, tuiSupport ? false, urwid, urwid-readline, pygments
}:
buildPythonPackage rec {
buildPythonPackage {
pname = "qemu";
version = "0.6.1.0a1";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.6";
src = pkgs.qemu.src;
src = qemu.src;
prePatch = ''
cd python
'';
# ensure the version matches qemu-xxx/python/VERSION
preConfigure = ''
if [ "$version" != "$(cat ./VERSION)" ]; then
echo "The nix package version attribute is not in sync with the QEMU source version" > /dev/stderr
echo "Please update the version attribute in the nix expression of python3Packages.qemu to '$version'" > /dev/stderr
exit 1
fi
'';
buildInputs = [
setuptools
];
propagatedBuildInputs = [ ]
++ lib.optionals fuseSupport [ fusepy ]
++ lib.optionals tuiSupport [ urwid urwid-readline pygments ];
# Project requires avocado-framework for testing
doCheck = false;
# Project requires avocado-framework for testing, therefore replacing check phase
checkPhase = ''
for bin in $out/bin/*; do
$bin --help
done
'';
pythonImportsCheck = [ "qemu" ];
preFixup =
(lib.optionalString (! tuiSupport) ''
rm $out/bin/qmp-tui
'')
+ (lib.optionalString (! fuseSupport) ''
rm $out/bin/qom-fuse
'');
meta = with lib; {
homepage = "http://www.qemu.org/";
description = "Python tooling used by the QEMU project to build, configure, and test QEMU";

View File

@ -34760,7 +34760,12 @@ with pkgs;
inherit (darwin) sigtool;
};
qemu-python-utils = python3Packages.toPythonApplication python3Packages.qemu;
qemu-python-utils = python3Packages.toPythonApplication (
python3Packages.qemu.override {
fuseSupport = true;
tuiSupport = true;
}
);
qemu-utils = qemu.override {
toolsOnly = true;

View File

@ -2389,7 +2389,9 @@ self: super: with self; {
cose = callPackage ../development/python-modules/cose { };
cot = callPackage ../development/python-modules/cot { };
cot = callPackage ../development/python-modules/cot {
qemu = pkgs.qemu;
};
cov-core = callPackage ../development/python-modules/cov-core { };
@ -5008,7 +5010,9 @@ self: super: with self; {
guessit = callPackage ../development/python-modules/guessit { };
guestfs = callPackage ../development/python-modules/guestfs { };
guestfs = callPackage ../development/python-modules/guestfs {
qemu = pkgs.qemu;
};
gudhi = callPackage ../development/python-modules/gudhi { };
@ -12280,7 +12284,9 @@ self: super: with self; {
qgrid = callPackage ../development/python-modules/qgrid { };
qemu = callPackage ../development/python-modules/qemu { };
qemu = callPackage ../development/python-modules/qemu {
qemu = pkgs.qemu;
};
qiling = callPackage ../development/python-modules/qiling { };