Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-adblock for openSUSE:Factory checked in at 2021-06-28 15:33:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-adblock (Old) and /work/SRC/openSUSE:Factory/.python-adblock.new.2625 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-adblock" Mon Jun 28 15:33:31 2021 rev:2 rq:902652 version:0.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-adblock/python-adblock.changes 2021-04-22 18:06:10.950716421 +0200 +++ /work/SRC/openSUSE:Factory/.python-adblock.new.2625/python-adblock.changes 2021-06-28 15:33:49.575200512 +0200 @@ -1,0 +2,7 @@ +Sun Jun 27 17:00:18 UTC 2021 - Mia Herkt <[email protected]> + +- Update to 0.5.0 + * Library now throws the custom adblock.AdblockException + exception, instead of ValueError. + +------------------------------------------------------------------- Old: ---- python-adblock-0.4.4.tar.gz New: ---- python-adblock-0.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-adblock.spec ++++++ --- /var/tmp/diff_new_pack.ilF6aW/_old 2021-06-28 15:33:50.587201749 +0200 +++ /var/tmp/diff_new_pack.ilF6aW/_new 2021-06-28 15:33:50.591201754 +0200 @@ -18,10 +18,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-adblock -Version: 0.4.4 +Version: 0.5.0 Release: 0 Summary: Brave's adblock library in Python -License: MIT OR Apache-2.0 +License: Apache-2.0 OR MIT URL: https://pypi.org/project/adblock/ Source: https://github.com/ArniDagur/python-adblock/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: vendor.tar.xz ++++++ python-adblock-0.4.4.tar.gz -> python-adblock-0.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/.github/dependabot.yml new/python-adblock-0.5.0/.github/dependabot.yml --- old/python-adblock-0.4.4/.github/dependabot.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/python-adblock-0.5.0/.github/dependabot.yml 2021-06-26 22:50:00.000000000 +0200 @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/.github/workflows/ci.yml new/python-adblock-0.5.0/.github/workflows/ci.yml --- old/python-adblock-0.4.4/.github/workflows/ci.yml 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/.github/workflows/ci.yml 2021-06-26 22:50:00.000000000 +0200 @@ -32,6 +32,9 @@ command: clippy args: --all-targets --all-features + - name: Lint with Black + run: pip install black && black --check . + macos: runs-on: macos-latest needs: lint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/CHANGELOG.md new/python-adblock-0.5.0/CHANGELOG.md --- old/python-adblock-0.4.4/CHANGELOG.md 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/CHANGELOG.md 2021-06-26 22:50:00.000000000 +0200 @@ -6,6 +6,11 @@ ## Unreleased --- +## 0.5.0 - (2021-06-26) +--- +### Breaks +* Library now throws the custom `adblock.AdblockException` exception, instead of `ValueError`. + ## 0.4.4 - (2021-04-13) --- ### Changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/Cargo.lock new/python-adblock-0.5.0/Cargo.lock --- old/python-adblock-0.4.4/Cargo.lock 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/Cargo.lock 2021-06-26 22:50:00.000000000 +0200 @@ -1,10 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "adblock" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e84ccc600a2619fbba5aef0f59b45fa8959ff2a9991e104bab96e55c327197df" +checksum = "13df3d8a7e24ea2cc711b82a047ef2b9f743aa6580bea2552fcec68f0289603c" dependencies = [ "addr", "base64", @@ -24,17 +26,17 @@ [[package]] name = "adblock" -version = "0.4.4" +version = "0.5.0" dependencies = [ - "adblock 0.3.10", + "adblock 0.3.13", "pyo3", ] [[package]] name = "addr" -version = "0.11.8" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936697e9caf938eb2905036100edf8e1269da8291f8a02f5fe7b37073784eec0" +checksum = "c54ccac949a2afafdfc889e15c753bbc6ee8783e026bbe3d057b00b13907db70" dependencies = [ "psl", "psl-types", @@ -48,9 +50,9 @@ [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] @@ -240,9 +242,9 @@ [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "miniz_oxide" @@ -408,9 +410,9 @@ [[package]] name = "regex" -version = "1.4.5" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", @@ -419,9 +421,9 @@ [[package]] name = "regex-syntax" -version = "0.6.23" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "rmp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/Cargo.toml new/python-adblock-0.5.0/Cargo.toml --- old/python-adblock-0.4.4/Cargo.toml 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/Cargo.toml 2021-06-26 22:50:00.000000000 +0200 @@ -1,7 +1,7 @@ [package] publish = false name = "adblock" -version = "0.4.4" +version = "0.5.0" edition = "2018" authors = ["??rni Dagur <[email protected]>"] license = "MIT OR Apache-2.0" @@ -22,9 +22,9 @@ debug = true [dependencies] -adblock = { version = "=0.3.10", default-features = false, features = ["full-regex-handling", "embedded-domain-resolver"] } +adblock = { version = "=0.3.13", default-features = false, features = ["full-regex-handling", "embedded-domain-resolver"] } pyo3 = { version = "0.13", features = ["abi3-py36", "extension-module"] } [lib] name = "adblock" -crate-type = ["rlib", "cdylib"] \ No newline at end of file +crate-type = ["rlib", "cdylib"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/README.md new/python-adblock-0.5.0/README.md --- old/python-adblock-0.4.4/README.md 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/README.md 2021-06-26 22:50:00.000000000 +0200 @@ -1,29 +1,48 @@ -python-adblock -========== +# python-adblock + Python wrapper for Brave's adblocking library, which is written in Rust. -### Building +### Building from source + +#### Build dependencies + +| Build Dependency | Versions | Arch Linux | Url | +| ---------------- | -------- | ---------- | ------------------------------- | +| Python | `>=3.6` | `python` | - | +| Rust | `>=1.45` | `rust` | - | +| Maturin | `>=0.10` | `maturin` | https://github.com/PyO3/maturin | + +#### PEP 517 + +The `python-adblock` library is [PEP 517](https://www.python.org/dev/peps/pep-0517/) compatible, so you can build and install it from source, simply by running ``` -maturin build --release +pip install . ``` -#### Build dependencies +from the root of this directory. -| Build Dependency | Versions | Arch Linux | Url | -|------------------|----------|------------|-----| -| Python | `>=3.6` | `python3` | - | -| Rust | `>=1.45` | `rust` | - | -| Maturin | `>=0.10` | `maturin` | https://github.com/PyO3/maturin | +#### Wheels + +To create a wheel for this library, run the following command + +``` +maturin build --release --no-sdist --out dist/ +``` + +the result can be found in the `dist/` directory. ### Developing I use Poetry for development. To create and enter a virtual environment, do + ``` poetry install poetry shell ``` + then, to install the `adblock` module into the virtual environment, do + ``` maturin develop ``` @@ -36,9 +55,9 @@ This project is licensed under either of - * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or - http://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](LICENSE-MIT) or - http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) at your option. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/adblock/__init__.py new/python-adblock-0.5.0/adblock/__init__.py --- old/python-adblock-0.4.4/adblock/__init__.py 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/adblock/__init__.py 2021-06-26 22:50:00.000000000 +0200 @@ -1,4 +1,29 @@ -from adblock.adblock import __version__, Engine, FilterSet, BlockerResult, UrlSpecificResources +from adblock.adblock import ( + __version__, + Engine, + FilterSet, + BlockerResult, + UrlSpecificResources, + AdblockException, + BlockerException, + SerializationError, + DeserializationError, + OptimizedFilterExistence, + BadFilterAddUnsupported, + FilterExists, +) -__all__ = ("Engine", "FilterSet", "BlockerResult", "UrlSpecificResources") +__all__ = ( + "Engine", + "FilterSet", + "BlockerResult", + "UrlSpecificResources", + "AdblockException", + "BlockerException", + "SerializationError", + "DeserializationError", + "OptimizedFilterExistence", + "BadFilterAddUnsupported", + "FilterExists", +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/adblock/adblock.pyi new/python-adblock-0.5.0/adblock/adblock.pyi --- old/python-adblock-0.4.4/adblock/adblock.pyi 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/adblock/adblock.pyi 2021-06-26 22:50:00.000000000 +0200 @@ -1,5 +1,26 @@ from typing import Optional, Dict, List, Set +class AdblockException(Exception): + pass + +class BlockerException(AdblockException): + pass + +class SerializationError(BlockerException): + pass + +class DeserializationError(BlockerException): + pass + +class OptimizedFilterExistence(BlockerException): + pass + +class BadFilterAddUnsupported(BlockerException): + pass + +class FilterExists(BlockerException): + pass + class BlockerResult: matched: bool explicit_cancel: bool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/src/lib.rs new/python-adblock-0.5.0/src/lib.rs --- old/python-adblock-0.4.4/src/lib.rs 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/src/lib.rs 2021-06-26 22:50:00.000000000 +0200 @@ -17,7 +17,8 @@ use adblock::lists::FilterFormat; use adblock::lists::FilterSet as RustFilterSet; use pyo3::class::PyObjectProtocol; -use pyo3::exceptions::PyValueError; +use pyo3::create_exception; +use pyo3::exceptions::PyException; use pyo3::prelude::*; use pyo3::types::PyBytes; use pyo3::PyErr; @@ -31,12 +32,28 @@ /// Brave's adblocking library in Python! #[pymodule] -fn adblock(_py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn adblock(py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add("__version__", env!("CARGO_PKG_VERSION"))?; m.add_class::<Engine>()?; m.add_class::<FilterSet>()?; m.add_class::<BlockerResult>()?; m.add_class::<UrlSpecificResources>()?; + m.add("AdblockException", py.get_type::<AdblockException>())?; + m.add("BlockerException", py.get_type::<BlockerException>())?; + m.add("SerializationError", py.get_type::<SerializationError>())?; + m.add( + "DeserializationError", + py.get_type::<DeserializationError>(), + )?; + m.add( + "OptimizedFilterExistence", + py.get_type::<OptimizedFilterExistence>(), + )?; + m.add( + "BadFilterAddUnsupported", + py.get_type::<BadFilterAddUnsupported>(), + )?; + m.add("FilterExists", py.get_type::<FilterExists>())?; Ok(()) } @@ -141,9 +158,24 @@ } } +create_exception!(adblock, AdblockException, PyException); +create_exception!(adblock, BlockerException, AdblockException); +create_exception!(adblock, SerializationError, BlockerException); +create_exception!(adblock, DeserializationError, BlockerException); +create_exception!(adblock, OptimizedFilterExistence, BlockerException); +create_exception!(adblock, BadFilterAddUnsupported, BlockerException); +create_exception!(adblock, FilterExists, BlockerException); + impl Into<PyErr> for BlockerError { fn into(self) -> PyErr { - PyErr::new::<PyValueError, _>(format!("{:?}", self)) + let msg = format!("{:?}", self); + match self { + Self::SerializationError => PyErr::new::<SerializationError, _>(msg), + Self::DeserializationError => PyErr::new::<DeserializationError, _>(msg), + Self::OptimizedFilterExistence => PyErr::new::<OptimizedFilterExistence, _>(msg), + Self::BadFilterAddUnsupported => PyErr::new::<BadFilterAddUnsupported, _>(msg), + Self::FilterExists => PyErr::new::<FilterExists, _>(msg), + } } } @@ -163,7 +195,7 @@ match filter_format { "standard" => Ok(FilterFormat::Standard), "hosts" => Ok(FilterFormat::Hosts), - _ => Err(PyErr::new::<PyValueError, _>("Invalid format value")), + _ => Err(PyErr::new::<AdblockException, _>("Invalid format value")), } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/tests/test_engine.py new/python-adblock-0.5.0/tests/test_engine.py --- old/python-adblock-0.4.4/tests/test_engine.py 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/tests/test_engine.py 2021-06-26 22:50:00.000000000 +0200 @@ -52,6 +52,18 @@ assert deserialization_result is None +def test_deserialize_corrupt(tmpdir): + path = str(tmpdir / "corrupt_cache.dat") + with open(path, "w", encoding="utf-8") as f: + f.write("abc") + + engine = empty_engine() + with pytest.raises(adblock.DeserializationError): + engine.deserialize_from_file(path) + with pytest.raises(adblock.DeserializationError): + engine.deserialize(b"abc") + + def test_serde(): engine = empty_engine() serialization_result = engine.serialize() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/tests/test_exceptions.py new/python-adblock-0.5.0/tests/test_exceptions.py --- old/python-adblock-0.4.4/tests/test_exceptions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-adblock-0.5.0/tests/test_exceptions.py 2021-06-26 22:50:00.000000000 +0200 @@ -0,0 +1,11 @@ +import adblock + + +def test_correct_baseclasses(): + assert issubclass(adblock.AdblockException, Exception) + assert issubclass(adblock.BlockerException, adblock.AdblockException) + assert issubclass(adblock.SerializationError, adblock.BlockerException) + assert issubclass(adblock.DeserializationError, adblock.BlockerException) + assert issubclass(adblock.OptimizedFilterExistence, adblock.BlockerException) + assert issubclass(adblock.BadFilterAddUnsupported, adblock.BlockerException) + assert issubclass(adblock.FilterExists, adblock.BlockerException) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-adblock-0.4.4/tests/test_imports.py new/python-adblock-0.5.0/tests/test_imports.py --- old/python-adblock-0.4.4/tests/test_imports.py 2021-04-13 02:40:30.000000000 +0200 +++ new/python-adblock-0.5.0/tests/test_imports.py 2021-06-26 22:50:00.000000000 +0200 @@ -14,16 +14,18 @@ match = re.match(r"m\.add_class::<(.+)>\(\)\?;", line.strip()) if match is not None: classes.append(match.group(1)) + continue return classes def test_added_classes(): """ Make sure that there's no class that we added in Rust but didn't import in - `__init__.py` and vice versa. + `__init__.py`. """ added_classes = get_added_classes() - assert added_classes == list(adblock.__all__) + for c in added_classes: + assert c in adblock.__all__ def test_dunder_all_classes_imported(): ++++++ vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/python-adblock/vendor.tar.xz /work/SRC/openSUSE:Factory/.python-adblock.new.2625/vendor.tar.xz differ: char 26, line 1
