summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2020-08-19 23:01:56 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2020-08-19 23:02:26 +0200
commit4c7d16c5516211f73cef06b39ade8022acb96f23 (patch)
treef43543ad982e021e98a4a1e5bd911e9ed46b6d68 /gnu
parent5c83e8ec111f30c3754107ac0ec6fa4db5411fb8 (diff)
downloadguix-4c7d16c5516211f73cef06b39ade8022acb96f23.tar.gz
gnu: unknown-horizons: Fix build with python@3.8 and python-pytest@5.
* gnu/packages/games.scm (unknown-horizons)[source]: Add patch.
[arguments]: Add a ‘fix-tests-with-pytest>=4’ phase.
[native-inputs]: Add python-distro.
* gnu/packages/patches/unknown-horizons-python-3.8-distro.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/games.scm12
-rw-r--r--gnu/packages/patches/unknown-horizons-python-3.8-distro.patch52
3 files changed, 64 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 44680da70b..4d1c7f366b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1616,6 +1616,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ucx-tcp-iface-ioctl.patch		\
   %D%/packages/patches/udiskie-no-appindicator.patch		\
   %D%/packages/patches/ungoogled-chromium-system-nspr.patch	\
+  %D%/packages/patches/unknown-horizons-python-3.8-distro.patch	\
   %D%/packages/patches/unzip-CVE-2014-8139.patch		\
   %D%/packages/patches/unzip-CVE-2014-8140.patch		\
   %D%/packages/patches/unzip-CVE-2014-8141.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index a789fced63..0f01267827 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3541,7 +3541,8 @@ also available.")
               (file-name (string-append name "-" version ".tar.gz"))
               (sha256
                (base32
-                "1n747p7h0qp48szgp262swg0xh8kxy1bw8ag1qczs4i26hyzs5x4"))))
+                "1n747p7h0qp48szgp262swg0xh8kxy1bw8ag1qczs4i26hyzs5x4"))
+              (patches (search-patches "unknown-horizons-python-3.8-distro.patch"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
@@ -3564,6 +3565,14 @@ also available.")
                                  (assoc-ref outputs "out")
                                  "/share/unknown-horizons\")"))))
              #t))
+         (add-before 'check 'fix-tests-with-pytest>=4
+           (lambda _
+             (substitute* "tests/conftest.py"
+               (("pytest_namespace")
+                "pytest_configure")
+               (("get_marker")
+                "get_closest_marker"))
+             #t))
          ;; TODO: Run GUI tests as well
          (replace 'check
            (lambda _
@@ -3582,6 +3591,7 @@ also available.")
        ("python-pyyaml" ,python-pyyaml)))
     (native-inputs
      `(("intltool" ,intltool)
+       ("python-distro" ,python-distro)
 
        ;; Required for tests
        ("python-greenlet" ,python-greenlet)
diff --git a/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch b/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch
new file mode 100644
index 0000000000..d43a4f3e4a
--- /dev/null
+++ b/gnu/packages/patches/unknown-horizons-python-3.8-distro.patch
@@ -0,0 +1,52 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Wed, 19 Aug 2020 22:58:32 +0200
+Subject: [PATCH] gnu: unknown-horizons: Replace ‘dist’ with ‘distro’.
+
+This fixes builds with Python >= 3.8.  Taken verbatim from upstream[0].
+
+[0]: https://github.com/unknown-horizons/unknown-horizons/commit/c40fb866f3f72ac1049d6fa7859b17d8a48fe9e1
+
+From c40fb866f3f72ac1049d6fa7859b17d8a48fe9e1 Mon Sep 17 00:00:00 2001
+From: MarkusHackspacher <hackspacher@gmx.de>
+Date: Thu, 18 Jul 2019 11:46:39 +0200
+Subject: [PATCH] replace deprecated to distro package
+
+---
+ requirements.txt | 1 +
+ setup.py         | 4 +++-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/requirements.txt b/requirements.txt
+index a5edf794fb..b58179bfa8 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -1,6 +1,7 @@
+ coverage==4.4.1
+ coveralls==1.1
+ crayons==0.1.2
++distro
+ future==0.16.0
+ greenlet==0.4.15
+ isort==4.3.4
+diff --git a/setup.py b/setup.py
+index 6d63a5ce15..6a237a8749 100755
+--- a/setup.py
++++ b/setup.py
+@@ -32,6 +32,8 @@
+ from distutils.spawn import find_executable
+ from shutil import copytree, rmtree
+ 
++import distro
++
+ import horizons
+ from horizons.constants import VERSION
+ from horizons.ext import polib
+@@ -39,7 +41,7 @@
+ # Ensure we are in the correct directory
+ os.chdir(os.path.realpath(os.path.dirname(__file__)))
+ 
+-if platform.dist()[0].lower() in ('debian', 'ubuntu'):
++if distro.linux_distribution(full_distribution_name=False)[0] in ('debian', 'mint', 'ubuntu'):
+ 	executable_path = 'games'
+ else:
+ 	executable_path = 'bin'