Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use wix toolset to package windows installer #28

Merged
merged 13 commits into from
May 28, 2017
5 changes: 5 additions & 0 deletions packaging/windows_wix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.msi
*.wixobj
*.wixpdb
indentex.wxs
LICENSE.rtf
21 changes: 21 additions & 0 deletions packaging/windows_wix/configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from os import path
from string import Template
import toml


def get_version():
with open(path.join("..", "..", "Cargo.toml")) as f:
cargo = toml.load(f)
return cargo["package"]["version"]


def configure_wxs_file(**context):
with open("indentex_template.wxs") as f:
tmpl = Template(f.read())

with open("indentex.wxs", "w") as f:
f.write(tmpl.substitute(context))


if __name__ == "__main__":
configure_wxs_file(version=get_version())
61 changes: 61 additions & 0 deletions packaging/windows_wix/indentex_template.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0"?>

<!-- Update version for every release -->
<?define ProductVersion = "$version"?>

<!-- NEVER CHANGE GUIDs! -->
<!-- generated on linux with `uuidgen -r` -->
<?define ProductUpgradeCode = "27bad626-dfc2-4c66-8c30-0a4a5473891b"?>
<?define MainExecutableGuid = "6e24a7b6-04b2-4afb-801d-9fa66960717b"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="$$(var.ProductUpgradeCode)"
Name="Indentex" Version="$$(var.ProductVersion)" Manufacturer="Mikhail Pak" Language="1033">

<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" InstallScope="perUser" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />

<Property Id="ARPHELPLINK" Value="https://github.com/mp4096/indentex" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/mp4096/indentex" />
<Property Id="ARPNOREPAIR" Value="1" />

<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="LocalAppDataFolder">
<Directory Id="INSTALLDIR" Name="Indentex">
<Component Id="MainExecutable" Guid="$$(var.MainExecutableGuid)">
<File Id="IndentexEXE" Source="..\..\target\release\indentex.exe" Vital="yes" />
<RemoveFolder Id="INSTALLDIR" On="uninstall" />
<RegistryKey Root="HKCU" Key="Software\Indentex">
<RegistryValue Name="Version" Value="[ProductVersion]" KeyPath="yes" Type="string" />
</RegistryKey>
<Environment Id="SetUserPath" Name="PATH" Action="set"
Permanent="no" System="no" Part="last"
Value="[INSTALLDIR]" />
</Component>
</Directory>
</Directory>
</Directory>

<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="MainExecutable"/>
</Feature>

<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
</Product>
</Wix>
5 changes: 5 additions & 0 deletions packaging/windows_wix/make_installer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python configure.py
pandoc -f markdown -t rtf ..\..\LICENSE.md -s -o LICENSE.rtf

candle indentex.wxs
light indentex.wixobj -ext WixUIExtension -sice:ICE91
1 change: 1 addition & 0 deletions packaging/windows_wix/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toml