1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 isPyPy,
7 pkgs,
8 python,
9 six,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "pyparted";
15 version = "3.13.0";
16 format = "setuptools";
17 disabled = isPyPy;
18
19 src = fetchFromGitHub {
20 repo = pname;
21 owner = "dcantrell";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-AiUCCrEbDD0OxrvXs1YN3/1IE7SuVasC2YCirIG58iU=";
24 };
25
26 postPatch =
27 ''
28 sed -i -e 's|mke2fs|${pkgs.e2fsprogs}/bin/mke2fs|' tests/baseclass.py
29 sed -i -e '
30 s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
31 ' tests/test__ped_ped.py
32 ''
33 + lib.optionalString stdenv.isi686 ''
34 # remove some integers in this test case which overflow on 32bit systems
35 sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
36 tests/test__ped_ped.py
37 '';
38
39 preConfigure = ''
40 PATH="${pkgs.parted}/sbin:$PATH"
41 '';
42
43 nativeBuildInputs = [ pkgs.pkg-config ];
44 nativeCheckInputs = [
45 six
46 pytestCheckHook
47 ];
48 propagatedBuildInputs = [ pkgs.parted ];
49
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 };
57}