1{ stdenv
2, buildPythonPackage
3, isPyPy
4, pkgs
5, python
6}:
7
8buildPythonPackage rec {
9 pname = "pyparted";
10 version = "3.10.7";
11 disabled = isPyPy;
12
13 src = pkgs.fetchurl {
14 url = "https://github.com/rhinstaller/pyparted/archive/v${version}.tar.gz";
15 sha256 = "0c9ljrdggwawd8wdzqqqzrna9prrlpj6xs59b0vkxzip0jkf652r";
16 };
17
18 postPatch = ''
19 sed -i -e 's|mke2fs|${pkgs.e2fsprogs}/bin/mke2fs|' tests/baseclass.py
20 sed -i -e '
21 s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
22 ' tests/test__ped_ped.py
23 '' + stdenv.lib.optionalString stdenv.isi686 ''
24 # remove some integers in this test case which overflow on 32bit systems
25 sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
26 tests/test__ped_ped.py
27 '';
28
29 preConfigure = ''
30 PATH="${pkgs.parted}/sbin:$PATH"
31 '';
32
33 nativeBuildInputs = [ pkgs.pkgconfig ];
34 propagatedBuildInputs = [ pkgs.parted ];
35
36 checkPhase = ''
37 patchShebangs Makefile
38 make test PYTHON=${python.executable}
39 '';
40
41 meta = with stdenv.lib; {
42 homepage = "https://fedorahosted.org/pyparted/";
43 description = "Python interface for libparted";
44 license = licenses.gpl2Plus;
45 platforms = platforms.linux;
46 };
47
48}