commit:     21d3fe04259d617da1e5204a635d1a5cac5e0efd
Author:     Ekaterina Vaartis <vaartis <AT> kotobank <DOT> ch>
AuthorDate: Tue Jun  1 14:50:27 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  2 19:46:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21d3fe04

dev-python/lz4: Bump to py3.10

Signed-off-by: Ekaterina Vaartis <vaartis <AT> kotobank.ch>
Closes: https://github.com/gentoo/gentoo/pull/21074
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/lz4/files/lz4-3.1.3-310-readall.patch | 32 ++++++++++++++++++++++++
 dev-python/lz4/lz4-3.1.3.ebuild                  |  6 ++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/dev-python/lz4/files/lz4-3.1.3-310-readall.patch 
b/dev-python/lz4/files/lz4-3.1.3-310-readall.patch
new file mode 100644
index 00000000000..63b306b4e4f
--- /dev/null
+++ b/dev-python/lz4/files/lz4-3.1.3-310-readall.patch
@@ -0,0 +1,32 @@
+diff --git a/lz4/frame/__init__.py b/lz4/frame/__init__.py
+index 5fa03ce..b77c425 100644
+--- a/lz4/frame/__init__.py
++++ b/lz4/frame/__init__.py
+@@ -617,6 +617,17 @@ class LZ4FrameFile(_compression.BaseStream):
+         # returns at least one byte (except at EOF)
+         return self._buffer.peek(size)
+ 
++    def readall(self):
++        chunks = bytearray()
++
++        while True:
++            data = self.read(io.DEFAULT_BUFFER_SIZE)
++            chunks += data
++            if not data:
++                break
++
++        return bytes(chunks)
++
+     def read(self, size=-1):
+         """Read up to ``size`` uncompressed bytes from the file.
+ 
+@@ -632,6 +643,9 @@ class LZ4FrameFile(_compression.BaseStream):
+ 
+         """
+         self._check_can_read()
++
++        if size < 0 and sys.version_info >= (3, 10):
++            return self.readall()
+         return self._buffer.read(size)
+ 
+     def read1(self, size=-1):

diff --git a/dev-python/lz4/lz4-3.1.3.ebuild b/dev-python/lz4/lz4-3.1.3.ebuild
index d0b08c54db0..b86d4cd5697 100644
--- a/dev-python/lz4/lz4-3.1.3.ebuild
+++ b/dev-python/lz4/lz4-3.1.3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_COMPAT=( python3_{7..10} )
 
 inherit distutils-r1
 
@@ -25,4 +25,8 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       "${FILESDIR}/${P}-310-readall.patch"
+)
+
 distutils_enable_tests pytest

Reply via email to