58 Commits

Author SHA1 Message Date
Evgenii Kliuchnikov
1964cdb1b9 ramp up all GH actions plugins
PiperOrigin-RevId: 821598646
2025-10-20 05:07:13 -07:00
Evgenii Kliuchnikov
61605b1cb3 pick VCPKG patches
PiperOrigin-RevId: 821593009
2025-10-20 04:44:24 -07:00
Evgenii Kliuchnikov
1406898440 Build and test with PY2.7
PiperOrigin-RevId: 811352084
2025-09-25 08:00:20 -07:00
Eugene Kliuchnikov
0903aad0d7 Update setup.py 2025-09-04 14:50:43 +02:00
Eugene Kliuchnikov
447385795f Update setup.py 2025-09-04 14:48:46 +02:00
Eugene Kliuchnikov
8fea9e31c8 Merge branch 'master' into master 2025-09-04 14:42:48 +02:00
Evgenii Kliuchnikov
20ed1374ff add decoder static init
PiperOrigin-RevId: 802957201
2025-09-04 03:58:47 -07:00
Evgenii Kliuchnikov
310f2119cf pull common static init header
PiperOrigin-RevId: 801763621
2025-09-01 04:46:12 -07:00
Evgenii Kliuchnikov
30c7d2f97d split prefix.h to .h/.cc/_inc.h
PiperOrigin-RevId: 801742168
2025-09-01 03:24:08 -07:00
Eugene Kliuchnikov
79ea7296d4 Merge branch 'master' into master 2025-08-29 15:06:37 +02:00
Evgenii Kliuchnikov
29e040b8cb use static init to reduce encoder library size
PiperOrigin-RevId: 791661871
2025-08-06 06:18:01 -07:00
Domingo Dirutigliano
964ca075d1 fix module import in set exception + setup.py compatible with python2 2025-06-13 14:58:13 +02:00
Benjamin Leff
0e0ed5f0cc perf: conditionally install pkgconfig if using system brotli 2025-05-27 08:53:51 -05:00
gorloffslava
0ea9927a2b + Improved setup.py formatting
+ Updated dependency resolution for edge cases in setup.py
2024-11-21 16:11:26 +05:00
Benjamin Leff
b93502da88 fix: renamed print 2024-08-29 19:17:37 -05:00
gorloffslava
2a01fd8f31 + Added ability to build Brotli Python bindings against system-provided brotli instead of vendored one 2024-07-29 20:05:34 +05:00
Cosimo Lupo
2ce85662c5 setup.py: add long_description (#1073)
twine (the tool we use to upload packages to PyPI) is currently failing if the long_description (used to render a project's page on PyPI website) is not set. Somehow it complains that it is not well formatted reStructuredText, but it's simply empty...
This looks like a bug, or bad interaction between twince and setuptools, because the field is technically optional.
Also see https://github.com/pypa/twine/issues/960 and https://github.com/pypa/twine/issues/908.

This issue is currently preventing the upload of newly built Brotli v1.1.0 Python wheels to PyPI:
https://github.com/google/brotli-wheels/issues/18#issuecomment-1706910190

Anyway, we may well set the long_description to the content of the README.md file, as it's customary for python projects.
2023-09-07 11:28:09 +02:00
Evgenii Kliuchnikov
27a9a80992 simplify CMake build
PiperOrigin-RevId: 552238545
2023-07-30 03:45:11 -07:00
Ma Lin
c8df4b3049 Python: use a new output buffer code (#902)
Currently, the output buffer is a std::vector<uint8_t>.
When the buffer grows, resizing will cause unnecessary memcpy().

This change uses a list of bytes object to represent output buffer, can avoid the extra overhead of resizing.
In addition, C++ code can be removed, it's a pure C extension.
2022-12-29 14:07:16 +01:00
Eugene Kliuchnikov
19d86fb9a6 Merge-in SharedDictionary feature (#916)
Co-authored-by: Eugene Kliuchnikov <eustas@chromium.org>
2021-08-04 14:42:02 +02:00
Eugene Kliuchnikov
223d80cfbe Update (#826)
* IMPORTANT: decoder: fix potential overflow when input chunk is >2GiB
 * simplify max Huffman table size calculation
 * eliminate symbol duplicates (static arrays in .h files)
 * minor combing in research/ code
2020-08-26 12:32:27 +02:00
James Hilliard
5c3a9a937b Fix license in setup.py (#769) 2019-08-16 16:32:14 +02:00
William A. Kennington III
fc4d345968 Fix missing header files (#695)
Our dist tarball is missing hash_rolling_inc.h and
hash_composite_inc.h, which causes subsequent autotools
builds to fail. Fix this by adding it to the sources list.

Signed-off-by: William A. Kennington III <william@wkennington.com>
2018-07-09 10:40:08 +02:00
Eugene Kliuchnikov
631fe194a1 Update (#651)
* fix `bazel` build (ignore switch case fall-through)
* add `NPOSTFIX` / `NDIRECT` encoder parameters
* fix source file lists (add `params.h`)
* fix bug in `durchschlag`
* print clarifying messages wheb CLI argument parsing fails
2018-03-20 17:37:41 +06:00
Eugene Kliuchnikov
35e69fc7cf New feature: "Large Window Brotli" (#640)
* New feature: "Large Window Brotli"

By setting special encoder/decoder flag it is now possible to extend
LZ-window up to 30 bits; though produced stream will not be RFC7932
compliant.

Added new dictionary generator - "DSH". It combines speed of "Sieve"
and quality of "DM". Plus utilities to prepare train corpora
(remove unique strings).

Improved compression ratio: now two sub-blocks could be stitched:
the last copy command could be extended to span the next sub-block.

Fixed compression ineffectiveness caused by floating numbers rounding and
wrong cost heuristic.

Other C changes:
 - combined / moved `context.h` to `common`
 - moved transforms to `common`
 - unified some aspects of code formatting
 - added an abstraction for encoder (static) dictionary
 - moved default allocator/deallocator functions to `common`

brotli CLI:
 - window size is auto-adjusted if not specified explicitly

Java:
 - added "eager" decoding both to JNI wrapper and pure decoder
 - huge speed-up of `DictionaryData` initialization

* Add dictionaryless compressed dictionary

* Fix `sources.lst`

* Fix `sources.lst` and add a note that `libtool` is also required.

* Update setup.py

* Fix `EagerStreamTest`

* Fix BUILD file

* Add missing `libdivsufsort` dependency

* Fix "unused parameter" warning.
2018-02-26 09:04:36 -05:00
Cosimo Lupo
4f455cac32 disable buidling/deployment of python wheels (#583)
* [appveyor] remove 'deploy' stage; only test python 2.7 and 3.6

all the other python versions are being built and tested on
https://github.com/google/brotli-wheels/blob/d571d63/appveyor.yml

* remove terrify submodule as not needed any more

* [travis] just test py2.7 and 3.6 on linux; remove extra osx python builds

All the other python versions for OSX are being built/tested on:
https://github.com/google/brotli-wheels/blob/d571d63/.travis.yml

Also, there's no need to build and deploy wheels here, as that's done
in the separate repository.

* [setup.py] only rebuild if dependency are newer; fix typo in list of 'depends'

https://github.com/python/cpython/blob/v3.6.2/Lib/distutils/command/build_ext.py#L485-L500

* [ci] only run 'python setup.py test'

if we run 'python setup.py built test', the setuptools 'test' command will
forcibly re-run the build_ext subcommand because it wants to pass the --inplace
option (it ignores whether it's up to date, just re-runs it all the time).

with this we go from running built_ext twice, to running it only once per build

* [Makefile] run 'build_ext --inplace' instead of 'develop' as default target

The 'develop' command is like 'install' in the sense that it
modifies the user's python environment.
The default make target should be less intrusive, i.e. just building
the extension module in-place without modify anything in the user's
environment.

We don't need to tell make about the dependency between 'test' and
'build' target as that is baked in the `python setup.py test` command.

* [Makefile] add 'develop' target; remove unnecessary 'tests' target

`make test` is good enough

* [Makefile] `setup.py test` requires setuptools; run `python -m unittest`

This will work even if setuptools is not installed, which is unlikely
nowadays but still our `setup.py` works with plain distutils, so
we may well have our tests work without setuptools.

* [python/README.md] add ref to 'develop' target; remove 'tests', just 'make test'

* [setup.py] import modules as per nicksay's comment

https://github.com/google/brotli/pull/583#discussion_r131981049

* [Makefile] add 'develop' to .PHONY targets

remove 'tests' from .PHONY

* [appveyor] remove unused setup scripts

We don't need to install custom python versions, we are
using the pre-installed ones on Appveyor.

* [appveyor] remove unneeded setup code
2017-08-23 20:45:13 +02:00
Eugene Kliuchnikov
6ece1d8791 Move files & update paths (#541)
* Move files & update paths

* Rename build to scripts.

* Fix paths

* Fix script.
2017-04-23 14:07:08 +02:00
Eugene Kliuchnikov
cdca91b6f5 Update common, decoder, encoder, java (#520)
Common:
 * wrap dictionary data into `BrotliDictionary` structure
 * replace public constant with getter `BrotliGetDictionary`
 * reformat dictionary data

Decoder:
 * adopt common changes
 * clarify acceptable instance usage patterns
 * hold reference to dictionary in state

Encoder:
 * adopt common changes
 * eliminate PIC spots in `CreateBackwardReferences`
 * add per-chunk ratio guards for q0 and q1
 * precompute relative distances to avoid repeated calculations
 * prostpone hasher allocation/initialization
 * refactor Hashers to be class-like structure
 * further improvements for 1MiB+ inputs
 * added new hasher type; made hashers more configurable

Java:
 * Pull byte->int magic to `IntReader` from `BitReader`
2017-03-06 14:22:45 +01:00
Eugene Kliuchnikov
11df843cf0 Update encoder (#504)
* pull `BROTLI_MAX_BACKWARD_LIMIT` to constants
 * split generic and Zopfli backward references code
 * pull hashers init and stitch invocation to encoder
 * make `dictionary_hash` a compilation unit
 * add `size hint` parameter
 * add new hasher
 * use `size hint` to pick new hasher for q4
 * modernize clz guard (fix #495)
 * move `hash to binary tree` to separate file
 * add `Initialize` and `Cleanup` to all hashers
 * do not raise OOM if malloc(0) == NULL (fix #500)
2017-02-06 14:20:43 +01:00
Alex Nicksay
89a5b6e625 Python: Simplify test suite generation by using unittest discovery (#485) 2016-12-20 14:40:47 +01:00
Alex Nicksay
f7b5b3dc2c Python: Create native brotli module and move extension to _brotli 2016-10-17 09:35:27 -04:00
Alex Nicksay
6f55ee6097 Python: Clean up setup.py file 2016-10-12 11:43:14 -04:00
Eugene Kliuchnikov
6e2207f486 Add includedir to setup.py 2016-08-23 14:44:13 +02:00
Eugene Kliuchnikov
8148001158 Move "public" to "include/brotli" 2016-08-23 14:40:33 +02:00
Eugene Kliuchnikov
ceddddeb2b Fix setup.py regexp 2016-08-22 15:59:08 +02:00
Eugene Kliuchnikov
2c2d5578a6 Use version from common/version.h 2016-08-22 15:44:12 +02:00
Eugene Kliuchnikov
403729c454 Fix setup.py 2016-08-22 13:59:21 +02:00
Eugene Kliuchnikov
db3a11625d Fix CI build. 2016-06-13 15:22:13 +02:00
Eugene Kliuchnikov
11d1337baf Update setup.py 2016-06-03 12:02:01 +02:00
eustas
14b32cc3aa Remove obsolete compilation unit 2016-02-16 15:16:54 +01:00
Zoltan Szabadka
47f1eaba88 Add the new source files to setup.py 2016-01-11 12:05:18 +01:00
Cosimo Lupo
8b2ca8efd9 setup.py: don't enable c++0x for gcc 2015-12-08 12:33:06 +00:00
Cosimo Lupo
18a2954522 [setup.py] add PyPI trove classifiers 2015-10-06 12:23:57 +01:00
Cosimo Lupo
b2f6c6dbff [setup.py] remove monkey-patch for distutils.msvc9compiler; try to import setuptools required by "Microsoft Visual C++ Compiler for Python 2.7"
Cf. http://aka.ms/vcpython27
2015-10-05 11:06:18 +01:00
Zoltan Szabadka
b5c92e54a6 Add tools/version.h that conatins the brotli version.
This can be reused by all of the tools.
Set the version to the next git release tag.
2015-10-02 11:32:42 +02:00
Zoltan Szabadka
4c37566f4b Move literal cost computation to where it's used.
Move utf8 heuristics functions to their own file.
2015-10-01 15:10:42 +02:00
Zoltan Szabadka
4a7024dcde Make the brotli encoder C++98 compatible. 2015-10-01 12:08:14 +02:00
Zoltan Szabadka
0cf3a54422 Update brotli decoder with latest improvements. 2015-09-24 18:35:25 +02:00
Cosimo Lupo
e88fe7b248 [setup.py] pass extra compiler flags on OS X to enable support for C++11: -stdlib=libc++ -mmacosx-version-min=10.7 2015-08-14 11:06:59 +01:00
Cosimo Lupo
d2c8b2777d [setup.py] retrieve version string from brotlimodule.cc so we don't need to modify it more than once 2015-08-11 11:12:58 +01:00