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

Subscribers

People subscribed via source and target branches