Skip to content

Commit

Permalink
py-bleach: updated to 6.0.0
Browse files Browse the repository at this point in the history
Version 6.0.0 (January 23rd, 2023)
----------------------------------

**Backwards incompatible changes**

* ``bleach.clean``, ``bleach.sanitizer.Cleaner``,
  ``bleach.html5lib_shim.BleachHTMLParser``: the ``tags`` and ``protocols``
  arguments were changed from lists to sets.

  Old pre-6.0.0:

  .. code-block:: python

     bleach.clean(
         "some text",
         tags=["a", "p", "img"],
         #    ^               ^ list
         protocols=["http", "https"],
         #         ^               ^ list
     )


  New 6.0.0 and later:

  .. code-block:: python

     bleach.clean(
         "some text",
         tags={"a", "p", "img"},
         #    ^               ^ set
         protocols={"http", "https"},
         #         ^               ^ set
     )

* ``bleach.linkify``, ``bleach.linkifier.Linker``: the ``skip_tags`` and
  ``recognized_tags`` arguments were changed from lists to sets.

  Old pre-6.0.0:

  .. code-block:: python

     bleach.linkify(
         "some text",
         skip_tags=["pre"],
         #         ^     ^ list
     )

     linker = Linker(
         skip_tags=["pre"],
         #         ^     ^ list
         recognized_tags=html5lib_shim.HTML_TAGS + ["custom-element"],
         #                                       ^ ^                ^ list
         #                                       |
         #                                       | list concatenation
     )

  New 6.0.0 and later:

  .. code-block:: python

     bleach.linkify(
         "some text",
         skip_tags={"pre"},
         #         ^     ^ set
     )

     linker = Linker(
         skip_tags={"pre"},
         #         ^     ^ set
         recognized_tags=html5lib_shim.HTML_TAGS | {"custom-element"},
         #                                       ^ ^                ^ set
         #                                       |
         #                                       | union operator
     )

* ``bleach.sanitizer.BleachSanitizerFilter``: ``strip_allowed_elements`` is now
  ``strip_allowed_tags``. We now use "tags" everywhere rather than a mishmash
  of "tags" in some places and "elements" in others.


**Security fixes**

None


**Bug fixes**

* Add support for Python 3.11.

* Fix API weirness in ``BleachSanitizerFilter``.

  We're using "tags" instead of "elements" everywhere--no more weird
  overloading of "elements" anymore.

  Also, it no longer calls the superclass constructor.

* Add warning when ``css_sanitizer`` isn't set, but the ``style``
  attribute is allowed.

* Fix linkify handling of character entities.

* Rework dev dependencies to use ``requirements-dev.txt`` and
  ``requirements-flake8.txt`` instead of extras.

* Fix project infrastructure to be tox-based so it's easier to have CI
  run the same things we're running in development and with flake8
  in an isolated environment.

* Update action versions in CI.

* Switch to f-strings where possible. Make tests parametrized to be
  easier to read/maintain.
  • Loading branch information
adam committed May 5, 2023
1 parent 702e898 commit 898fe97
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
14 changes: 6 additions & 8 deletions www/py-bleach/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# $NetBSD: Makefile,v 1.25 2023/04/30 18:45:35 wiz Exp $
# $NetBSD: Makefile,v 1.26 2023/05/05 08:47:37 adam Exp $

DISTNAME= bleach-3.3.1
DISTNAME= bleach-6.0.0
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
PKGREVISION= 1
CATEGORIES= www python
MASTER_SITES= ${MASTER_SITE_PYPI:=b/bleach/}

Expand All @@ -12,17 +11,16 @@ COMMENT= Easy whitelist-based HTML-sanitizing tool
LICENSE= apache-2.0

DEPENDS+= ${PYPKGPREFIX}-six>=1.9.0:../../lang/py-six
DEPENDS+= ${PYPKGPREFIX}-packaging-[0-9]*:../../devel/py-packaging
DEPENDS+= ${PYPKGPREFIX}-webencodings-[0-9]*:../../textproc/py-webencodings
TEST_DEPENDS+= ${PYPKGPREFIX}-test-runner>=2.0:../../devel/py-test-runner

PYTHON_VERSIONS_INCOMPATIBLE= 27

USE_LANGUAGES= # none

REPLACE_SH+= bleach/_vendor/pip_install_vendor.sh

PYSETUPTESTTARGET= pytest

PYTHON_VERSIONS_INCOMPATIBLE= 27

REPLACE_SH+= bleach/_vendor/pip_install_vendor.sh

.include "../../lang/python/egg.mk"
.include "../../mk/bsd.pkg.mk"
19 changes: 14 additions & 5 deletions www/py-bleach/PLIST
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.8 2020/11/02 14:45:57 adam Exp $
@comment $NetBSD: PLIST,v 1.9 2023/05/05 08:47:37 adam Exp $
${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
Expand All @@ -14,8 +14,10 @@ ${PYSITELIB}/bleach/_vendor/__init__.pyc
${PYSITELIB}/bleach/_vendor/__init__.pyo
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/AUTHORS.rst
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/INSTALLER
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/LICENSE
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/METADATA
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/RECORD
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/REQUESTED
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/WHEEL
${PYSITELIB}/bleach/_vendor/html5lib-1.1.dist-info/top_level.txt
${PYSITELIB}/bleach/_vendor/html5lib/__init__.py
Expand Down Expand Up @@ -117,20 +119,27 @@ ${PYSITELIB}/bleach/_vendor/html5lib/treewalkers/etree_lxml.pyo
${PYSITELIB}/bleach/_vendor/html5lib/treewalkers/genshi.py
${PYSITELIB}/bleach/_vendor/html5lib/treewalkers/genshi.pyc
${PYSITELIB}/bleach/_vendor/html5lib/treewalkers/genshi.pyo
${PYSITELIB}/bleach/_vendor/pip_install_vendor.sh
${PYSITELIB}/bleach/_vendor/parse.py
${PYSITELIB}/bleach/_vendor/parse.py.SHA256SUM
${PYSITELIB}/bleach/_vendor/parse.pyc
${PYSITELIB}/bleach/_vendor/parse.pyo
${PYSITELIB}/bleach/_vendor/vendor.txt
${PYSITELIB}/bleach/_vendor/vendor_install.sh
${PYSITELIB}/bleach/callbacks.py
${PYSITELIB}/bleach/callbacks.pyc
${PYSITELIB}/bleach/callbacks.pyo
${PYSITELIB}/bleach/css_sanitizer.py
${PYSITELIB}/bleach/css_sanitizer.pyc
${PYSITELIB}/bleach/css_sanitizer.pyo
${PYSITELIB}/bleach/html5lib_shim.py
${PYSITELIB}/bleach/html5lib_shim.pyc
${PYSITELIB}/bleach/html5lib_shim.pyo
${PYSITELIB}/bleach/linkifier.py
${PYSITELIB}/bleach/linkifier.pyc
${PYSITELIB}/bleach/linkifier.pyo
${PYSITELIB}/bleach/parse_shim.py
${PYSITELIB}/bleach/parse_shim.pyc
${PYSITELIB}/bleach/parse_shim.pyo
${PYSITELIB}/bleach/sanitizer.py
${PYSITELIB}/bleach/sanitizer.pyc
${PYSITELIB}/bleach/sanitizer.pyo
${PYSITELIB}/bleach/utils.py
${PYSITELIB}/bleach/utils.pyc
${PYSITELIB}/bleach/utils.pyo
8 changes: 4 additions & 4 deletions www/py-bleach/distinfo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$NetBSD: distinfo,v 1.20 2021/10/26 11:30:28 nia Exp $
$NetBSD: distinfo,v 1.21 2023/05/05 08:47:37 adam Exp $

BLAKE2s (bleach-3.3.1.tar.gz) = dbda35325c66359160e436c25fc1afa382966f8d818d2e2f3de7befc7e9973b8
SHA512 (bleach-3.3.1.tar.gz) = bb68275f91a4c724c14594d008f58d31ab0a97b08fd45b6cbe8237a31a1bbfd24a19cea1a835efffb979739ce17a3c065099e677019e498e78d9a4222ff2d66c
Size (bleach-3.3.1.tar.gz) = 183687 bytes
BLAKE2s (bleach-6.0.0.tar.gz) = 432e39ccc0e24eddc845c03c9734074685ee0de23a06cba1e827b27b532b8d21
SHA512 (bleach-6.0.0.tar.gz) = 95900e4347c1f7d0aa5b2e8fbf43fac6410dd6bbbac988fb3f407a964d0aa1dc51fe3cf17459e6ce762a02b45bb3d20b539ca05727278d120aee9500cf0d208a
Size (bleach-6.0.0.tar.gz) = 201298 bytes

0 comments on commit 898fe97

Please sign in to comment.