1 |
commit: b056103962b4ecff159549327f4b5219ebdfafaf |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 28 18:41:17 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 28 19:05:34 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0561039 |
7 |
|
8 |
dev-python/html5lib: fix for python3.6 (bug 613656) |
9 |
|
10 |
Package-Manager: Portage-2.3.5, Repoman-2.3.2 |
11 |
|
12 |
...html5lib-0.9999999-python3.6-sanitizer-re.patch | 50 ++++++++++++++++++++++ |
13 |
...9999-r1.ebuild => html5lib-0.9999999-r2.ebuild} | 1 + |
14 |
2 files changed, 51 insertions(+) |
15 |
|
16 |
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 |
17 |
new file mode 100644 |
18 |
index 00000000000..c64cbe1ab3f |
19 |
--- /dev/null |
20 |
+++ b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch |
21 |
@@ -0,0 +1,50 @@ |
22 |
+--- a/html5lib/sanitizer.py |
23 |
++++ b/html5lib/sanitizer.py |
24 |
+@@ -203,7 +203,7 @@ |
25 |
+ for attr in self.attr_val_is_uri: |
26 |
+ if attr not in attrs: |
27 |
+ continue |
28 |
+- val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '', |
29 |
++ val_unescaped = re.sub(r"[`\000-\040\177-\240\s]+", '', |
30 |
+ unescape(attrs[attr])).lower() |
31 |
+ # remove replacement characters from unescaped characters |
32 |
+ val_unescaped = val_unescaped.replace("\ufffd", "") |
33 |
+@@ -228,7 +228,7 @@ |
34 |
+ ' ', |
35 |
+ unescape(attrs[attr])) |
36 |
+ if (token["name"] in self.svg_allow_local_href and |
37 |
+- 'xlink:href' in attrs and re.search('^\s*[^#\s].*', |
38 |
++ 'xlink:href' in attrs and re.search(r'^\s*[^#\s].*', |
39 |
+ attrs['xlink:href'])): |
40 |
+ del attrs['xlink:href'] |
41 |
+ if 'style' in attrs: |
42 |
+@@ -257,16 +257,16 @@ |
43 |
+ |
44 |
+ def sanitize_css(self, style): |
45 |
+ # disallow urls |
46 |
+- style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) |
47 |
++ style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style) |
48 |
+ |
49 |
+ # gauntlet |
50 |
+- if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): |
51 |
++ if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style): |
52 |
+ return '' |
53 |
+- if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): |
54 |
++ if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style): |
55 |
+ return '' |
56 |
+ |
57 |
+ clean = [] |
58 |
+- for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style): |
59 |
++ for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style): |
60 |
+ if not value: |
61 |
+ continue |
62 |
+ if prop.lower() in self.allowed_css_properties: |
63 |
+@@ -275,7 +275,7 @@ |
64 |
+ 'padding']: |
65 |
+ for keyword in value.split(): |
66 |
+ if keyword not in self.acceptable_css_keywords and \ |
67 |
+- 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): |
68 |
++ 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): |
69 |
+ break |
70 |
+ else: |
71 |
+ clean.append(prop + ': ' + value + ';') |
72 |
|
73 |
diff --git a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild |
74 |
similarity index 94% |
75 |
rename from dev-python/html5lib/html5lib-0.9999999-r1.ebuild |
76 |
rename to dev-python/html5lib/html5lib-0.9999999-r2.ebuild |
77 |
index 44163d3c076..5b23d984fc3 100644 |
78 |
--- a/dev-python/html5lib/html5lib-0.9999999-r1.ebuild |
79 |
+++ b/dev-python/html5lib/html5lib-0.9999999-r2.ebuild |
80 |
@@ -24,6 +24,7 @@ DEPEND="${RDEPEND} |
81 |
|
82 |
PATCHES=( |
83 |
"${FILESDIR}"/${P}-lxml-3.5.0-backport.patch |
84 |
+ "${FILESDIR}"/${P}-python3.6-sanitizer-re.patch |
85 |
) |
86 |
|
87 |
python_test() { |