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