Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / pyparted / default.nix
blob16a894546e49ca85437fcbbeb19dacaa40090109
1 { lib, stdenv
2 , fetchFromGitHub
3 , buildPythonPackage
4 , isPyPy
5 , pkgs
6 , python
7 , six
8 }:
10 buildPythonPackage rec {
11   pname = "pyparted";
12   version = "3.11.4";
13   disabled = isPyPy;
15   src = fetchFromGitHub {
16     repo = pname;
17     owner = "dcantrell";
18     rev = "v${version}";
19     sha256 = "0wd0xhv1y1zw7djzcnimj8irif3mg0shbhgz0jn5yi914is88h6n";
20   };
22   postPatch = ''
23     sed -i -e 's|mke2fs|${pkgs.e2fsprogs}/bin/mke2fs|' tests/baseclass.py
24     sed -i -e '
25       s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
26     ' tests/test__ped_ped.py
27   '' + lib.optionalString stdenv.isi686 ''
28     # remove some integers in this test case which overflow on 32bit systems
29     sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
30       tests/test__ped_ped.py
31   '';
33   patches = [
34     ./fix-test-pythonpath.patch
35   ];
37   preConfigure = ''
38     PATH="${pkgs.parted}/sbin:$PATH"
39   '';
41   nativeBuildInputs = [ pkgs.pkg-config ];
42   checkInputs = [ six ];
43   propagatedBuildInputs = [ pkgs.parted ];
45   checkPhase = ''
46     patchShebangs Makefile
47     make test PYTHON=${python.executable}
48   '';
50   meta = with lib; {
51     homepage = "https://github.com/dcantrell/pyparted/";
52     description = "Python interface for libparted";
53     license = licenses.gpl2Plus;
54     platforms = platforms.linux;
55     maintainers = with maintainers; [ lsix ];
56   };