diff options
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | 0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch | 30 | ||||
-rw-r--r-- | PKGBUILD | 34 |
3 files changed, 67 insertions, 5 deletions
@@ -1,13 +1,19 @@ pkgbase = python-nbt pkgdesc = Named Binary Tag Reader/Writer pkgver = 1.5.1 - pkgrel = 1 + pkgrel = 3 url = https://github.com/twoolie/NBT arch = any license = MIT + checkdepends = python-pillow makedepends = python-setuptools depends = python + noextract = Sample_World.tar.gz source = python-nbt-1.5.1.tar.gz::https://github.com/twoolie/NBT/archive/version-1.5.1.tar.gz + source = https://github.com/twoolie/NBT/files/13199373/Sample_World.tar.gz + source = 0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch sha256sums = 8b260dc68ed91819e990ca677ee05417e259145fb7531428a1f7b948d71367dc + sha256sums = 8966c9333b69307420512c4ae57639863980b1123d621155830f75167f79a8e8 + sha256sums = 4f16d8e0cdc6e29af972b52200c439e67626c4454d853f69a3001c58cec84b45 pkgname = python-nbt diff --git a/0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch b/0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch new file mode 100644 index 000000000000..af8e745a7a7e --- /dev/null +++ b/0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch @@ -0,0 +1,30 @@ +From dd91e56918ad8face6101637c3ba992d53e762f5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Steffen=20Kie=C3=9F?= + <steffen.kiess@cis.iti.uni-stuttgart.de> +Date: Wed, 25 Oct 2023 18:37:07 +0200 +Subject: [PATCH] Fix support for Minecraft version 1.12.2 (data version 1343) + +For data version 1343, the 'Blocks' key is needed. In +commit cd0133de7aa8b0023d80769e9fc6a1a78bd9fe57 the code was change to +no longer create an AnvilSection if there is no 'BlockStates' key. +Change this to also create an AnvilSection if there is a 'Blocks' key. +--- + nbt/chunk.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nbt/chunk.py b/nbt/chunk.py +index e0dd661..a59fcc0 100644 +--- a/nbt/chunk.py ++++ b/nbt/chunk.py +@@ -296,7 +296,7 @@ class AnvilChunk(Chunk): + self.sections = {} + if 'Sections' in self.chunk_data: + for s in self.chunk_data['Sections']: +- if "BlockStates" in s.keys(): # sections may only contain lighting information ++ if "BlockStates" in s.keys() or "Blocks" in s.keys(): # sections may only contain lighting information + self.sections[s['Y'].value] = AnvilSection(s, version) + + +-- +2.44.0 + @@ -4,15 +4,32 @@ _name=NBT pkgname=python-${_name,,} pkgver=1.5.1 -pkgrel=1 +pkgrel=3 pkgdesc="Named Binary Tag Reader/Writer" url="https://github.com/twoolie/$_name" depends=('python') makedepends=('python-setuptools') +checkdepends=('python-pillow') license=('MIT') arch=('any') -source=("$pkgname-$pkgver.tar.gz::$url/archive/version-$pkgver.tar.gz") -sha256sums=('8b260dc68ed91819e990ca677ee05417e259145fb7531428a1f7b948d71367dc') +source=("$pkgname-$pkgver.tar.gz::$url/archive/version-$pkgver.tar.gz" + # https://github.com/twoolie/NBT/blob/766daa242197a12317564c1b734308d31fb22b4f/tests/downloadsample.py#L23 + "$url/files/13199373/Sample_World.tar.gz" + '0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch') +noextract=('Sample_World.tar.gz') +sha256sums=('8b260dc68ed91819e990ca677ee05417e259145fb7531428a1f7b948d71367dc' + '8966c9333b69307420512c4ae57639863980b1123d621155830f75167f79a8e8' + '4f16d8e0cdc6e29af972b52200c439e67626c4454d853f69a3001c58cec84b45') + +prepare() { + cd "$_name-version-$pkgver" + + # fix regression in 1.5.1 + patch -Np1 -i "$srcdir/0001-Fix-support-for-Minecraft-version-1.12.2-data-versio.patch" + + # Python 3.12 + sed -Ei 's/(locale\.format)/\1_string/g' examples/{chest,mob}_analysis.py +} build() { cd "$_name-version-$pkgver" @@ -20,9 +37,18 @@ build() { python setup.py build } +check() { + cd "$_name-version-$pkgver" + + # use file downloaded by `makepkg` + ln -s "$srcdir/Sample_World.tar.gz" tests/ + + python tests/alltests.py +} + package() { cd "$_name-version-$pkgver" - python setup.py install --root="$pkgdir" --optimize=1 --skip-build + python setup.py install --root="$pkgdir" --optimize=1 install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } |