2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
python,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
isPy3k,
|
|
|
|
substituteAll,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
setuptools,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# native dependencies
|
|
|
|
openmp,
|
|
|
|
xsimd,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
ply,
|
|
|
|
gast,
|
|
|
|
numpy,
|
|
|
|
beniget,
|
2021-03-15 08:37:03 +00:00
|
|
|
}:
|
|
|
|
|
2021-07-17 21:14:59 +00:00
|
|
|
let
|
|
|
|
inherit (python) stdenv;
|
2024-06-05 15:53:02 +00:00
|
|
|
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;
|
2024-06-05 15:53:02 +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-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2024-01-13 08:15:51 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|