about summary refs log tree commit diff
path: root/pkgs/development/python-modules/qemu/default.nix
blob: 9971f254c43e1b504a45e156e92941649dc69af1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
  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
    ];
  };
}