1{
2 lib,
3 buildPythonPackage,
4 cython,
5 numpy,
6 libdynd,
7 fetchpatch,
8 cmake,
9 fetchFromGitHub,
10 pythonAtLeast,
11}:
12
13buildPythonPackage rec {
14 version = "0.7.2";
15 format = "setuptools";
16 pname = "dynd";
17
18 disabled = pythonAtLeast "3.11";
19
20 src = fetchFromGitHub {
21 owner = "libdynd";
22 repo = "dynd-python";
23 rev = "v${version}";
24 sha256 = "19igd6ibf9araqhq9bxmzbzdz05vp089zxvddkiik3b5gb7l17nh";
25 };
26
27 patches = [
28 # Fix numpy compatibility
29 # https://github.com/libdynd/dynd-python/issues/746
30 (fetchpatch {
31 url = "https://aur.archlinux.org/cgit/aur.git/plain/numpy-compatibility.patch?h=python-dynd&id=e626acabd041069861311f314ac3dbe9e6fd24b7";
32 sha256 = "sha256-oA/3G8CGeDhiYXbNX+G6o3QSb7rkKItuCDCbnK3Rt10=";
33 name = "numpy-compatibility.patch";
34 })
35 ];
36
37 # setup.py invokes git on build but we're fetching a tarball, so
38 # can't retrieve git version. We hardcode:
39 preConfigure = ''
40 substituteInPlace setup.py --replace "ver = check_output(['git', 'describe', '--dirty'," "ver = '${version}'"
41 substituteInPlace setup.py --replace "'--always', '--match', 'v*']).decode('ascii').strip('\n')" ""
42 '';
43
44 dontUseCmakeConfigure = true;
45
46 nativeBuildInputs = [ cmake ];
47
48 buildInputs = [
49 cython
50 libdynd.dev
51 ];
52
53 propagatedBuildInputs = [
54 libdynd
55 numpy
56 ];
57
58 # ModuleNotFoundError: No module named 'dynd.config'
59 doCheck = false;
60
61 pythonImportsCheck = [ "dynd" ];
62
63 meta = with lib; {
64 homepage = "http://libdynd.org";
65 license = licenses.bsd2;
66 description = "Python exposure of dynd";
67 maintainers = with maintainers; [ teh ];
68 };
69}