1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 distutils,
6 fetchFromGitHub,
7 liberasurecode,
8 pytestCheckHook,
9 setuptools,
10 six,
11}:
12
13buildPythonPackage rec {
14 pname = "pyeclib";
15 version = "1.6.4";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "openstack";
20 repo = "pyeclib";
21 tag = version;
22 hash = "sha256-oRitXlQunfqLSKMaSW3E1BnL0otA4UPj/y6bbiN0kPM=";
23 };
24
25 postPatch = ''
26 # python's platform.platform() doesn't return "Darwin" (anymore?)
27 substituteInPlace setup.py \
28 --replace-fail '"Darwin"' '"macOS"'
29 '';
30
31 build-system = [
32 distutils
33 setuptools
34 ];
35
36 preBuild =
37 let
38 ldLibraryPathEnvName =
39 if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
40 in
41 ''
42 # required for the custom _find_library function in setup.py
43 export ${ldLibraryPathEnvName}="${lib.makeLibraryPath [ liberasurecode ]}"
44 '';
45
46 dependencies = [ liberasurecode ];
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 six
51 ];
52
53 disabledTests = [
54 # The memory usage goes *down* on Darwin, which the test confuses for an increase and fails
55 "test_get_metadata_memory_usage"
56 ];
57
58 pythonImportsCheck = [ "pyeclib" ];
59
60 meta = with lib; {
61 description = "This library provides a simple Python interface for implementing erasure codes";
62 homepage = "https://github.com/openstack/pyeclib";
63 license = licenses.bsd2;
64 teams = [ teams.openstack ];
65 };
66}