Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/feedparser/files: feedparser-5.1-sgmllib.patch
Date: Tue, 03 Jan 2012 04:18:25
Message-Id: 20120103041813.12FCB2004B@flycatcher.gentoo.org
1 floppym 12/01/03 04:18:13
2
3 Added: feedparser-5.1-sgmllib.patch
4 Log:
5 Version bump for bug 393639. Thanks to Johan Bergström and Arfrever. Includes patch by sping. Fails tests.
6
7 (Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 dev-python/feedparser/files/feedparser-5.1-sgmllib.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/feedparser/files/feedparser-5.1-sgmllib.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/feedparser/files/feedparser-5.1-sgmllib.patch?rev=1.1&content-type=text/plain
14
15 Index: feedparser-5.1-sgmllib.patch
16 ===================================================================
17 From 812793c07d3202d3f5bc39091aec2e7071d000c8 Mon Sep 17 00:00:00 2001
18 From: Sebastian Pipping <sebastian@×××××××.org>
19 Date: Sun, 1 Jan 2012 19:30:57 +0100
20 Subject: [PATCH] Use shipped sgmllib for Python 3.x
21
22 ---
23 feedparser/feedparser.py | 19 +++----------------
24 setup.py | 2 +-
25 2 files changed, 4 insertions(+), 17 deletions(-)
26
27 diff --git a/feedparser/feedparser.py b/feedparser/feedparser.py
28 index 8275c29..9a8a053 100644
29 --- a/feedparser/feedparser.py
30 +++ b/feedparser/feedparser.py
31 @@ -204,17 +204,9 @@ else:
32 try:
33 import sgmllib
34 except ImportError:
35 - # This is probably Python 3, which doesn't include sgmllib anymore
36 - _SGML_AVAILABLE = 0
37 + import _feedparser_sgmllib as sgmllib
38
39 - # Mock sgmllib enough to allow subclassing later on
40 - class sgmllib(object):
41 - class SGMLParser(object):
42 - def goahead(self, i):
43 - pass
44 - def parse_starttag(self, i):
45 - pass
46 -else:
47 +if True:
48 _SGML_AVAILABLE = 1
49
50 # sgmllib defines a number of module-level regular expressions that are
51 @@ -2520,9 +2512,6 @@ class _RelativeURIResolver(_BaseHTMLProcessor):
52 _BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
53
54 def _resolveRelativeURIs(htmlSource, baseURI, encoding, _type):
55 - if not _SGML_AVAILABLE:
56 - return htmlSource
57 -
58 p = _RelativeURIResolver(baseURI, encoding, _type)
59 p.feed(htmlSource)
60 return p.output()
61 @@ -2803,8 +2792,6 @@ class _HTMLSanitizer(_BaseHTMLProcessor):
62
63
64 def _sanitizeHTML(htmlSource, encoding, _type):
65 - if not _SGML_AVAILABLE:
66 - return htmlSource
67 p = _HTMLSanitizer(encoding, _type)
68 htmlSource = htmlSource.replace('<![CDATA[', '&lt;![CDATA[')
69 p.feed(htmlSource)
70 @@ -3890,7 +3877,7 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
71 result['bozo'] = 1
72 result['bozo_exception'] = feedparser.exc or e
73 use_strict_parser = 0
74 - if not use_strict_parser and _SGML_AVAILABLE:
75 + if not use_strict_parser:
76 feedparser = _LooseFeedParser(baseuri, baselang, 'utf-8', entities)
77 feedparser.feed(data.decode('utf-8', 'replace'))
78 result['feed'] = feedparser.feeddata
79 diff --git a/setup.py b/setup.py
80 index a4a60fe..8c15451 100644
81 --- a/setup.py
82 +++ b/setup.py
83 @@ -16,7 +16,7 @@ setup(
84 download_url = 'http://code.google.com/p/feedparser/',
85 platforms = ['POSIX', 'Windows'],
86 package_dir = {'': 'feedparser'},
87 - py_modules = ['feedparser'],
88 + py_modules = ['feedparser', '_feedparser_sgmllib'],
89 keywords = ['atom', 'cdf', 'feed', 'parser', 'rdf', 'rss'],
90 classifiers = [
91 'Development Status :: 5 - Production/Stable',
92 --
93 1.7.8.1