1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 04:52:50 +00:00

Try to figure out how to get lxml to add the namespace

This commit is contained in:
Raoul Snyman 2019-04-25 15:12:10 -07:00
parent 10d421b619
commit 5e0a3a5a49
2 changed files with 10 additions and 11 deletions

View File

@ -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)

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:fw="http://schemas.microsoft.com/wix/FirewallExtension">
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define ProductName="OpenLP"?>
<?define ProductCode="*"?>
<?define ProductVersion="%(version)s"?>