From 6abbf81ef2f298e3221ff5e67a1f3c5f23958212 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 14 Dec 2020 13:26:14 +0000 Subject: gentoo resync : 14.12.2020 --- dev-python/brotlicffi/Manifest | 5 + dev-python/brotlicffi/brotlicffi-0.8.0.ebuild | 54 +++++++++ .../files/brotlicffi-0.8.0-remove-dict.patch | 132 +++++++++++++++++++++ dev-python/brotlicffi/metadata.xml | 12 ++ 4 files changed, 203 insertions(+) create mode 100644 dev-python/brotlicffi/Manifest create mode 100644 dev-python/brotlicffi/brotlicffi-0.8.0.ebuild create mode 100644 dev-python/brotlicffi/files/brotlicffi-0.8.0-remove-dict.patch create mode 100644 dev-python/brotlicffi/metadata.xml (limited to 'dev-python/brotlicffi') diff --git a/dev-python/brotlicffi/Manifest b/dev-python/brotlicffi/Manifest new file mode 100644 index 000000000000..f032f752f8d0 --- /dev/null +++ b/dev-python/brotlicffi/Manifest @@ -0,0 +1,5 @@ +AUX brotlicffi-0.8.0-remove-dict.patch 5333 BLAKE2B e68065d06c072f61b0115925706e1476ef58d4217635c2d29e32a503cc0a98a2b55a9155f8bc189659b986a8bc7ca213b4b1f1405b0379e3f2813db50b5b949b SHA512 8e1acde07e98c609e295d0c2408823de026ffdfa88b3a45880ab5321b5293ce19791000bc5fd0d37ba96ccecb243151ac52ac2beaa2447ca912ae21d5a4a711c +DIST brotli-46c1a881b41bb638c76247558aa04b1591af3aa7.tar.gz 19840371 BLAKE2B b9a1c3c2e5b62bd63b392debe54bd1732ac1cb31f88500f0142108b453649d96901d9a03b6db98642cb9abaf9188c06d440f2b8bd3cf57fbbb52196a931f5079 SHA512 dc573c90491032a205f32f0ce9c93e95b06c70a3107caa9501e038a212226c37117d63709a29843367344bf7d18cf32d0c0578b11166387198e12b38b1522406 +DIST brotlicffi-0.8.0.gh.tar.gz 21997 BLAKE2B 5e817e228ce01cd7a831c59cca5bab3e851d676f1daa5efab8f61a203c0854bcc92605c88896dff5f4ce27fc880718da5ddfcf02a3bddbbd7b2e18c33f1e77a4 SHA512 fd0c64b400d3b48e0e2d113b4d75e32a2b33fd99505c7661d6d51ba9aedf5cc1f58be09bc90a5f1f7e3424addef2b54cc085a41e6291c87d53dd7d4e8fc7eb4e +EBUILD brotlicffi-0.8.0.ebuild 1254 BLAKE2B e1509b8e7eef67790776cd636e949e5882bbb9acd36d652f9f638a09bfb68c959daa635cb186451911482bcc2d252378934c96dca1e9707daa262d2be5e3b40a SHA512 158164e87df8795f7b9955438a36022e26e6b58be897bbcb9839c44aa133f369f93b866d72329680db342724d43301b9df3978fa5b77cca3958495910b5051ed +MISC metadata.xml 376 BLAKE2B 7044a00a2d66d5f983cc9485bc9a3124d24162cb72fb65c716653f1b4bddf7c6a1d3e7a407726098650167f74d5c10bab2582cabbb533cbf966ac0b8292cbe70 SHA512 51fee847f41d497493f69a12962df09d1229357502538b00c1941025230745bda4595619dca1277e6c01840c788e677ec0d1033d897350373e84ca6e9222ddd4 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..5dbd99180383 --- /dev/null +++ b/dev-python/brotlicffi/brotlicffi-0.8.0.ebuild @@ -0,0 +1,54 @@ +# 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/brotlicffi/ + https://pypi.org/project/brotlicffi/" +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 ~riscv ~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 +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..0ca2bbfddadc --- /dev/null +++ b/dev-python/brotlicffi/metadata.xml @@ -0,0 +1,12 @@ + + + + + python@gentoo.org + Python + + + brotlicffi + python-hyper/brotlicffi + + -- cgit v1.2.3