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