1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: python-nbt: Fix build; add tests.

* gnu/packages/game-development.scm (python-nbt-testdata): New variable.
* gnu/packages/game-development.scm (python-nbt): Fix build; add tests.
[source]: Switch to git-fetch.
[build-system]: Switch to pyproject-build-system.
[arguments]<#:phases>: Add 'fake-download phase.
<#:test-flags>: List specific files to test.
[native-inputs]: Add python-pytest and python-setuptools.

Change-Id: I1579b0fe6d3cbe06b279c7b78f4834b6e9b849ba
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>

aa

Change-Id: I02b49dca10d5bc39a585b1916434f53b8b96fbd0
This commit is contained in:
Hugo Buddelmeijer
2025-12-17 23:16:44 +01:00
committed by Sharlatan Hellseher
parent 36d7c88fb4
commit 9643da0abe

View File

@@ -591,17 +591,54 @@ types (revolute, prismatic, wheel, etc.).")
(description "This package provides an Anvil file format parser.")
(license license:expat))))
;;~4MiB of test files.
(define python-nbt-testdata
(file-union
"python-nbt-testdata"
(list
(let ((file "Sample_World.tar.gz"))
`(,file
,(origin
(method url-fetch)
(uri (string-append
"https://github.com/twoolie/NBT/files/13199373/"
file))
(sha256
(base32
"1s58g5zicx8ghdai2qix2aqq0fc675vfajica4h78c397crwjrl9"))))))))
(define-public python-nbt
(package
(name "python-nbt")
(version "1.5.1")
(source (origin
(method url-fetch)
(uri (pypi-uri "NBT" version))
(sha256
(base32
"1i9ncrzy5zcfnxzkh2j31n9ayzxfncckzwa6fkz9vjq5fq9v4fys"))))
(build-system python-build-system)
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/twoolie/NBT")
(commit (string-append "version-" version))))
(file-name (git-file-name name version))
(sha256
(base32 "1a3mj7c18m1n5iqzwwvvlk7n65kxp3xbmccsqyap36apwpbbxyd9"))))
(build-system pyproject-build-system)
(arguments
(list
#:test-flags
#~(list "tests/regiontests.py" "tests/nbttests.py")
#:phases
#~(modify-phases %standard-phases
(add-before 'check 'fake-download
;; Fake the download of the test tarball.
(lambda _
(substitute*
"tests/downloadsample.py"
(("tar_file = .*")
(string-append
"tar_file = '"
#+python-nbt-testdata
"/Sample_World.tar.gz'"))))))))
(native-inputs
(list python-pytest python-setuptools))
(home-page "https://github.com/twoolie/NBT")
(synopsis "Named Binary Tag reader and writer")
(description