2021-03-15 08:37:03 +00:00
|
|
|
{ lib
|
2021-07-17 21:14:59 +00:00
|
|
|
, python
|
2021-03-15 08:37:03 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2024-01-13 08:15:51 +00:00
|
|
|
, fetchpatch
|
|
|
|
, isPy3k
|
|
|
|
, substituteAll
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# native dependencies
|
2021-09-18 10:52:07 +00:00
|
|
|
, openmp
|
2024-01-13 08:15:51 +00:00
|
|
|
, xsimd
|
|
|
|
|
|
|
|
# dependencies
|
2021-03-15 08:37:03 +00:00
|
|
|
, ply
|
|
|
|
, gast
|
|
|
|
, numpy
|
|
|
|
, beniget
|
|
|
|
}:
|
|
|
|
|
2021-07-17 21:14:59 +00:00
|
|
|
let
|
|
|
|
inherit (python) stdenv;
|
|
|
|
|
|
|
|
in buildPythonPackage rec {
|
2021-03-15 08:37:03 +00:00
|
|
|
pname = "pythran";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "0.15.0";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2021-03-15 08:37:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "serge-sans-paille";
|
|
|
|
repo = "pythran";
|
|
|
|
rev = version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-TpD8YZnnv48PKYrUqR0/qvJG1XRbcMBcrkcERh6Q4q0=";
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
|
2021-07-17 21:14:59 +00:00
|
|
|
patches = [
|
|
|
|
# Hardcode path to mp library
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0001-hardcode-path-to-libgomp.patch;
|
2021-09-18 10:52:07 +00:00
|
|
|
gomp = "${if stdenv.cc.isClang then openmp else stdenv.cc.cc.lib}/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2021-07-17 21:14:59 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
# xsimd: unvendor this header-only C++ lib
|
|
|
|
postPatch = ''
|
2024-01-25 14:12:00 +00:00
|
|
|
rm -r pythran/xsimd
|
|
|
|
ln -s '${lib.getDev xsimd}'/include/xsimd pythran/
|
2023-08-10 07:59:29 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2021-03-15 08:37:03 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
ply
|
|
|
|
gast
|
|
|
|
numpy
|
|
|
|
beniget
|
2024-01-13 08:15:51 +00:00
|
|
|
setuptools
|
2021-03-15 08:37:03 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pythran"
|
|
|
|
"pythran.backend"
|
|
|
|
"pythran.middlend"
|
|
|
|
"pythran.passmanager"
|
|
|
|
"pythran.toolchain"
|
|
|
|
"pythran.spec"
|
|
|
|
];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
# Test suite is huge and has a circular dependency on scipy.
|
2021-03-15 08:37:03 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
disabled = !isPy3k;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Ahead of Time compiler for numeric kernels";
|
2021-07-17 21:14:59 +00:00
|
|
|
homepage = "https://github.com/serge-sans-paille/pythran";
|
2021-03-15 08:37:03 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2024-01-25 14:12:00 +00:00
|
|
|
maintainers = with lib.maintainers; [ doronbehar ];
|
2021-03-15 08:37:03 +00:00
|
|
|
};
|
|
|
|
}
|