1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 isPyPy,
7 pkgs,
8 six,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "pyparted";
14 version = "3.13.0";
15 format = "setuptools";
16 disabled = isPyPy;
17
18 src = fetchFromGitHub {
19 repo = "pyparted";
20 owner = "dcantrell";
21 tag = "v${version}";
22 hash = "sha256-AiUCCrEbDD0OxrvXs1YN3/1IE7SuVasC2YCirIG58iU=";
23 };
24
25 postPatch = ''
26 sed -i -e 's|mke2fs|${pkgs.e2fsprogs}/bin/mke2fs|' tests/baseclass.py
27 sed -i -e '
28 s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
29 ' tests/test__ped_ped.py
30 ''
31 + lib.optionalString stdenv.hostPlatform.isi686 ''
32 # remove some integers in this test case which overflow on 32bit systems
33 sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
34 tests/test__ped_ped.py
35 '';
36
37 preConfigure = ''
38 PATH="${pkgs.parted}/sbin:$PATH"
39 '';
40
41 nativeBuildInputs = [ pkgs.pkg-config ];
42 nativeCheckInputs = [
43 six
44 pytestCheckHook
45 ];
46 propagatedBuildInputs = [ pkgs.parted ];
47
48 meta = with lib; {
49 homepage = "https://github.com/dcantrell/pyparted/";
50 description = "Python interface for libparted";
51 license = licenses.gpl2Plus;
52 platforms = platforms.linux;
53 maintainers = with maintainers; [ lsix ];
54 };
55}