diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-03-28 11:41:17 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-03-28 12:05:34 -0700 |
commit | b056103962b4ecff159549327f4b5219ebdfafaf (patch) | |
tree | 48cede4e9dadca862f06756594492fbdabb49e89 /dev-python/html5lib | |
parent | dev-libs/libzip: D -> ED (diff) | |
download | gentoo-b056103962b4ecff159549327f4b5219ebdfafaf.tar.gz gentoo-b056103962b4ecff159549327f4b5219ebdfafaf.tar.bz2 gentoo-b056103962b4ecff159549327f4b5219ebdfafaf.zip |
dev-python/html5lib: fix for python3.6 (bug 613656)
Package-Manager: Portage-2.3.5, Repoman-2.3.2
Diffstat (limited to 'dev-python/html5lib')
-rw-r--r-- | dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch | 50 | ||||
-rw-r--r-- | dev-python/html5lib/html5lib-0.9999999-r2.ebuild (renamed from dev-python/html5lib/html5lib-0.9999999-r1.ebuild) | 1 |
2 files changed, 51 insertions, 0 deletions
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-r2.ebuild index 44163d3c0762..5b23d984fc3e 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() { |