From 86dc69b6a4e0f12060b6f49a566e86dce091cfc4 Mon Sep 17 00:00:00 2001 From: derwinlu Date: Mon, 19 Oct 2015 16:30:52 +0200 Subject: [PATCH 1/3] Add python 3.5 testing environment Python 3.5 is not yet fully available via travis. Includes workaround to enables it for now. --- .travis.yml | 5 +++++ tox.ini | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1be196f2..7bb5a89f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,11 @@ env: - TOX_ENV=py27 - TOX_ENV=py33 - TOX_ENV=py34 +matrix: + include: + - python: 3.5 + env: + - TOX_ENV=py35 addons: apt_packages: - pandoc diff --git a/tox.ini b/tox.ini index 56ad0c14..151fad85 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,12 @@ [tox] -envlist = py{27,33,34},docs,flake8 +envlist = py{27,33,34,35},docs,flake8 [testenv] basepython = py27: python2.7 py33: python3.3 py34: python3.4 + py35: python3.5 passenv = * usedevelop=True deps = From 61c371b27ea5b019aa7552219f6c7f671e7ac467 Mon Sep 17 00:00:00 2001 From: derwinlu Date: Mon, 19 Oct 2015 19:26:31 +0200 Subject: [PATCH 2/3] Add 3.5 to setup.py tags --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 86028424..99cf7cb0 100755 --- a/setup.py +++ b/setup.py @@ -55,6 +55,7 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Libraries :: Python Modules', ], From 8a696078cfcb0b19c01391db6081ace7fbadda47 Mon Sep 17 00:00:00 2001 From: derwinlu Date: Mon, 19 Oct 2015 18:33:14 +0200 Subject: [PATCH 3/3] Make HTMLParser Python 3.5 ready --- pelican/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pelican/utils.py b/pelican/utils.py index cc9eb405..92e819f9 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -424,7 +424,11 @@ class _HTMLWordTruncator(HTMLParser): def __init__(self, max_words): # In Python 2, HTMLParser is not a new-style class, # hence super() cannot be used. - HTMLParser.__init__(self) + try: + HTMLParser.__init__(self, convert_charrefs=False) + except TypeError: + # pre Python 3.3 + HTMLParser.__init__(self) self.max_words = max_words self.words_found = 0