Gentoo Archives: gentoo-commits

From: "Ralph Sennhauser (sera)" <sera@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-java/jython/files: jython-2.5.2-sax-parser-fix.patch
Date: Tue, 31 Jul 2012 08:44:59
Message-Id: 20120731084448.93FE92004C@flycatcher.gentoo.org
1 sera 12/07/31 08:44:48
2
3 Added: jython-2.5.2-sax-parser-fix.patch
4 Log:
5 Backport upstream sax fix, needed for javatoolkit and possibly others.
6 JYTHON_SYSTEM_CACHEDIR is buggy, every ebuild not inheriting python.eclass and calling python_pkg_setup would have to set it, also it's a per user system cache dir and so with reduced previleges can't even be created -> drop it.
7 Install sandbox control file as the jvm opens the classfiles rw.
8 Compile class files during src phases instead of creating orphans.
9
10 (Portage version: 2.1.11.9/cvs/Linux x86_64)
11
12 Revision Changes Path
13 1.1 dev-java/jython/files/jython-2.5.2-sax-parser-fix.patch
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-java/jython/files/jython-2.5.2-sax-parser-fix.patch?rev=1.1&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-java/jython/files/jython-2.5.2-sax-parser-fix.patch?rev=1.1&content-type=text/plain
17
18 Index: jython-2.5.2-sax-parser-fix.patch
19 ===================================================================
20
21 # HG changeset patch
22 # User Alan Kennedy <jython-dev@×××××.com>
23 # Date 1319980040 0
24 # Node ID 936bd1b132eb9c591cf915b060c6567ae8e16914
25 # Parent 71b3f883f6c5f0f39f0ae8aff097a439d4970f46
26 Fix for xml attribute namespaces issue
27 http://bugs.jython.org/issue1768
28
29 diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
30 --- a/Lib/test/test_sax.py
31 +++ b/Lib/test/test_sax.py
32 @@ -390,22 +390,23 @@ def test_expat_nsattrs_wattr():
33 gather = AttrGatherer()
34 parser.setContentHandler(gather)
35
36 - parser.parse(StringIO("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri))
37 + a_name = "id" ; a_val = "val"
38 + parser.parse(StringIO("<doc xmlns:ns='%s' ns:%s='%s'/>" % (ns_uri, a_name, a_val) ))
39
40 attrs = gather._attrs
41
42 return attrs.getLength() == 1 and \
43 - attrs.getNames() == [(ns_uri, "attr")] and \
44 - attrs.getQNames() == ["ns:attr"] and \
45 + attrs.getNames() == [(ns_uri, a_name)] and \
46 + attrs.getQNames() == ["ns:%s" % a_name] and \
47 len(attrs) == 1 and \
48 - attrs.has_key((ns_uri, "attr")) and \
49 - attrs.keys() == [(ns_uri, "attr")] and \
50 - attrs.get((ns_uri, "attr")) == "val" and \
51 - attrs.get((ns_uri, "attr"), 25) == "val" and \
52 - attrs.items() == [((ns_uri, "attr"), "val")] and \
53 - attrs.values() == ["val"] and \
54 - attrs.getValue((ns_uri, "attr")) == "val" and \
55 - attrs[(ns_uri, "attr")] == "val"
56 + attrs.has_key((ns_uri, a_name)) and \
57 + attrs.keys() == [(ns_uri, a_name)] and \
58 + attrs.get((ns_uri, a_name)) == a_val and \
59 + attrs.get((ns_uri, a_name), 25) == a_val and \
60 + attrs.items() == [((ns_uri, a_name), a_val)] and \
61 + attrs.values() == [a_val] and \
62 + attrs.getValue((ns_uri, a_name)) == a_val and \
63 + attrs[(ns_uri, a_name)] == a_val
64
65 def test_expat_nsattrs_no_namespace():
66 parser = make_parser()
67 @@ -413,22 +414,23 @@ def test_expat_nsattrs_no_namespace():
68 gather = AttrGatherer()
69 parser.setContentHandler(gather)
70
71 - parser.parse(StringIO("<doc attr='val'/>"))
72 + a_name = "id" ; a_val = "val"
73 + parser.parse(StringIO("<doc %s='%s'/>" % (a_name, a_val) ))
74
75 attrs = gather._attrs
76
77 return attrs.getLength() == 1 and \
78 - attrs.getNames() == [(None, "attr")] and \
79 - attrs.getQNames() == ["attr"] and \
80 + attrs.getNames() == [(None, a_name)] and \
81 + attrs.getQNames() == [a_name] and \
82 len(attrs) == 1 and \
83 - attrs.has_key((None, "attr")) and \
84 - attrs.keys() == [(None, "attr")] and \
85 - attrs.get((None, "attr")) == "val" and \
86 - attrs.get((None, "attr"), 25) == "val" and \
87 - attrs.items() == [((None, "attr"), "val")] and \
88 - attrs.values() == ["val"] and \
89 - attrs.getValue((None, "attr")) == "val" and \
90 - attrs[(None, "attr")] == "val"
91 + attrs.has_key((None, a_name)) and \
92 + attrs.keys() == [(None, a_name)] and \
93 + attrs.get((None, a_name)) == a_val and \
94 + attrs.get((None, a_name), 25) == a_val and \
95 + attrs.items() == [((None, a_name), a_val)] and \
96 + attrs.values() == [a_val] and \
97 + attrs.getValue((None, a_name)) == a_val and \
98 + attrs[(None, a_name)] == a_val
99
100 # ===== InputSource support
101
102 diff --git a/Lib/xml/sax/drivers2/drv_javasax.py b/Lib/xml/sax/drivers2/drv_javasax.py
103 --- a/Lib/xml/sax/drivers2/drv_javasax.py
104 +++ b/Lib/xml/sax/drivers2/drv_javasax.py
105 @@ -238,7 +238,7 @@ class JavaSAXParser(xmlreader.XMLReader,
106 pass # TODO
107
108 def _fixTuple(nsTuple, frm, to):
109 - if len(nsTuple) == 2:
110 + if isinstance(nsTuple, tuple) and len(nsTuple) == 2:
111 nsUri, localName = nsTuple
112 if nsUri == frm:
113 nsUri = to