1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

games/pysolfc: Fix runtime issues with Python 3.8+

* The deprecated function "time.clock()" has been removed in Python 3.8
  and "time.perf_counter()" should be used instead.

  Because updating to a newer version of PySolFC requires a bit more
  work, use a backport for now to remedy the runtime issues.

* Bump PORTREVISION due changed package contents.

PR:		256504
Reported by:	<sven.a.jonsson@bahnhof.se>
MFH:		2021Q2

(cherry picked from commit 91cf304355)
This commit is contained in:
Kai Knoblich 2021-06-30 10:31:41 +02:00
parent e34785f48f
commit cb3b365038
2 changed files with 22 additions and 1 deletions

View File

@ -1,7 +1,7 @@
PORTNAME= pysolfc
DISTVERSION= 2.6.4
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= games python
MASTER_SITES= SF/${PORTNAME}/PySolFC/${PYSOLFCDIR} \
SF/${PORTNAME}/PySolFC-Cardsets/${CARDSETDIR}:cardsets

View File

@ -0,0 +1,21 @@
Fix runtime errors with Python 3.8+ because the function time.clock() has been
removed in Python 3.8, after having been deprecated since Python 3.3.
Obtained from:
https://github.com/shlomif/PySolFC/commit/0961401105850a18ff129e2c25cfffae45a81752
--- pysollib/mfxutil.py.orig 2021-06-09 18:23:28 UTC
+++ pysollib/mfxutil.py
@@ -143,7 +143,11 @@ def getprefdir(package):
# high resolution clock() and sleep()
-uclock = time.clock
+try:
+ uclock = time.perf_counter
+except Exception:
+ uclock = time.clock
+
usleep = time.sleep
if os.name == "posix":
uclock = time.time