nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python,
4 buildPythonPackage,
5 fetchFromGitHub,
6 replaceVars,
7
8 # build-system
9 setuptools,
10
11 # native dependencies
12 openmp,
13 xsimd,
14
15 # dependencies
16 ply,
17 gast,
18 numpy,
19 beniget,
20}:
21
22let
23 inherit (python) stdenv;
24in
25buildPythonPackage rec {
26 pname = "pythran";
27 version = "0.18.1";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "serge-sans-paille";
32 repo = "pythran";
33 tag = version;
34 hash = "sha256-H13FGApWCgBLWOtoZ5yEIV4Z+KAOK3Xs4KFM4oLmKmk=";
35 };
36
37 patches = [
38 # Hardcode path to mp library
39 (replaceVars ./0001-hardcode-path-to-libgomp.patch {
40 gomp = "${
41 if stdenv.cc.isClang then openmp else (lib.getLib stdenv.cc.cc)
42 }/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}";
43 })
44 ];
45
46 # xsimd: unvendor this header-only C++ lib
47 postPatch = ''
48 rm -r pythran/xsimd
49 ln -s '${lib.getDev xsimd}'/include/xsimd pythran/
50 '';
51
52 build-system = [ setuptools ];
53
54 dependencies = [
55 ply
56 gast
57 numpy
58 beniget
59 setuptools
60 ];
61
62 pythonRelaxDeps = [
63 "gast"
64 "beniget"
65 ];
66
67 pythonImportsCheck = [
68 "pythran"
69 "pythran.backend"
70 "pythran.middlend"
71 "pythran.passmanager"
72 "pythran.toolchain"
73 "pythran.spec"
74 ];
75
76 # Test suite is huge and has a circular dependency on scipy.
77 doCheck = false;
78
79 meta = {
80 changelog = "https://github.com/serge-sans-paille/pythran/blob/${src.tag}/Changelog";
81 description = "Ahead of Time compiler for numeric kernels";
82 homepage = "https://github.com/serge-sans-paille/pythran";
83 license = lib.licenses.bsd3;
84 maintainers = with lib.maintainers; [ doronbehar ];
85 };
86}