MysticMine is one of the few remaining ports that still depends on pyrex.

However, I'm not sure if anyone has actually fired up this game in some 
time. When I try it, it just errors out:

    NameError: name 'languages' is not defined

(Maybe some of the locale changes in base may have broken this game at 
some point?)

So the diff below does a few things:

1) use cython instead of pyrex as a BDEP. Luckily this seems to work given 
the close history between pyrex and cython. (Another choice, since the 
game is unlikely to get updates, would have been to pre-generate the ai.c 
file and include it in the port).

2) pyrex was removed as a RDEP and not replaced by cython. It wasn't 
obvious to me why it was needed as an RDEP in the first place.

3) to test the game, fix the locale-related issue with the simplest diff I 
could think of.

4) may as well update to the latest github commit from July 2016 which 
says support for game controllers was added.

Was able to play a few round on my amd64 box with the below.

ok?

diff -Nur mysticmine/Makefile mysticmine.new/Makefile
--- mysticmine/Makefile Fri Jul 12 16:46:21 2019
+++ mysticmine.new/Makefile     Sat Oct 17 02:14:24 2020
@@ -7,8 +7,8 @@
 
 GH_ACCOUNT =   koonsolo
 GH_PROJECT =   MysticMine
-GH_COMMIT =    f8354135984e83071d17396d846d7fa91fef1631
-REVISION =     0
+GH_COMMIT =    2fc0a5eaa0ab299c3a23ce17ae1c56a98055a44c
+REVISION =     1
 
 CATEGORIES =   games
 
@@ -18,9 +18,8 @@
 WANTLIB =              pthread ${MODPY_WANTLIB}
 
 MODULES =              lang/python
-BUILD_DEPENDS =                devel/pyrex
-RUN_DEPENDS =          devel/pygame \
-                       devel/pyrex
+BUILD_DEPNDS =         lang/cython
+RUN_DEPENDS =          devel/pygame
 
 NO_TEST =              Yes
 
diff -Nur mysticmine/distinfo mysticmine.new/distinfo
--- mysticmine/distinfo Sat May  6 11:10:17 2017
+++ mysticmine.new/distinfo     Sat Oct 17 01:41:34 2020
@@ -1,2 +1,2 @@
-SHA256 (mysticmine-1.2.0-f8354135.tar.gz) = 
J/uEyoJZpgwFr629QwnVBEiR+37aXmVD6oUEmEFXMVo=
-SIZE (mysticmine-1.2.0-f8354135.tar.gz) = 19285995
+SHA256 (mysticmine-1.2.0-2fc0a5ea.tar.gz) = 
tlpvuSWWvzcgW8f+Z8vfE8aEOMJplDw0RTxpnS40wg8=
+SIZE (mysticmine-1.2.0-2fc0a5ea.tar.gz) = 19286277
diff -Nur mysticmine/patches/patch-monorail_monorail_py 
mysticmine.new/patches/patch-monorail_monorail_py
--- mysticmine/patches/patch-monorail_monorail_py       Wed Dec 31 19:00:00 1969
+++ mysticmine.new/patches/patch-monorail_monorail_py   Sat Oct 17 02:19:44 2020
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix for https://github.com/dewitters/MysticMine/issues/16
+
+Index: monorail/monorail.py
+--- monorail/monorail.py.orig
++++ monorail/monorail.py
+@@ -41,6 +41,8 @@ DEFAULT_LANGUAGES += ['en_US']
+ lc, encoding = locale.getdefaultlocale()
+ if lc:
+     languages = [lc]
++else:
++    languages = []
+ 
+ languages += DEFAULT_LANGUAGES
+ mo_location = LOCALE_DIR
diff -Nur mysticmine/patches/patch-setup_py 
mysticmine.new/patches/patch-setup_py
--- mysticmine/patches/patch-setup_py   Wed Dec 31 19:00:00 1969
+++ mysticmine.new/patches/patch-setup_py       Sat Oct 17 02:09:10 2020
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Index: setup.py
+--- setup.py.orig
++++ setup.py
+@@ -1,6 +1,6 @@
+ from distutils.core import Extension, setup
+ from distutils.command.install import INSTALL_SCHEMES
+-from Pyrex.Distutils import build_ext
++from Cython.Distutils import build_ext
+ import os
+ 
+ # 
http://stackoverflow.com/questions/1612733/including-non-python-files-with-setup-py
+@@ -52,6 +52,5 @@ setup( name='MysticMine',
+     requires=[
+         "pygame",
+         "numpy",
+-        "pyrex",
+     ],
+ )
diff -Nur mysticmine/pkg/PLIST mysticmine.new/pkg/PLIST
--- mysticmine/pkg/PLIST        Thu Jun  2 07:33:07 2016
+++ mysticmine.new/pkg/PLIST    Sat Oct 17 01:42:14 2020
@@ -4,7 +4,7 @@
 lib/python${MODPY_VERSION}/site-packages/monorail/
 lib/python${MODPY_VERSION}/site-packages/monorail/__init__.py
 lib/python${MODPY_VERSION}/site-packages/monorail/__init__.pyc
-lib/python${MODPY_VERSION}/site-packages/monorail/ai.so
+@so lib/python${MODPY_VERSION}/site-packages/monorail/ai.so
 lib/python${MODPY_VERSION}/site-packages/monorail/control.py
 lib/python${MODPY_VERSION}/site-packages/monorail/control.pyc
 lib/python${MODPY_VERSION}/site-packages/monorail/controlview.py

Reply via email to