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.2";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "openstack";
20 repo = "pyeclib";
21 rev = "refs/tags/${version}";
22 hash = "sha256-LZQNJU7QEoHo+RWvHnQkNxBg6t322u/c3PyBhy1eVZc=";
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 pythonImportsCheck = [ "pyeclib" ];
54
55 meta = with lib; {
56 description = "This library provides a simple Python interface for implementing erasure codes";
57 homepage = "https://github.com/openstack/pyeclib";
58 license = licenses.bsd2;
59 maintainers = teams.openstack.members;
60 };
61}