singularity: avoid crash when using numpy 2.x. (#11598)

Patch follows the upstream fix. Works with both numpy 1.x and 2.x now.
This commit is contained in:
OscarL
2025-01-07 10:32:48 -03:00
committed by GitHub
parent 9fa75795f2
commit 2eb61121a2
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
From 48799c6eccab89fc02289d7c0a79bf7fe0262328 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Tue, 7 Jan 2025 09:14:54 -0300
Subject: Fix crash with numpy 2.x
Slightly modified from an upstream fix.
diff --git a/singularity/code/buyable.py b/singularity/code/buyable.py
index 57111db..fa16136 100644
--- a/singularity/code/buyable.py
+++ b/singularity/code/buyable.py
@@ -183,7 +183,7 @@ class Buyable(object):
# And apply it.
was_complete = self.cost_paid
- cost_paid = numpy.maximum(numpy.cast[int64](numpy.round(raw_paid)),
+ cost_paid = numpy.maximum(numpy.asarray(numpy.round(raw_paid), dtype=int64),
was_complete)
spent = cost_paid - was_complete
return spent, cost_paid
--
2.45.2

View File

@@ -5,13 +5,14 @@ have a chance."
HOMEPAGE="https://singularity.github.io/"
COPYRIGHT="2005-2023 EMH Software, Singularity community"
LICENSE="GNU GPL v2"
REVISION="4"
REVISION="5"
srcGitTag="1.00"
musicVersion="007"
SOURCE_URI="https://github.com/singularity/singularity/archive/v$portVersion.tar.gz"
SOURCE_URI_2="https://www.emhsoft.com/singularity/endgame-singularity-music-$musicVersion.zip"
CHECKSUM_SHA256="5e747268d9e96e69adace1f346fe40d0c3ec05764b98e82cc3ab0335d96d9171"
CHECKSUM_SHA256_2="eb5a3c2730731fda0cc7861977cd97937950b85d3fe08bc431054a639cc2c26d"
PATCHES="singularity-1.00.patchset"
ADDITIONAL_FILES="singularity.rdef.in"
ARCHITECTURES="any"