diff --git a/pkgs/development/python-modules/brian2/0001-remove-invalidxyz.patch b/pkgs/development/python-modules/brian2/0001-remove-invalidxyz.patch new file mode 100644 index 000000000000..435e3d12cacc --- /dev/null +++ b/pkgs/development/python-modules/brian2/0001-remove-invalidxyz.patch @@ -0,0 +1,27 @@ +From dbf0af29767629def355427cf63410158708c632 Mon Sep 17 00:00:00 2001 +From: Bot_wxt1221 <3264117476@qq.com> +Date: Wed, 13 Nov 2024 21:15:04 +0800 +Subject: [PATCH] Update test_codegen.py + +--- + brian2/tests/test_codegen.py | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/brian2/tests/test_codegen.py b/brian2/tests/test_codegen.py +index fdc03cdf2..6f7ae50bd 100644 +--- a/brian2/tests/test_codegen.py ++++ b/brian2/tests/test_codegen.py +@@ -589,13 +589,6 @@ def test_cpp_flags_support(): + _, compile_args = get_compiler_and_args() + assert compile_args == prefs["codegen.cpp.extra_compile_args"] + +- # Should never be supported and raise a warning +- prefs["codegen.cpp.extra_compile_args"] = ["-invalidxyz"] +- with catch_logs() as l: +- _, compile_args = get_compiler_and_args() +- assert len(l) == 1 and l[0][0] == "WARNING" +- assert compile_args == [] +- + prefs["codegen.cpp.extra_compile_args"] = old_prefs + + diff --git a/pkgs/development/python-modules/brian2/default.nix b/pkgs/development/python-modules/brian2/default.nix index a0021585cfc5..d9f23ec574b1 100644 --- a/pkgs/development/python-modules/brian2/default.nix +++ b/pkgs/development/python-modules/brian2/default.nix @@ -9,8 +9,12 @@ setuptools, sympy, pytest, + pythonOlder, pytest-xdist, + setuptools-scm, python, + scipy, + fetchpatch, }: buildPythonPackage rec { @@ -18,12 +22,33 @@ buildPythonPackage rec { version = "2.7.1"; pyproject = true; + # https://github.com/python/cpython/issues/117692 + disabled = pythonOlder "3.12"; + src = fetchPypi { inherit pname version; hash = "sha256-mp1xo6ooYm21s6FYcegQdsHmVgH81usV9IfIM0GM7lc="; }; - build-system = [ setuptools ]; + patches = [ + (fetchpatch { + url = "https://github.com/brian-team/brian2/commit/8ed663cafde42cbe2e0171cb19d2217e01676d20.patch"; + hash = "sha256-+s5SJdJmsnee3sWhaj/jwf8RXkfMrLp0aTWF52jLdqU="; + }) + ./0001-remove-invalidxyz.patch # invalidxyz are reported as error so I remove it + ]; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "numpy>=2.0.0rc1" "numpy" + + substituteInPlace brian2/codegen/cpp_prefs.py \ + --replace-fail "distutils" "setuptools._distutils" + ''; + + build-system = [ + setuptools-scm + ]; dependencies = [ cython @@ -32,6 +57,7 @@ buildPythonPackage rec { pyparsing setuptools sympy + scipy ]; nativeCheckInputs = [ @@ -47,10 +73,10 @@ buildPythonPackage rec { runHook postCheck ''; - meta = with lib; { + meta = { description = "Clock-driven simulator for spiking neural networks"; homepage = "https://briansimulator.org/"; - license = licenses.cecill21; - maintainers = with maintainers; [ jiegec ]; + license = lib.licenses.cecill21; + maintainers = with lib.maintainers; [ jiegec ]; }; }