Merge lp:~osomon/ubuntu-themes/scavenge-preserve-namespaces into lp:ubuntu-themes

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 633
Proposed branch: lp:~osomon/ubuntu-themes/scavenge-preserve-namespaces
Merge into: lp:ubuntu-themes
Diff against target: 50 lines (+16/-2)
2 files modified
debian/changelog (+7/-0)
scavenge.py (+9/-2)
To merge this branch: bzr merge lp:~osomon/ubuntu-themes/scavenge-preserve-namespaces
Reviewer Review Type Date Requested Status
Iain Lane Approve
Review via email: mp+380776@code.launchpad.net
To post a comment you must log in.
633. By Olivier Tilloy

Fix for Python3 compatibility.

Revision history for this message
Iain Lane (laney) wrote :

Looks like this was uploaded but never merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2019-02-13 14:45:59 +0000
3+++ debian/changelog 2020-03-17 15:44:00 +0000
4@@ -1,3 +1,10 @@
5+ubuntu-themes (19.04-0ubuntu3) UNRELEASED; urgency=medium
6+
7+ * Preserve namespace declarations in the script that combines multiple
8+ SVG files into one (LP: #1867766)
9+
10+ -- Olivier Tilloy <olivier.tilloy@canonical.com> Tue, 17 Mar 2020 15:58:56 +0100
11+
12 ubuntu-themes (19.04-0ubuntu1) disco; urgency=medium
13
14 [ Khurshid Alam ]
15
16=== modified file 'scavenge.py'
17--- scavenge.py 2012-12-11 09:58:35 +0000
18+++ scavenge.py 2020-03-17 15:44:00 +0000
19@@ -2,7 +2,8 @@
20 # Copyright 2011 Canonical Ltd. Distributed under the terms of the GNU GPLv3.
21 # Combines multiple SVG files into a single SVG in batch mode
22 # 2011-01-04 Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
23-# 2011-01-05 Paul Sladen <sladen@canonica.com>
24+# 2011-01-05 Paul Sladen <sladen@canonical.com>
25+# 2020-03-17 Olivier Tilloy <olivier.tilloy@canonical.com>
26
27 import xml.dom.minidom
28 import sys
29@@ -31,6 +32,7 @@
30
31 # Open first SVG and then composite others on top as overlays
32 base = xml.dom.minidom.parse(args[0])
33+ root = base.getElementsByTagName("svg")[0]
34 newline = lambda: base.createTextNode('\n')
35
36 for overlay in args[1:]:
37@@ -39,7 +41,12 @@
38
39 # Pull-in '<svg>' tag, clear attributes and rename to '<g>'
40 g = base.importNode(dom.getElementsByTagName("svg")[0], deep = True)
41- [g.removeAttribute(k) for k in g.attributes.keys() if k != 'id']
42+ for k in list(g.attributes.keys()):
43+ if k.startswith('xmlns:'):
44+ # Preserve namespace declarations (LP: #1867766)
45+ root.setAttributeNS('', k, g.getAttribute(k))
46+ if k != 'id':
47+ g.removeAttribute(k)
48 g.tagName = 'g'
49
50 # Insert into first SVG with comments and spacing

Subscribers

People subscribed via source and target branches