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