summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-12-01 10:53:02 +0100
committerMichał Górny <mgorny@gentoo.org>2020-12-01 11:32:01 +0100
commit4ca1a7d89e4de02f67458cfd955f40b658962437 (patch)
treec869eb3d67a05751dd33fa86c906e476732b5456 /dev-python/brotlicffi
parentdev-python/llvmlite: Bump to 0.35.0 (diff)
downloadgentoo-4ca1a7d89e4de02f67458cfd955f40b658962437.tar.gz
gentoo-4ca1a7d89e4de02f67458cfd955f40b658962437.tar.bz2
gentoo-4ca1a7d89e4de02f67458cfd955f40b658962437.zip
dev-python/brotlicffi: Incompatible rename of dev-python/brotlipy
This is the continuation of dev-python/brotlipy. I am not doing a move here since the rename (obviously) breaks all reverse dependencies, and both old and new names are co-installable. Good news is that this removes the blocker on app-arch/brotli[python]. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/brotlicffi')
-rw-r--r--dev-python/brotlicffi/Manifest2
-rw-r--r--dev-python/brotlicffi/brotlicffi-0.8.0.ebuild52
-rw-r--r--dev-python/brotlicffi/files/brotlicffi-0.8.0-remove-dict.patch132
-rw-r--r--dev-python/brotlicffi/metadata.xml8
4 files changed, 194 insertions, 0 deletions
diff --git a/dev-python/brotlicffi/Manifest b/dev-python/brotlicffi/Manifest
new file mode 100644
index 000000000000..66208cc556e0
--- /dev/null
+++ b/dev-python/brotlicffi/Manifest
@@ -0,0 +1,2 @@
+DIST brotli-46c1a881b41bb638c76247558aa04b1591af3aa7.tar.gz 19840371 BLAKE2B b9a1c3c2e5b62bd63b392debe54bd1732ac1cb31f88500f0142108b453649d96901d9a03b6db98642cb9abaf9188c06d440f2b8bd3cf57fbbb52196a931f5079 SHA512 dc573c90491032a205f32f0ce9c93e95b06c70a3107caa9501e038a212226c37117d63709a29843367344bf7d18cf32d0c0578b11166387198e12b38b1522406
+DIST brotlicffi-0.8.0.gh.tar.gz 21997 BLAKE2B 5e817e228ce01cd7a831c59cca5bab3e851d676f1daa5efab8f61a203c0854bcc92605c88896dff5f4ce27fc880718da5ddfcf02a3bddbbd7b2e18c33f1e77a4 SHA512 fd0c64b400d3b48e0e2d113b4d75e32a2b33fd99505c7661d6d51ba9aedf5cc1f58be09bc90a5f1f7e3424addef2b54cc085a41e6291c87d53dd7d4e8fc7eb4e
diff --git a/dev-python/brotlicffi/brotlicffi-0.8.0.ebuild b/dev-python/brotlicffi/brotlicffi-0.8.0.ebuild
new file mode 100644
index 000000000000..a41420574ec5
--- /dev/null
+++ b/dev-python/brotlicffi/brotlicffi-0.8.0.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
+
+inherit distutils-r1
+
+# Commit of the Brotli library bundled within brotlipy.
+BROTLI_BUNDLED_COMMIT="46c1a881b41bb638c76247558aa04b1591af3aa7"
+
+DESCRIPTION="Python binding to the Brotli library"
+HOMEPAGE="https://github.com/python-hyper/brotlipy/ https://pypi.python.org/pypi/brotlipy"
+SRC_URI="
+ https://github.com/python-hyper/${PN}/archive/v${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+ test? (
+ https://github.com/google/brotli/archive/${BROTLI_BUNDLED_COMMIT}.tar.gz
+ -> brotli-${BROTLI_BUNDLED_COMMIT}.tar.gz
+ )"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-macos"
+
+RDEPEND="
+ app-arch/brotli:=
+ virtual/python-cffi[${PYTHON_USEDEP}]"
+DEPEND="
+ test? (
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ # remove custom dictionary code that isn't supported by new brotli
+ "${FILESDIR}"/brotlicffi-0.8.0-remove-dict.patch
+)
+
+src_unpack() {
+ default
+ if use test; then
+ mv "brotli-${BROTLI_BUNDLED_COMMIT}"/tests "${S}"/libbrotli/ || die
+ fi
+}
+
+src_configure() {
+ export USE_SHARED_BROTLI=1
+}
diff --git a/dev-python/brotlicffi/files/brotlicffi-0.8.0-remove-dict.patch b/dev-python/brotlicffi/files/brotlicffi-0.8.0-remove-dict.patch
new file mode 100644
index 000000000000..bfb1b61b951b
--- /dev/null
+++ b/dev-python/brotlicffi/files/brotlicffi-0.8.0-remove-dict.patch
@@ -0,0 +1,132 @@
+From 0fe3dc70240ea62b56861ab830f9ab44644b18e5 Mon Sep 17 00:00:00 2001
+From: Seth Michael Larson <sethmichaellarson@gmail.com>
+Date: Sat, 28 Nov 2020 14:36:59 -0600
+Subject: [PATCH] Update libbrotli to 1.0.9
+
+(stripped down to removing custom dictionary support)
+
+---
+ src/brotlicffi/_api.py | 21 ++----------
+ src/brotlicffi/_build.py | 25 +-------------
+ test/test_simple_compression.py | 8 -----
+
+diff --git a/src/brotlicffi/_api.py b/src/brotlicffi/_api.py
+index 49da0a3..8358d3f 100644
+--- a/src/brotlicffi/_api.py
++++ b/src/brotlicffi/_api.py
+@@ -95,8 +95,7 @@ def compress(data,
+ mode=DEFAULT_MODE,
+ quality=lib.BROTLI_DEFAULT_QUALITY,
+ lgwin=lib.BROTLI_DEFAULT_WINDOW,
+- lgblock=0,
+- dictionary=b''):
++ lgblock=0):
+ """
+ Compress a string using Brotli.
+
+@@ -124,11 +123,6 @@ def compress(data,
+ based on ``quality``.
+ :type lgblock: ``int``
+
+- :param dictionary: A pre-set dictionary for LZ77. Please use this with
+- caution: if a dictionary is used for compression, the same dictionary
+- **must** be used for decompression!
+- :type dictionary: ``bytes``
+-
+ :returns: The compressed bytestring.
+ :rtype: ``bytes``
+ """
+@@ -141,8 +135,7 @@ def compress(data,
+ mode=mode,
+ quality=quality,
+ lgwin=lgwin,
+- lgblock=lgblock,
+- dictionary=dictionary
++ lgblock=lgblock
+ )
+ compressed_data = compressor._compress(data, lib.BROTLI_OPERATION_FINISH)
+ assert lib.BrotliEncoderIsFinished(compressor._encoder) == lib.BROTLI_TRUE
+@@ -255,8 +248,7 @@ def __init__(self,
+ mode=DEFAULT_MODE,
+ quality=lib.BROTLI_DEFAULT_QUALITY,
+ lgwin=lib.BROTLI_DEFAULT_WINDOW,
+- lgblock=0,
+- dictionary=b''):
++ lgblock=0):
+ enc = lib.BrotliEncoderCreateInstance(
+ ffi.NULL, ffi.NULL, ffi.NULL
+ )
+@@ -271,13 +263,6 @@ def __init__(self,
+ _set_parameter(enc, lib.BROTLI_PARAM_LGWIN, "lgwin", lgwin)
+ _set_parameter(enc, lib.BROTLI_PARAM_LGBLOCK, "lgblock", lgblock)
+
+- if dictionary:
+- self._dictionary = ffi.new("uint8_t []", dictionary)
+- self._dictionary_size = len(dictionary)
+- lib.BrotliEncoderSetCustomDictionary(
+- enc, self._dictionary_size, self._dictionary
+- )
+-
+ self._encoder = enc
+
+ def _compress(self, data, operation):
+diff --git a/src/brotlicffi/_build.py b/src/brotlicffi/_build.py
+index d2a2d85..45dccb6 100644
+--- a/src/brotlicffi/_build.py
++++ b/src/brotlicffi/_build.py
+@@ -93,20 +93,6 @@
+ uint8_t** next_out,
+ size_t* total_out);
+
+- /* Fills the new state with a dictionary for LZ77, warming up the
+- ringbuffer, e.g. for custom static dictionaries for data formats.
+- Not to be confused with the built-in transformable dictionary of Brotli.
+- |size| should be less or equal to 2^24 (16MiB), otherwise the dictionary
+- will be ignored. The dictionary must exist in memory until decoding is
+- done and is owned by the caller. To use:
+- 1) Allocate and initialize state with BrotliCreateInstance
+- 2) Use BrotliSetCustomDictionary
+- 3) Use BrotliDecompressStream
+- 4) Clean up and free state with BrotliDestroyState
+- */
+- void BrotliDecoderSetCustomDictionary(
+- BrotliDecoderState* s, size_t size, const uint8_t* dict);
+-
+ /* Returns true, if decoder has some unconsumed output.
+ Otherwise returns false. */
+ BROTLI_BOOL BrotliDecoderHasMoreOutput(const BrotliDecoderState* s);
+@@ -205,15 +191,6 @@
+ BrotliEncoderParameter p,
+ uint32_t value);
+
+- /* Fills the new state with a dictionary for LZ77, warming up the
+- ringbuffer, e.g. for custom static dictionaries for data formats.
+- Not to be confused with the built-in transformable dictionary of Brotli.
+- To decode, use BrotliSetCustomDictionary() of the decoder with the same
+- dictionary. */
+- void BrotliEncoderSetCustomDictionary(BrotliEncoderState* state,
+- size_t size,
+- const uint8_t* dict);
+-
+ /* Check if encoder is in "finished" state, i.e. no more input is
+ acceptable and no more output will be produced.
+ Works only with BrotliEncoderCompressStream workflow.
+diff --git a/test/test_simple_compression.py b/test/test_simple_compression.py
+index 45c322d..a480587 100644
+--- a/test/test_simple_compression.py
++++ b/test/test_simple_compression.py
+@@ -110,14 +110,6 @@ def test_compressed_data_roundtrips(s):
+ assert brotlicffi.decompress(brotlicffi.compress(s)) == s
+
+
+-@given(binary(), binary())
+-def test_compressed_data_with_dictionaries(s, dictionary):
+- d = brotlicffi.Decompressor(dictionary)
+- compressed = brotlicffi.compress(s, dictionary=dictionary)
+- uncompressed = d.decompress(compressed)
+- assert uncompressed == s
+-
+-
+ @given(binary())
+ def test_process_alias(s):
+ c1 = brotlicffi.Compressor()
diff --git a/dev-python/brotlicffi/metadata.xml b/dev-python/brotlicffi/metadata.xml
new file mode 100644
index 000000000000..7f4f33c6dbc9
--- /dev/null
+++ b/dev-python/brotlicffi/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+</pkgmetadata>