Patchwork test-install: embed wix namespace for Python 2.6 compatibility

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 23, 2015, 2:10 p.m.
Message ID <8eedefa37cbff3925507.1450879804@mimosa>
Download mbox | patch
Permalink /patch/12294/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Yuya Nishihara - Dec. 23, 2015, 2:10 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1450878528 -32400
#      Wed Dec 23 22:48:48 2015 +0900
# Node ID 8eedefa37cbff3925507f3e5f54475c87b5393e6
# Parent  bdabb610a7cbb97f162f0668eab6ac383b7a31e7
test-install: embed wix namespace for Python 2.6 compatibility

According to doc, the syntax is "{uri}tag".

https://docs.python.org/2.7/library/xml.etree.elementtree.html#parsing-xml-with-namespaces
Matt Harbison - Dec. 23, 2015, 7:50 p.m.
On Wed, 23 Dec 2015 09:10:04 -0500, Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1450878528 -32400
> #      Wed Dec 23 22:48:48 2015 +0900
> # Node ID 8eedefa37cbff3925507f3e5f54475c87b5393e6
> # Parent  bdabb610a7cbb97f162f0668eab6ac383b7a31e7
> test-install: embed wix namespace for Python 2.6 compatibility

Works for me, thanks.
Yuya Nishihara - Dec. 26, 2015, 12:58 p.m.
On Wed, 23 Dec 2015 14:50:13 -0500, Matt Harbison wrote:
> On Wed, 23 Dec 2015 09:10:04 -0500, Yuya Nishihara <yuya@tcha.org> wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1450878528 -32400
> > #      Wed Dec 23 22:48:48 2015 +0900
> > # Node ID 8eedefa37cbff3925507f3e5f54475c87b5393e6
> > # Parent  bdabb610a7cbb97f162f0668eab6ac383b7a31e7
> > test-install: embed wix namespace for Python 2.6 compatibility
> 
> Works for me, thanks.

Thanks, pushed to the clowncopter.

Patch

diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -53,13 +53,13 @@  path variables are expanded (~ is the sa
   > 
   > def directory(node, relpath):
   >     '''generator of files in the xml node, rooted at relpath'''
-  >     dirs = node.findall('./wix:Directory', ns)
+  >     dirs = node.findall('./{%(wix)s}Directory' % ns)
   > 
   >     for d in dirs:
   >         for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
   >             yield subfile
   > 
-  >     files = node.findall('./wix:Component/wix:File', ns)
+  >     files = node.findall('./{%(wix)s}Component/{%(wix)s}File' % ns)
   > 
   >     for f in files:
   >         yield relpath + f.attrib['Name']
@@ -83,7 +83,7 @@  path variables are expanded (~ is the sa
   > 
   > xml = ET.parse("%s/../contrib/wix/%s.wxs" % (testdir, sys.argv[1]))
   > root = xml.getroot()
-  > dir = root.find('.//wix:DirectoryRef', ns)
+  > dir = root.find('.//{%(wix)s}DirectoryRef' % ns)
   > 
   > installed = [f for f in directory(dir, '')]
   >