From 5e0a3a5a492e98007193020f1980bf9c073a193b Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 25 Apr 2019 15:12:10 -0700 Subject: [PATCH] Try to figure out how to get lxml to add the namespace --- builders/windows-builder.py | 18 +++++++++--------- windows/OpenLP-base.wxs | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 6161365..f4f2946 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -103,7 +103,7 @@ from hashlib import md5 from shutil import copy, move, rmtree from lxml.etree import fromstring, tostring -from lxml.builder import E +from lxml.builder import E, ElementMaker from builder import Builder @@ -136,6 +136,8 @@ class WindowsBuilder(Builder): element = E.DirectoryRef(Id='INSTALLDIR') directories = {start_path: {'__dir__': element}} components = [] + FxE = ElementMaker(namespace='http://schemas.microsoft.com/wix/FirewallExtension', + nsmap={'fw': 'http://schemas.microsoft.com/wix/FirewallExtension'}) for root, _, files in os.walk(start_dir): parent = os.sep.join(root.replace(os.path.join(start_base, ''), '').split(os.sep)[:-1]) @@ -165,14 +167,12 @@ class WindowsBuilder(Builder): if 'OpenLP.exe' in source: description = 'Firewall exception for OpenLP\'s remote interface (UDP)' program = '[#file_e368869eb54b01e2288a3359b1cf51f8]' - component.append(E.FirewallException('fw:FirewallException', - Id='1797D56F-0AD4-81A6-6011-F8AE0B7CFB4F', Name='OpenLP', - Description=description, IgnoreFailure='yes', - Program=program, Protocol='tcp', Scope='any')) - component.append(E.FirewallException('fw:FirewallException', - Id='183115E6-A080-964D-4A4F-43880083F189', Name='OpenLP', - Description=description, IgnoreFailure='yes', - Program=program, Protocol='udp', Scope='any')) + component.append(FxE.FirewallException(Id='1797D56F-0AD4-81A6-6011-F8AE0B7CFB4F', Name='OpenLP', + Description=description, IgnoreFailure='yes', + Program=program, Protocol='tcp', Scope='any')) + component.append(FxE.FirewallException(Id='183115E6-A080-964D-4A4F-43880083F189', Name='OpenLP', + Description=description, IgnoreFailure='yes', + Program=program, Protocol='udp', Scope='any')) element.append(component) components.append(component) diff --git a/windows/OpenLP-base.wxs b/windows/OpenLP-base.wxs index f8ea96e..97afd71 100644 --- a/windows/OpenLP-base.wxs +++ b/windows/OpenLP-base.wxs @@ -1,7 +1,6 @@ + xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">