summarylogtreecommitdiffstats
diff options
context:
space:
mode:
author0x9fff002021-12-13 10:39:26 +0100
committer0x9fff002021-12-13 10:39:26 +0100
commit475a54d860a958629b27492b86080c78f8f85d9c (patch)
treeed9a81c3e3f3d759efc0f8be7ec23deb6368b468
parent59657f79491d39089e48265efc0c7a1de274c7f5 (diff)
downloadaur-475a54d860a958629b27492b86080c78f8f85d9c.tar.gz
Python 3.10 support
-rw-r--r--.SRCINFO9
-rw-r--r--0001-Update-nbt.py.patch25
-rw-r--r--0002-Update-region.py.patch25
-rw-r--r--0003-Use-collections.abc.patch46
-rw-r--r--PKGBUILD20
5 files changed, 120 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 03ee8c27fb3..59c31eb93e0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,19 @@
pkgbase = python-nbt
pkgdesc = Named Binary Tag Reader/Writer
pkgver = 1.5.0
- pkgrel = 3
+ pkgrel = 4
url = https://github.com/twoolie/NBT
arch = any
license = MIT
makedepends = python-setuptools
depends = python
source = python-nbt-1.5.0.tar.gz::https://github.com/twoolie/NBT/archive/version-1.5.0.tar.gz
+ source = 0001-Update-nbt.py.patch
+ source = 0002-Update-region.py.patch
+ source = 0003-Use-collections.abc.patch
sha256sums = 068111bf5d9e73156cd6d627b3d69c782e89af96e328dd7e91a971a453ba9951
+ sha256sums = 28a92ddc698cc8f17ab2628dd6ca1bf552bc96803d9891f9c04fc2feb2c866db
+ sha256sums = 13cff14b8e0584a67e20d7a0e9924a95e283ab64e10366cffff092b7c83201d5
+ sha256sums = e1931b3b9b0962bf88a8834be846accdc4fec9edccbd670b01506c6b8139c945
pkgname = python-nbt
-
diff --git a/0001-Update-nbt.py.patch b/0001-Update-nbt.py.patch
new file mode 100644
index 00000000000..4727a9107b4
--- /dev/null
+++ b/0001-Update-nbt.py.patch
@@ -0,0 +1,25 @@
+From e759d534d5a1be6dd5ce1958cdf2034325f970b9 Mon Sep 17 00:00:00 2001
+From: einekratzekatze <48450457+einekratzekatze@users.noreply.github.com>
+Date: Mon, 25 Oct 2021 18:39:35 +0200
+Subject: [PATCH 1/3] Update nbt.py
+
+---
+ nbt/nbt.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nbt/nbt.py b/nbt/nbt.py
+index f1c9bbb..feb6d00 100644
+--- a/nbt/nbt.py
++++ b/nbt/nbt.py
+@@ -7,7 +7,7 @@ https://minecraft.gamepedia.com/NBT_format
+
+ from struct import Struct, error as StructError
+ from gzip import GzipFile
+-from collections import MutableMapping, MutableSequence, Sequence
++from typing import MutableMapping, MutableSequence, Sequence
+ import sys
+
+ _PY3 = sys.version_info >= (3,)
+--
+2.34.1
+
diff --git a/0002-Update-region.py.patch b/0002-Update-region.py.patch
new file mode 100644
index 00000000000..c743946db39
--- /dev/null
+++ b/0002-Update-region.py.patch
@@ -0,0 +1,25 @@
+From d94409a4afdcdcc0f29fbf324eeacabc3843756a Mon Sep 17 00:00:00 2001
+From: einekratzekatze <48450457+einekratzekatze@users.noreply.github.com>
+Date: Mon, 25 Oct 2021 18:40:02 +0200
+Subject: [PATCH 2/3] Update region.py
+
+---
+ nbt/region.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nbt/region.py b/nbt/region.py
+index ada937a..d52b861 100644
+--- a/nbt/region.py
++++ b/nbt/region.py
+@@ -7,7 +7,7 @@ https://minecraft.gamepedia.com/Region_file_format
+
+ from .nbt import NBTFile, MalformedFileError
+ from struct import pack, unpack
+-from collections import Mapping
++from typing import Mapping
+ import zlib
+ import gzip
+ from io import BytesIO
+--
+2.34.1
+
diff --git a/0003-Use-collections.abc.patch b/0003-Use-collections.abc.patch
new file mode 100644
index 00000000000..bf24167f736
--- /dev/null
+++ b/0003-Use-collections.abc.patch
@@ -0,0 +1,46 @@
+From 25684c38ae82390ac5801a681cd459f882b093f2 Mon Sep 17 00:00:00 2001
+From: Freek Dijkstra <freek@macfreek.nl>
+Date: Tue, 26 Oct 2021 00:42:37 +0200
+Subject: [PATCH 3/3] Use collections.abc. With fall-back for outdated Pyton
+ 2.7 versions.
+
+---
+ nbt/nbt.py | 5 ++++-
+ nbt/region.py | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/nbt/nbt.py b/nbt/nbt.py
+index feb6d00..861a385 100644
+--- a/nbt/nbt.py
++++ b/nbt/nbt.py
+@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/NBT_format
+
+ from struct import Struct, error as StructError
+ from gzip import GzipFile
+-from typing import MutableMapping, MutableSequence, Sequence
++try:
++ from collections.abc import MutableMapping, MutableSequence, Sequence
++except ImportError: # for Python 2.7
++ from collections import MutableMapping, MutableSequence, Sequence
+ import sys
+
+ _PY3 = sys.version_info >= (3,)
+diff --git a/nbt/region.py b/nbt/region.py
+index d52b861..224099b 100644
+--- a/nbt/region.py
++++ b/nbt/region.py
+@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/Region_file_format
+
+ from .nbt import NBTFile, MalformedFileError
+ from struct import pack, unpack
+-from typing import Mapping
++try:
++ from collections.abc import Mapping
++except ImportError: # for Python 2.7
++ from collections import Mapping
+ import zlib
+ import gzip
+ from io import BytesIO
+--
+2.34.1
+
diff --git a/PKGBUILD b/PKGBUILD
index e197d993481..09c2f8d4cee 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,15 +4,29 @@
_name=NBT
pkgname=python-${_name,,}
pkgver=1.5.0
-pkgrel=3
+pkgrel=4
pkgdesc="Named Binary Tag Reader/Writer"
url="https://github.com/twoolie/$_name"
depends=('python')
makedepends=('python-setuptools')
license=('MIT')
arch=('any')
-source=("$pkgname-$pkgver.tar.gz::$url/archive/version-$pkgver.tar.gz")
-sha256sums=('068111bf5d9e73156cd6d627b3d69c782e89af96e328dd7e91a971a453ba9951')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/version-$pkgver.tar.gz"
+ '0001-Update-nbt.py.patch'
+ '0002-Update-region.py.patch'
+ '0003-Use-collections.abc.patch')
+sha256sums=('068111bf5d9e73156cd6d627b3d69c782e89af96e328dd7e91a971a453ba9951'
+ '28a92ddc698cc8f17ab2628dd6ca1bf552bc96803d9891f9c04fc2feb2c866db'
+ '13cff14b8e0584a67e20d7a0e9924a95e283ab64e10366cffff092b7c83201d5'
+ 'e1931b3b9b0962bf88a8834be846accdc4fec9edccbd670b01506c6b8139c945')
+
+prepare() {
+ cd "$_name-version-$pkgver"
+
+ for p in "$srcdir"/*.patch; do
+ patch -Np1 -i "$p"
+ done
+}
build() {
cd "$_name-version-$pkgver"