Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, buildPythonPackage, fetchPypi, liberasurecode, six }:
2
3buildPythonPackage rec {
4 pname = "pyeclib";
5 version = "1.6.0";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "sha256-gBHjHuia5/uZymkWZgyH4BCEZqmWK9SXowAQIJdOO7E=";
10 };
11
12 postPatch = ''
13 # patch dlopen call
14 substituteInPlace src/c/pyeclib_c/pyeclib_c.c \
15 --replace "liberasurecode.so" "${liberasurecode}/lib/liberasurecode.so"
16 # python's platform.platform() doesn't return "Darwin" (anymore?)
17 substituteInPlace setup.py \
18 --replace '"Darwin"' '"macOS"'
19 '';
20
21 preBuild = let
22 ldLibraryPathEnvName = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
23 in ''
24 # required for the custom _find_library function in setup.py
25 export ${ldLibraryPathEnvName}="${lib.makeLibraryPath [ liberasurecode ]}"
26 '';
27
28 buildInputs = [ liberasurecode ];
29
30 checkInputs = [ six ];
31
32 pythonImportsCheck = [ "pyeclib" ];
33
34 meta = with lib; {
35 description = "This library provides a simple Python interface for implementing erasure codes.";
36 homepage = "https://github.com/openstack/pyeclib";
37 license = licenses.bsd2;
38 maintainers = teams.openstack.members;
39 };
40}