1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cmake,
8 nanobind,
9 ninja,
10 pcpp,
11 scikit-build,
12 setuptools,
13
14 # buildInputs
15 isl,
16
17 # tests
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "islpy";
23 version = "2024.2";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "inducer";
28 repo = "islpy";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-ixw9U4WqcXBW6KGBOsUImjsxmvG5XKCv4jCbTjJ4pjg=";
31 };
32
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace-fail "setuptools>=42,<64;python_version<'3.12'" "setuptools>=42"
36 '';
37
38 build-system = [
39 cmake
40 nanobind
41 ninja
42 pcpp
43 scikit-build
44 setuptools
45 ];
46
47 buildInputs = [ isl ];
48
49 dontUseCmakeConfigure = true;
50
51 preConfigure = ''
52 python ./configure.py \
53 --no-use-shipped-isl \
54 --isl-inc-dir=${lib.getDev isl}/include \
55 '';
56
57 # Force resolving the package from $out to make generated ext files usable by tests
58 preCheck = ''
59 mv islpy islpy.hidden
60 '';
61
62 nativeCheckInputs = [ pytestCheckHook ];
63
64 pythonImportsCheck = [ "islpy" ];
65
66 meta = {
67 description = "Python wrapper around isl, an integer set library";
68 homepage = "https://github.com/inducer/islpy";
69 license = lib.licenses.mit;
70 maintainers = with lib.maintainers; [ tomasajt ];
71 };
72}