commit:     b056103962b4ecff159549327f4b5219ebdfafaf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 28 18:41:17 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar 28 19:05:34 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0561039

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 ++++++++++++++++++++++
 ...9999-r1.ebuild => html5lib-0.9999999-r2.ebuild} |  1 +
 2 files changed, 51 insertions(+)

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 00000000000..c64cbe1ab3f
--- /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-r2.ebuild
similarity index 94%
rename from dev-python/html5lib/html5lib-0.9999999-r1.ebuild
rename to dev-python/html5lib/html5lib-0.9999999-r2.ebuild
index 44163d3c076..5b23d984fc3 100644
--- a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild
+++ b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild
@@ -24,6 +24,7 @@ DEPEND="${RDEPEND}
 
 PATCHES=(
        "${FILESDIR}"/${P}-lxml-3.5.0-backport.patch
+       "${FILESDIR}"/${P}-python3.6-sanitizer-re.patch
 )
 
 python_test() {

Reply via email to