Skip to content

Commit

Permalink
Merge pull request #387 from willkg/vendor-html5lib
Browse files Browse the repository at this point in the history
vendor html5lib 1.0.1
  • Loading branch information
willkg committed Aug 28, 2018
2 parents f5fa97b + ba37abe commit a06cd77
Show file tree
Hide file tree
Showing 60 changed files with 14,427 additions and 63 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ pip-log.txt
.coverage
dist
*.egg-info
.noseids
build
.tox
docs/_build/
.cache/
.eggs/
.*env*/
.pytest_cache/
.python-version
*~
*.swp
__pycache__
25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,30 @@ language: python
cache:
directories:
- "~/.cache/pip"

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "pypy"
env:
- HTML5LIB=0.99999999 # 8
- HTML5LIB=0.999999999 # 9
- HTML5LIB=1.0b9
- HTML5LIB=1.0b10
- HTML5LIB=1.0.1

install:
# html5lib 0.99999999 (8 9s) requires at least setuptools 18.5
- pip install -U pip setuptools>=18.5
- pip install -r requirements-dev.txt
# stomp on html5lib install with the specified one
- pip install html5lib==$HTML5LIB

matrix:
include:
- python: 2.7
env: MODE=lint
- python: 2.7
env: MODE=vendorverify
- python: 3.4
env: MODE=lint

script:
- py.test
- flake8 bleach/
- ./scripts/run_tests.sh $MODE

deploy:
provider: pypi
user: jezdez
Expand Down
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ None

**Features**

None
* No longer depends on html5lib. html5lib==1.0.1 was vendored into Bleach.
(#386)

**Bug fixes**

Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ include README.rst
include docs/conf.py
include docs/Makefile

recursive-include docs *.rst
include scripts/*

recursive-include bleach *.py *.json *.rst *.sh *.txt INSTALLER METADATA RECORD WHEEL
recursive-include docs *.rst
recursive-include tests *.py *.test

recursive-include tests_website *.html *.py *.rst
15 changes: 0 additions & 15 deletions bleach/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import unicode_literals

import warnings
from pkg_resources import parse_version

from bleach.linkifier import (
Expand All @@ -18,20 +17,6 @@
)


import html5lib
try:
_html5lib_version = html5lib.__version__.split('.')
if len(_html5lib_version) < 2:
_html5lib_version = _html5lib_version + ['0']
except Exception:
_h5ml5lib_version = ['unknown', 'unknown']


# Bleach 3.0.0 won't support html5lib-python < 1.0.0.
if _html5lib_version < ['1', '0'] or 'b' in _html5lib_version[1]:
warnings.warn('Support for html5lib-python < 1.0.0 is deprecated.', DeprecationWarning)


# yyyymmdd
__releasedate__ = ''
# x.y.z or x.y.z.dev0 -- semver
Expand Down
37 changes: 37 additions & 0 deletions bleach/_vendor/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
=======================
Vendored library policy
=======================

To simplify Bleach development, we're now vendoring certain libraries that
we use.

Vendored libraries must follow these rules:

1. Vendored libraries must be pure Python--no compiling.
2. Source code for the libary is included in this directory.
3. License must be included in this repo and in the Bleach distribution.
4. Requirements of the library become requirements of Bleach.
5. No modifications to the library may be made.


Adding/Updating a vendored library
==================================

Way to vendor a library or update a version:

1. Update ``vendor.txt`` with the library, version, and hash. You can use
`hashin <https://pypi.org/project/hashin/>`_.
2. Remove all old files and directories of the old version.
3. Run ``pip_install_vendor.sh`` and check everything it produced in including
the ``.dist-info`` directory and contents.


Reviewing a change involving a vendored library
===============================================

Way to verify a vendored library addition/update:

1. Pull down the branch.
2. Delete all the old files and directories of the old version.
3. Run ``pip_install_vendor.sh``.
4. Run ``git diff`` and verify there are no changes.
Empty file added bleach/_vendor/__init__.py
Empty file.

0 comments on commit a06cd77

Please sign in to comment.