~ruther/guix-local

785775739b2c12447b564218d8d6f551c3097e5b — Nicolas Graves 3 months ago d3fe071
gnu: unknown-horizons: Switch to pyproject.

* gnu/packages/games.scm (unknown-horizons):
[source, arguments, inputs, license]: Improve style.
[arguments]<#:test-flags>: Ignore failing tests.
[build-system]: Switch to pyproject-build-system.
[native-inputs]: Add python-setuptools.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
1 files changed, 63 insertions(+), 63 deletions(-)

M gnu/packages/games.scm
M gnu/packages/games.scm => gnu/packages/games.scm +63 -63
@@ 5030,63 5030,62 @@ modes.")
  (package
    (name "unknown-horizons")
    (version "2019.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://codeload.github.com/unknown-horizons/"
                                  "unknown-horizons/tar.gz/" version))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "1n747p7h0qp48szgp262swg0xh8kxy1bw8ag1qczs4i26hyzs5x4"))
              (patches (search-patches "unknown-horizons-python-3.8-distro.patch"
                                       "unknown-horizons-python-3.9.patch"
                                       "unknown-horizons-python-3.10.patch"))))
    (build-system python-build-system)
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://codeload.github.com/unknown-horizons/"
                           "unknown-horizons/tar.gz/" version))
       (file-name (string-append name "-" version ".tar.gz"))
       (sha256
        (base32 "1n747p7h0qp48szgp262swg0xh8kxy1bw8ag1qczs4i26hyzs5x4"))
       (patches (search-patches "unknown-horizons-python-3.8-distro.patch"
                                "unknown-horizons-python-3.9.patch"
                                "unknown-horizons-python-3.10.patch"))))
    (build-system pyproject-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'build 'set-HOME
           (lambda _
             (setenv "HOME" "/tmp")
             #t))
         (add-after 'build 'build-extra
           (lambda _
             (invoke "python3" "./setup.py" "build_i18n")
             (invoke "python3" "horizons/engine/generate_atlases.py" "2048")
             #t))
         (add-after 'install 'patch
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (substitute* (string-append out "/bin/unknown-horizons")
                 (("os\\.chdir\\(get\\_content\\_dir\\_parent_path\\(\\)\\)")
                  (string-append "os.chdir(\""
                                 (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 _
             (substitute* "horizons/constants.py"
               (("IS_DEV_VERSION = False")
                "IS_DEV_VERSION = True"))
             (invoke "pytest" "tests")
             (substitute* "horizons/constants.py"
               (("IS_DEV_VERSION = True")
                "IS_DEV_VERSION = False"))
             #t)))))
     (list
      #:test-flags
      ;; 'tutorial' scenario not in the database.
      #~(list "-k" (string-join (list "not test_start_scenario_by_name"
                                      "test_start_scenario_by_path")
                                " and not "))
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'build 'set-HOME
            (lambda _
              (setenv "HOME" "/tmp")))
          (add-after 'build 'build-extra
            (lambda _
              (invoke "python3" "./setup.py" "build_i18n")
              (invoke "python3" "horizons/engine/generate_atlases.py" "2048")))
          (add-after 'install 'patch
            (lambda _
              (substitute* (string-append #$output "/bin/unknown-horizons")
                (("os\\.chdir\\(get\\_content\\_dir\\_parent_path\\(\\)\\)")
                 (string-append "os.chdir(\""
                                #$output "/share/unknown-horizons\")")))))
          (add-before 'check 'fix-tests-with-pytest>=4
            (lambda _
              (substitute* "tests/conftest.py"
                (("pytest_namespace")
                 "pytest_configure")
                (("get_marker")
                 "get_closest_marker"))))
          ;; TODO: Run GUI tests as well
          (replace 'check
            (lambda args
              (substitute* "horizons/constants.py"
                (("IS_DEV_VERSION = False")
                 "IS_DEV_VERSION = True"))
              (apply (assoc-ref %standard-phases 'check) args)
              (substitute* "horizons/constants.py"
                (("IS_DEV_VERSION = True")
                 "IS_DEV_VERSION = False")))))))
    (inputs
     `(("fifengine" ,fifengine)
       ("python:tk" ,python "tk")
       ("python-pillow" ,python-pillow)
       ("python-pyyaml" ,python-pyyaml)))
     (list fifengine
           (list python "tk")
           python-pillow
           python-pyyaml))
    (native-inputs
     (list intltool
           python-distro


@@ 5094,21 5093,22 @@ modes.")
           python-greenlet
           python-polib
           python-pytest
           python-pytest-mock))
           python-pytest-mock
           python-setuptools))
    (home-page "https://unknown-horizons.org/")
    (synopsis "Isometric realtime strategy, economy and city building simulation")
    (synopsis
     "Isometric realtime strategy, economy and city building simulation")
    (description
     "Unknown Horizons is a 2D realtime strategy simulation with an emphasis
on economy and city building.  Expand your small settlement to a strong and
wealthy colony, collect taxes and supply your inhabitants with valuable
goods.  Increase your power with a well balanced economy and with strategic
trade and diplomacy.")
    (license (list
              license:gpl2+        ; Covers code
              license:expat        ; tests/dummy.py, ext/polib.py
              license:cc-by-sa3.0  ; Covers some media content
              license:cc-by3.0     ; Covers some media content
              license:bsd-3))))    ; horizons/ext/speaklater.py
    (license (list license:gpl2+        ;Covers code
                   license:expat        ;tests/dummy.py, ext/polib.py
                   license:cc-by-sa3.0  ;Covers some media content
                   license:cc-by3.0     ;Covers some media content
                   license:bsd-3))))    ; horizons/ext/speaklater.py

(define-public gnujump
  (package