1{ lib
2, python
3, buildPythonPackage
4, fetchFromGitHub
5, openmp
6, ply
7, gast
8, numpy
9, beniget
10, xsimd
11, isPy3k
12, substituteAll
13}:
14
15let
16 inherit (python) stdenv;
17
18in buildPythonPackage rec {
19 pname = "pythran";
20 version = "0.13.1";
21
22 src = fetchFromGitHub {
23 owner = "serge-sans-paille";
24 repo = "pythran";
25 rev = version;
26 hash = "sha256-baDrReJgQXbaKA8KNhHiFjr0X34yb8WK/nUJmiM9EZs=";
27 };
28
29 patches = [
30 # Hardcode path to mp library
31 (substituteAll {
32 src = ./0001-hardcode-path-to-libgomp.patch;
33 gomp = "${if stdenv.cc.isClang then openmp else stdenv.cc.cc.lib}/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}";
34 })
35 ];
36
37 # xsimd: unvendor this header-only C++ lib
38 postPatch = ''
39 rm -r third_party/xsimd
40 ln -s '${lib.getDev xsimd}'/include/xsimd third_party/
41 '';
42
43 propagatedBuildInputs = [
44 ply
45 gast
46 numpy
47 beniget
48 ];
49
50 pythonImportsCheck = [
51 "pythran"
52 "pythran.backend"
53 "pythran.middlend"
54 "pythran.passmanager"
55 "pythran.toolchain"
56 "pythran.spec"
57 ];
58
59 # Test suite is huge and has a circular dependency on scipy.
60 doCheck = false;
61
62 disabled = !isPy3k;
63
64 meta = {
65 description = "Ahead of Time compiler for numeric kernels";
66 homepage = "https://github.com/serge-sans-paille/pythran";
67 license = lib.licenses.bsd3;
68 };
69}