From b056103962b4ecff159549327f4b5219ebdfafaf Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 28 Mar 2017 11:41:17 -0700 Subject: dev-python/html5lib: fix for python3.6 (bug 613656) Package-Manager: Portage-2.3.5, Repoman-2.3.2 --- ...html5lib-0.9999999-python3.6-sanitizer-re.patch | 50 ++++++++++++++++++++++ dev-python/html5lib/html5lib-0.9999999-r1.ebuild | 31 -------------- dev-python/html5lib/html5lib-0.9999999-r2.ebuild | 32 ++++++++++++++ 3 files changed, 82 insertions(+), 31 deletions(-) create mode 100644 dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch delete mode 100644 dev-python/html5lib/html5lib-0.9999999-r1.ebuild create mode 100644 dev-python/html5lib/html5lib-0.9999999-r2.ebuild (limited to 'dev-python/html5lib') diff --git a/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch new file mode 100644 index 000000000000..c64cbe1ab3f5 --- /dev/null +++ b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch @@ -0,0 +1,50 @@ +--- a/html5lib/sanitizer.py ++++ b/html5lib/sanitizer.py +@@ -203,7 +203,7 @@ + for attr in self.attr_val_is_uri: + if attr not in attrs: + continue +- val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '', ++ val_unescaped = re.sub(r"[`\000-\040\177-\240\s]+", '', + unescape(attrs[attr])).lower() + # remove replacement characters from unescaped characters + val_unescaped = val_unescaped.replace("\ufffd", "") +@@ -228,7 +228,7 @@ + ' ', + unescape(attrs[attr])) + if (token["name"] in self.svg_allow_local_href and +- 'xlink:href' in attrs and re.search('^\s*[^#\s].*', ++ 'xlink:href' in attrs and re.search(r'^\s*[^#\s].*', + attrs['xlink:href'])): + del attrs['xlink:href'] + if 'style' in attrs: +@@ -257,16 +257,16 @@ + + def sanitize_css(self, style): + # disallow urls +- style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) ++ style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) + + # gauntlet +- if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): ++ if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): + return '' +- if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): ++ if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): + return '' + + clean = [] +- for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style): ++ for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style): + if not value: + continue + if prop.lower() in self.allowed_css_properties: +@@ -275,7 +275,7 @@ + 'padding']: + for keyword in value.split(): + if keyword not in self.acceptable_css_keywords and \ +- not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): ++ not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword): + break + else: + clean.append(prop + ': ' + value + ';') diff --git a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild b/dev-python/html5lib/html5lib-0.9999999-r1.ebuild deleted file mode 100644 index 44163d3c0762..000000000000 --- a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 ) -PYTHON_REQ_USE="xml(+)" - -inherit distutils-r1 - -DESCRIPTION="HTML parser based on the HTML5 specification" -HOMEPAGE="https://github.com/html5lib/html5lib-python/ https://html5lib.readthedocs.org" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" -IUSE="test" - -RDEPEND="dev-python/six[${PYTHON_USEDEP}]" -DEPEND="${RDEPEND} - dev-python/setuptools[${PYTHON_USEDEP}] - test? ( dev-python/nose[${PYTHON_USEDEP}] )" - -PATCHES=( - "${FILESDIR}"/${P}-lxml-3.5.0-backport.patch -) - -python_test() { - nosetests --verbosity=3 || die "Tests fail with ${EPYTHON}" -} diff --git a/dev-python/html5lib/html5lib-0.9999999-r2.ebuild b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild new file mode 100644 index 000000000000..5b23d984fc3e --- /dev/null +++ b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild @@ -0,0 +1,32 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy pypy3 ) +PYTHON_REQ_USE="xml(+)" + +inherit distutils-r1 + +DESCRIPTION="HTML parser based on the HTML5 specification" +HOMEPAGE="https://github.com/html5lib/html5lib-python/ https://html5lib.readthedocs.org" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +IUSE="test" + +RDEPEND="dev-python/six[${PYTHON_USEDEP}]" +DEPEND="${RDEPEND} + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( dev-python/nose[${PYTHON_USEDEP}] )" + +PATCHES=( + "${FILESDIR}"/${P}-lxml-3.5.0-backport.patch + "${FILESDIR}"/${P}-python3.6-sanitizer-re.patch +) + +python_test() { + nosetests --verbosity=3 || die "Tests fail with ${EPYTHON}" +} -- cgit v1.2.3