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