Skip to content

Commit

Permalink
Merge pull request #231679 from CedricFinance/brian2-zhf-fix
Browse files Browse the repository at this point in the history
python311Packages.brian2: add patch to fix deprecated numpy types
  • Loading branch information
RaitoBezarius authored May 17, 2023
2 parents 415745e + be9c774 commit a4b47b6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkgs/development/python-modules/brian2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ buildPythonPackage rec {
hash = "sha256-x1EcS7PFCsjPYsq3Lt87SJRW4J5DE/OfdFs3NuyHiLw=";
};

patches = [
# Fix deprecated numpy types
# https://sources.debian.org/data/main/b/brian/2.5.1-3/debian/patches/numpy1.24.patch
./numpy1.24.patch
];

propagatedBuildInputs = [
cython
jinja2
Expand Down
18 changes: 18 additions & 0 deletions pkgs/development/python-modules/brian2/numpy1.24.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Description: Remove deprecated use of np.float
Author: Marcel Stimberg <marcel.stimberg@inserm.fr>
Bug-Debian: https://bugs.debian.org/1027193
Applied-Upstream: 61ef84b316a3d0a892298adf51abd8ac50900758
Last-Update: 2023-01-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- brian.orig/brian2/units/fundamentalunits.py
+++ brian/brian2/units/fundamentalunits.py
@@ -1597,7 +1597,7 @@
unitless = np.array(self / best_unit, copy=False)
threshold = np.get_printoptions()['threshold'] // 100
if unitless.ndim == 0:
- sympy_quantity = np.float(unitless)
+ sympy_quantity = float(unitless)
elif unitless.ndim == 1:
array_str = np.array2string(unitless, separator=" & ", threshold=threshold,
max_line_width=sys.maxsize)

0 comments on commit a4b47b6

Please sign in to comment.