Build the Wix wxs file on the fly

This commit is contained in:
Micah Lee 2020-10-28 12:13:09 -07:00
parent 269cf5b431
commit 10dfc1441b
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
6 changed files with 235 additions and 235 deletions

3
.gitignore vendored
View file

@ -131,4 +131,5 @@ dmypy.json
.vscode .vscode
*.tar.gz *.tar.gz
deb_dist deb_dist
.DS_Store .DS_Store
install/windows/Dangerzone.wxs

View file

@ -113,8 +113,8 @@ Download and install the [Windows 10 SDK](https://developer.microsoft.com/en-US/
Add the following directories to the path: Add the following directories to the path:
* `C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86` * `C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86`
* `C:\Program Files (x86)\Windows Kits\10\Redist\10.0.18362.0\ucrt\DLLs\x86` * `C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86`
### If you want the .exe to not get falsely flagged as malicious by anti-virus software ### If you want the .exe to not get falsely flagged as malicious by anti-virus software
@ -122,7 +122,7 @@ Dangerzone uses PyInstaller to turn the python source code into Windows executab
Here's how to compile the PyInstaller bootloader: Here's how to compile the PyInstaller bootloader:
Download and install [Microsoft Build Tools for Visual Studio 2017](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019). I downloaded `vs_buildtools__1378184674.1581551596.exe`. In the installer, check the box next to "C++ build tools". Click "Individual components", and under "Compilers, build tools and runtimes", check "Windows Universal CRT SDK". Then click install. When installation is done, you may have to reboot your computer. Download and install [Microsoft Build Tools for Visual Studio 2019](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019). I downloaded `vs_buildtools__719988613.1603831511.exe`. In the installer, check the box next to "C++ build tools". Click "Individual components", and under "Compilers, build tools and runtimes", check "Windows Universal CRT SDK". Then click install. When installation is done, you may have to reboot your computer.
Then, enable the 32-bit Visual C++ Toolset on the Command Line like this: Then, enable the 32-bit Visual C++ Toolset on the Command Line like this:
@ -136,7 +136,7 @@ Change to a folder where you keep source code, and clone the PyInstaller git rep
``` ```
git clone https://github.com/pyinstaller/pyinstaller.git git clone https://github.com/pyinstaller/pyinstaller.git
cd pyinstaller cd pyinstaller
git tag -v v3.6 git tag -v v4.0
``` ```
(Note that ideally you would verify the git tag, but the PGP key that has signed the v3.5 git tag for is not published anywhere, so this isn't possible. See [this issue](https://github.com/pyinstaller/pyinstaller/issues/4430).) (Note that ideally you would verify the git tag, but the PGP key that has signed the v3.5 git tag for is not published anywhere, so this isn't possible. See [this issue](https://github.com/pyinstaller/pyinstaller/issues/4430).)
@ -170,7 +170,7 @@ Now the next time you use PyInstaller to build dangerzone, the `.exe` file shoul
* Go to https://dotnet.microsoft.com/download/dotnet-framework and download and install .NET Framework 3.5 SP1 Runtime. I downloaded `dotnetfx35.exe`. * Go to https://dotnet.microsoft.com/download/dotnet-framework and download and install .NET Framework 3.5 SP1 Runtime. I downloaded `dotnetfx35.exe`.
* Go to https://wixtoolset.org/releases/ and download and install WiX toolset. I downloaded `wix311.exe`. * Go to https://wixtoolset.org/releases/ and download and install WiX toolset. I downloaded `wix311.exe`.
* Add `C:\Program Files (x86)\WiX Toolset v3.1.1\bin` to the path. * Add `C:\Program Files (x86)\WiX Toolset v3.11\bin` to the path.
### If you want to sign binaries with Authenticode ### If you want to sign binaries with Authenticode

View file

@ -8,7 +8,6 @@ Before making a release, all of these should be complete:
* Update `version` in `pyproject.toml` * Update `version` in `pyproject.toml`
* Update `dangerzone_version` in `dangerzone/__init__.py` * Update `dangerzone_version` in `dangerzone/__init__.py`
* Update `ProductVersion` in `install/windows/Dangerzone.wxs`
* Update version and download links in `README.md` * Update version and download links in `README.md`
* CHANGELOG.md should be updated to include a list of all major changes since the last release * CHANGELOG.md should be updated to include a list of all major changes since the last release
* There must be a PGP-signed git tag for the version, e.g. for dangerzone 0.1.0, the tag must be `v0.1.0` * There must be a PGP-signed git tag for the version, e.g. for dangerzone 0.1.0, the tag must be `v0.1.0`

View file

@ -1,228 +0,0 @@
<?xml version='1.0' encoding='windows-1252'?>
<?define ProductVersion = "0.1.2"?>
<?define ProductUpgradeCode = "12b9695c-965b-4be0-bc33-21274e809576"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name="Dangerzone" Manufacturer="First Look Media" Id="f40ff0a9-ebf8-4e1e-9bce-6ab5c74fe119" UpgradeCode="$(var.ProductUpgradeCode)" Language="1033" Codepage="1252" Version="$(var.ProductVersion)">
<Package Id="*" Keywords="Installer" Description="Dangerzone $(var.ProductVersion) Installer" Manufacturer="First Look Media" InstallerVersion="100" Languages="1033" Compressed="yes" SummaryCodepage="1252" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Icon Id="ProductIcon" SourceFile="..\..\share\dangerzone.ico"/>
<Property Id="ARPPRODUCTICON" Value="ProductIcon"/>
<Property Id="ARPHELPLINK" Value="https://github.com/firstlookmedia/dangerzone"/>
<Property Id="ARPURLINFOABOUT" Value="https://tech.firstlook.media"/>
<UIRef Id="WixUI_Minimal" />
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUILicenseRtf" Value="..\..\install\windows\license.rtf" />
<WixVariable Id="WixUIDialogBmp" Value="..\..\install\windows\dialog.bmp" />
<Upgrade Id="$(var.ProductUpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Minimum="0.0.0" Maximum="$(var.ProductVersion)" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/>
</Upgrade>
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Dangerzone">
<Directory Id="FolderCertifi" Name="certifi" />
<Directory Id="FolderInclude" Name="Include" />
<Directory Id="FolderPyQt5" Name="PyQt5">
<Directory Id="FolderPyQt5Qt" Name="Qt">
<Directory Id="FolderPyQt5QtPlugins" Name="plugins">
<Directory Id="FolderPyQt5QtPluginsIconengines" Name="iconengines" />
<Directory Id="FolderPyQt5QtPluginsImageformats" Name="imageformats" />
<Directory Id="FolderPyQt5QtPluginsPlatforms" Name="platforms" />
<Directory Id="FolderPyQt5QtPluginsPlatformthemes" Name="platformthemes" />
<Directory Id="FolderPyQt5QtPluginsStyles" Name="styles" />
</Directory>
<Directory Id="FolderPyQt5QtTranslations" Name="translations" />
</Directory>
</Directory>
<Directory Id="FolderShare" Name="share" />
<Directory Id="FolderWin32com" Name="win32com">
<Directory Id="FolderWin32comShell" Name="shell" />
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuSubfolder" Name="Dangerzone">
<Component Id="ApplicationShortcuts" Guid="539e7de8-a124-4c09-aa55-0dd516aad7bc">
<Shortcut Id="ApplicationShortcut1" Name="Dangerzone" Description="Dangerzone" Target="[INSTALLDIR]dangerzone.exe" WorkingDirectory="INSTALLDIR"/>
<RegistryValue Root="HKCU" Key="Software\First Look Media\Dangerzone" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<RemoveFolder Id="ProgramMenuSubfolder" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id="ApplicationFiles" Guid="23577d98-707d-48c8-b11c-edd58fd0c742">
<File Source="..\..\dist\dangerzone\base_library.zip" />
<File Source="..\..\dist\dangerzone\d3dcompiler_47.dll" />
<File Source="..\..\dist\dangerzone\dangerzone.exe" />
<File Source="..\..\dist\dangerzone\dangerzone.exe.manifest" />
<File Source="..\..\dist\dangerzone\dangerzone-container.exe" />
<File Source="..\..\dist\dangerzone\libcrypto-1_1.dll" />
<File Source="..\..\dist\dangerzone\libEGL.dll" />
<File Source="..\..\dist\dangerzone\libGLESv2.dll" />
<File Source="..\..\dist\dangerzone\libssl-1_1.dll" />
<File Source="..\..\dist\dangerzone\mfc140u.dll" />
<File Source="..\..\dist\dangerzone\opengl32sw.dll" />
<File Source="..\..\dist\dangerzone\pyexpat.pyd" />
<File Source="..\..\dist\dangerzone\python3.dll" />
<File Source="..\..\dist\dangerzone\python37.dll" />
<File Source="..\..\dist\dangerzone\pythoncom37.dll" />
<File Source="..\..\dist\dangerzone\pywintypes37.dll" />
<File Source="..\..\dist\dangerzone\Qt5Core.dll" />
<File Source="..\..\dist\dangerzone\Qt5DBus.dll" />
<File Source="..\..\dist\dangerzone\Qt5Gui.dll" />
<File Source="..\..\dist\dangerzone\Qt5Network.dll" />
<File Source="..\..\dist\dangerzone\Qt5Qml.dll" />
<File Source="..\..\dist\dangerzone\Qt5QmlModels.dll" />
<File Source="..\..\dist\dangerzone\Qt5Quick.dll" />
<File Source="..\..\dist\dangerzone\Qt5Svg.dll" />
<File Source="..\..\dist\dangerzone\Qt5WebSockets.dll" />
<File Source="..\..\dist\dangerzone\Qt5Widgets.dll" />
<File Source="..\..\dist\dangerzone\select.pyd" />
<File Source="..\..\dist\dangerzone\unicodedata.pyd" />
<File Source="..\..\dist\dangerzone\VCRUNTIME140.dll" />
<File Source="..\..\dist\dangerzone\win32api.pyd" />
<File Source="..\..\dist\dangerzone\win32trace.pyd" />
<File Source="..\..\dist\dangerzone\win32ui.pyd" />
<File Source="..\..\dist\dangerzone\win32wnet.pyd" />
<File Source="..\..\dist\dangerzone\_bz2.pyd" />
<File Source="..\..\dist\dangerzone\_ctypes.pyd" />
<File Source="..\..\dist\dangerzone\_hashlib.pyd" />
<File Source="..\..\dist\dangerzone\_lzma.pyd" />
<File Source="..\..\dist\dangerzone\_queue.pyd" />
<File Source="..\..\dist\dangerzone\_socket.pyd" />
<File Source="..\..\dist\dangerzone\_ssl.pyd" />
<File Source="..\..\dist\dangerzone\_win32sysloader.pyd" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderCertifi">
<Component Id="FolderComponentCertifi" Guid="f4adfd38-e0b0-4b2d-9e14-f6983ef61f76">
<File Source="..\..\dist\dangerzone\certifi\cacert.pem" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderInclude">
<Component Id="FolderComponentInclude" Guid="d8c037d1-b6b0-4d41-a135-cc32dd7199a4">
<File Source="..\..\dist\dangerzone\Include\pyconfig.h" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5">
<Component Id="FolderComponentPyQt5" Guid="c91cd65a-60c0-40b9-8db7-e6a282daae39">
<File Source="..\..\dist\dangerzone\PyQt5\QtCore.pyd" />
<File Source="..\..\dist\dangerzone\PyQt5\QtGui.pyd" />
<File Source="..\..\dist\dangerzone\PyQt5\QtWidgets.pyd" />
<File Source="..\..\dist\dangerzone\PyQt5\sip.cp37-win32.pyd" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtPluginsIconengines">
<Component Id="FolderComponentPyQt5QtPluginsIconengines" Guid="95c6a8f4-68b1-4ec4-93b3-939fdc8290f6">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\iconengines\qsvgicon.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtPluginsImageformats">
<Component Id="FolderComponentPyQt5QtPluginsImageformats" Guid="e32063ed-6b60-4db2-a4ed-2b1b696c8faf">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qgif.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qicns.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qico.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qjpeg.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qsvg.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qtga.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qtiff.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qwbmp.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\imageformats\qwebp.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtPluginsPlatforms">
<Component Id="FolderComponentPyQt5QtPluginsPlatforms" Guid="83be9e94-7667-4fc6-b507-3f6f0935fa3d">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\platforms\qminimal.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\platforms\qoffscreen.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\platforms\qwebgl.dll" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\platforms\qwindows.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtPluginsPlatformthemes">
<Component Id="FolderComponentPyQt5QtPluginsPlatformthemes" Guid="82847ea1-6094-41be-b366-cb7215f06552">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\platformthemes\qxdgdesktopportal.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtPluginsStyles">
<Component Id="FolderComponentPyQt5QtPluginsStyles" Guid="63f22a56-d6c6-4908-bce6-f02b8be2cb53">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\plugins\styles\qwindowsvistastyle.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderPyQt5QtTranslations">
<Component Id="FolderComponentPyQt5QtTranslations" Guid="bb438ebf-4195-4cc5-873e-70791163044e">
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_ar.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_bg.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_ca.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_cs.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_da.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_de.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_en.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_es.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_fi.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_fr.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_gd.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_he.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_hu.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_it.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_ja.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_ko.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_lv.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_pl.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_ru.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_sk.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_uk.qm" />
<File Source="..\..\dist\dangerzone\PyQt5\Qt\translations\qtbase_zh_TW.qm" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderShare">
<Component Id="FolderComponentShare" Guid="94ef9fae-990d-4dcb-bbf4-ca01b4debc20">
<File Source="..\..\dist\dangerzone\share\icon.png" />
</Component>
</DirectoryRef>
<DirectoryRef Id="FolderWin32comShell">
<Component Id="FolderComponentWin32comShell" Guid="b51f7768-64f2-4666-a919-736a6ae6c332">
<File Source="..\..\dist\dangerzone\win32com\shell\shell.pyd" />
</Component>
</DirectoryRef>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="ApplicationFiles" />
<ComponentRef Id="FolderComponentCertifi" />
<ComponentRef Id="FolderComponentInclude" />
<ComponentRef Id="FolderComponentPyQt5" />
<ComponentRef Id="FolderComponentPyQt5QtPluginsIconengines" />
<ComponentRef Id="FolderComponentPyQt5QtPluginsImageformats" />
<ComponentRef Id="FolderComponentPyQt5QtPluginsPlatforms" />
<ComponentRef Id="FolderComponentPyQt5QtPluginsPlatformthemes" />
<ComponentRef Id="FolderComponentPyQt5QtPluginsStyles" />
<ComponentRef Id="FolderComponentPyQt5QtTranslations" />
<ComponentRef Id="FolderComponentShare" />
<ComponentRef Id="FolderComponentWin32comShell" />
<ComponentRef Id="ApplicationShortcuts" />
</Feature>
</Product>
</Wix>

View file

@ -0,0 +1,225 @@
#!/usr/bin/env python3
import os
import uuid
import xml.etree.ElementTree as ET
def build_data(dirname, dir_prefix, id_, name):
data = {
"id": id_,
"name": name,
"files": [],
"dirs": [],
}
for basename in os.listdir(dirname):
filename = os.path.join(dirname, basename)
if os.path.isfile(filename):
data["files"].append(os.path.join(dir_prefix, basename))
elif os.path.isdir(filename):
if id_ == "INSTALLDIR":
id_prefix = "Folder"
else:
id_prefix = id_
data["dirs"].append(
build_data(
os.path.join(dirname, basename),
os.path.join(dir_prefix, basename),
f"{id_prefix}{basename.capitalize()}",
basename,
)
)
if len(data["files"]) > 0:
if id_ == "INSTALLDIR":
data["component_id"] = "ApplicationFiles"
else:
data["component_id"] = "FolderComponent" + id_[len("Folder") :]
data["component_guid"] = str(uuid.uuid4())
return data
def build_dir_xml(root, data):
attrs = {}
if "id" in data:
attrs["Id"] = data["id"]
if "name" in data:
attrs["Name"] = data["name"]
el = ET.SubElement(root, "Directory", attrs)
for subdata in data["dirs"]:
build_dir_xml(el, subdata)
def build_components_xml(root, data):
component_ids = []
if "component_id" in data:
component_ids.append(data["component_id"])
for subdata in data["dirs"]:
if "component_guid" in subdata:
dir_ref_el = ET.SubElement(root, "DirectoryRef", Id=subdata["id"])
component_el = ET.SubElement(
dir_ref_el,
"Component",
Id=subdata["component_id"],
Guid=subdata["component_guid"],
)
for filename in subdata["files"]:
file_el = ET.SubElement(
component_el, "File", Source=filename, Id="file_" + uuid.uuid4().hex
)
component_ids += build_components_xml(root, subdata)
return component_ids
def main():
version_filename = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"dangerzone",
"__init__.py",
)
with open(version_filename) as f:
for line in f.readlines():
if line.startswith("dangerzone_version ="):
version = line.split('"')[1]
break
dist_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"dist",
"dangerzone",
)
if not os.path.exists(dist_dir):
print(
"You must run step1-build-exe.bat to build dangerzone binary before running this"
)
return
data = {
"id": "TARGETDIR",
"name": "SourceDir",
"dirs": [
{
"id": "ProgramFilesFolder",
"dirs": [],
}
],
}
data["dirs"][0]["dirs"].append(
build_data(
dist_dir,
os.path.join("..", "..", "dist", "dangerzone"),
"INSTALLDIR",
"Dangerzone",
)
)
root_el = ET.Element("Wix", xmlns="http://schemas.microsoft.com/wix/2006/wi")
product_el = ET.SubElement(
root_el,
"Product",
Name="Dangerzone",
Manufacturer="First Look Media",
Id="f40ff0a9-ebf8-4e1e-9bce-6ab5c74fe119",
UpgradeCode="$(var.ProductUpgradeCode)",
Language="1033",
Codepage="1252",
Version="$(var.ProductVersion)",
)
ET.SubElement(
product_el,
"Package",
Id="*",
Keywords="Installer",
Description="Dangerzone $(var.ProductVersion) Installer",
Manufacturer="First Look Media",
InstallerVersion="100",
Languages="1033",
Compressed="yes",
SummaryCodepage="1252",
)
ET.SubElement(product_el, "Media", Id="1", Cabinet="product.cab", EmbedCab="yes")
ET.SubElement(
product_el, "Icon", Id="ProductIcon", SourceFile="..\\..\\share\\dangerzone.ico"
)
ET.SubElement(product_el, "Property", Id="ARPPRODUCTICON", Value="ProductIcon")
ET.SubElement(
product_el,
"Property",
Id="ARPHELPLINK",
Value="https://github.com/firstlookmedia/dangerzone",
)
ET.SubElement(
product_el,
"Property",
Id="ARPURLINFOABOUT",
Value="https://tech.firstlook.media",
)
ET.SubElement(product_el, "UIRef", Id="WixUI_Minimal")
ET.SubElement(product_el, "UIRef", Id="WixUI_ErrorProgressText")
ET.SubElement(
product_el,
"WixVariable",
Id="WixUILicenseRtf",
Value="..\\..\\install\\windows\\license.rtf",
)
ET.SubElement(
product_el,
"WixVariable",
Id="WixUIDialogBmp",
Value="..\\..\\install\\windows\\dialog.bmp",
)
upgrade_el = ET.SubElement(product_el, "Upgrade", Id="$(var.ProductUpgradeCode)")
ET.SubElement(
upgrade_el,
"UpgradeVersion",
Minimum="$(var.ProductVersion)",
OnlyDetect="yes",
Property="NEWERVERSIONDETECTED",
)
ET.SubElement(
upgrade_el,
"UpgradeVersion",
Minimum="0.0.0",
Maximum="$(var.ProductVersion)",
IncludeMinimum="yes",
IncludeMaximum="no",
Property="OLDERVERSIONBEINGUPGRADED",
)
condition_el = ET.SubElement(
product_el,
"Condition",
Message="A newer version of this software is already installed.",
)
condition_el.text = "NOT NEWERVERSIONDETECTED"
build_dir_xml(product_el, data)
component_ids = build_components_xml(product_el, data)
install_exec_seq_el = ET.SubElement(
product_el,
"InstallExecuteSequence",
)
ET.SubElement(
install_exec_seq_el, "RemoveExistingProducts", After="InstallValidate"
)
feature_el = ET.SubElement(product_el, "Feature", Id="DefaultFeature", Level="1")
for component_id in component_ids:
ET.SubElement(feature_el, "ComponentRef", Id=component_id)
print('<?xml version="1.0" encoding="windows-1252"?>')
print(f'<?define ProductVersion = "{version}"?>')
print('<?define ProductUpgradeCode = "12b9695c-965b-4be0-bc33-21274e809576"?>')
ET.indent(root_el)
ET.dump(root_el)
if __name__ == "__main__":
main()

View file

@ -7,3 +7,6 @@ pyinstaller install\pyinstaller\pyinstaller.spec
REM code sign dangerzone.exe REM code sign dangerzone.exe
signtool.exe sign /v /d "Dangerzone" /a /tr http://time.certum.pl/ dist\dangerzone\dangerzone.exe signtool.exe sign /v /d "Dangerzone" /a /tr http://time.certum.pl/ dist\dangerzone\dangerzone.exe
REM build the wix file
python install\windows\build-wxs.py > install\windows\Dangerzone.wxs