about summary refs log tree commit diff
path: root/pkgs/development/python-modules/scipy
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-08-18 12:16:55 +0300
committerFrederik Rietdijk <fridh@fridh.nl>2023-08-20 11:01:19 +0200
commit854302c4e666a3648f974d288e7a2bf3d79f953a (patch)
tree89e4d58556b533dabd335c2048bcb61f14e24130 /pkgs/development/python-modules/scipy
parent84503a6c46fe4c80c016d4fe28e4563da73dd491 (diff)
python3.pkgs.scipy: Fix some issues in update script
Diffstat (limited to 'pkgs/development/python-modules/scipy')
-rw-r--r--pkgs/development/python-modules/scipy/default.nix4
-rwxr-xr-xpkgs/development/python-modules/scipy/update.sh8
2 files changed, 6 insertions, 6 deletions
diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix
index 40448fc878970..ad5b032d0a438 100644
--- a/pkgs/development/python-modules/scipy/default.nix
+++ b/pkgs/development/python-modules/scipy/default.nix
@@ -33,9 +33,7 @@ let
   #
   #     nix-shell maintainers/scripts/update.nix --argstr package python3.pkgs.scipy
   #
-  # Even if you do update these hashes manually, don't change their base
-  # (base16 or base64), because the update script uses sed regexes to replace
-  # them with the updated hashes.
+  # The update script uses sed regexes to replace them with the updated hashes.
   version = "1.11.1";
   srcHash = "sha256-bgnYXe3EhzL7+Gfriz1cXCl2eYQJ8zF+rcIwHyZR8bQ=";
   datasetsHashes = {
diff --git a/pkgs/development/python-modules/scipy/update.sh b/pkgs/development/python-modules/scipy/update.sh
index b0d6e2da4f41d..c6b3dca491864 100755
--- a/pkgs/development/python-modules/scipy/update.sh
+++ b/pkgs/development/python-modules/scipy/update.sh
@@ -16,10 +16,12 @@ if grep -q 'version = "'$version $fname; then
     echo "Current version $version is the latest available, will update only datasets' hashes (don't take long)"
 else
     echoerr got version $version
-    sed -i -E 's/(version = ).*=/\1'$version'/g' $fname
+    sed -i -E 's/(version = ").*(";)/\1'$version'\2/g' $fname
+    # Verify the sed command above did not fail
+    grep -q $version $fname
     # Update srcHash
-    srcHash='"sha256-'$(nix-prefetch-github scipy scipy --rev v${version} --fetch-submodules | jq --raw-output .sha256)'"'
-    sed -i 's/srcHash = .*=";/srcHash = '$srcHash';/g' $fname
+    srcHash="$(nix-prefetch-github scipy scipy --rev v${version} --fetch-submodules | jq --raw-output .hash)"
+    sed -i -E 's#(srcHash = ").*(";)#\1'$srcHash'\2#g' $fname
 fi
 
 for d in $datasets; do