about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/qemu/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/qemu/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/qemu/default.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/qemu/default.nix b/nixpkgs/pkgs/development/python-modules/qemu/default.nix
new file mode 100644
index 000000000000..ba730548bca8
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/qemu/default.nix
@@ -0,0 +1,63 @@
+{ lib
+, buildPythonPackage
+, pythonOlder
+, qemu
+, setuptools
+, fuseSupport ? false, fusepy
+, tuiSupport ? false, urwid, urwid-readline, pygments
+}:
+
+buildPythonPackage {
+  pname = "qemu";
+  version = "0.6.1.0a1";
+  pyproject = true;
+
+  disabled = pythonOlder "3.6";
+
+  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, 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";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ devplayer0 davhau ];
+  };
+}