Skip to content

Commit db0c1c7

Browse files
authored
MSI by WIX5 (#365)
* fixed wix v5 issues after automatic transformation and adaptions for heat which is not part of wix tooling - PythonScript.wxs(52) : error WIX0094: The identifier 'WixUI:WixUI_FeatureTree_X64' could not be found. Ensure you have typed the reference correctly and that all the necessary inputs are provided to the linker. - PythonScript.wxs(54) : warning WIX5437: It is no longer necessary to define the standard directory 'ProgramFiles64Folder'. Use the StandardDirectory element instead. Linking installer - generating MSI see also oleg-shilo/wixsharp#1655 for WIX5437 https://wixtoolset.org/docs/tools/wixext/wixui/ for WIX0094 add extension as described at https://wixtoolset.org/docs/tools/wixext/ * - use files (https://wixtoolset.org/docs/fivefour/ , https://wixtoolset.org/docs/schema/wxs/files/ , wixtoolset/issues#7857) instead of heat for file harvesting - remove unused xsl msi scripts TODO: Remove also __pycache__ dirs on unistall, maybe also pyc files
1 parent 9b8a1e8 commit db0c1c7

15 files changed

+92
-273
lines changed

.github/workflows/CI_build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@ jobs:
4646
$env:PYTHONBUILDDIR_X64='${{ github.workspace }}\packages\python.3.12.8\tools'
4747
$env:PYTHONBUILDDIR='${{ github.workspace }}\packages\pythonx86.3.12.8\tools'
4848
Rename-Item -Path ".\buildPaths.bat.orig" -NewName "buildPaths.bat"
49-
$env:WIX_PATH="C:\Program Files (x86)\WiX Toolset v3.11\bin"
50-
$env:PATH = $env:PATH + ';' + $env:WIX_PATH
49+
dotnet tool install --global wix
5150
.\buildAll.bat ${{ matrix.build_platform }}

PythonScript/project/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="WixToolset.UI.wixext" version="5.0.2" targetFramework="native" />
34
<package id="boost" version="1.87.0" targetFramework="native" />
45
<package id="boost_python312-vc143" version="1.87.0" targetFramework="native" />
56
<package id="python" version="3.12.8" targetFramework="native" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="WixToolset.UI.wixext" version="5.0.2" targetFramework="native" />
34
<package id="boost" version="1.87.0" targetFramework="native" />
45
<package id="boost_python312-vc143" version="1.87.0" targetFramework="native" />
56
</packages>

appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ after_build:
4242
- if "%configuration%"=="Release" make.bat html
4343

4444
- cd "%APPVEYOR_BUILD_FOLDER%"\installer
45-
- set WIX_PATH="C:\Program Files (x86)\WiX Toolset v3.14\bin"
46-
- set PATH=%WIX_PATH%;%PATH%
45+
- dotnet tool install --global wix
4746
- if "%platform_input%"=="x64" SET PYTHONBUILDDIR_X64="%APPVEYOR_BUILD_FOLDER%"\packages\python.3.12.8\tools
4847
- if "%platform_input%"=="Win32" SET PYTHONBUILDDIR="%APPVEYOR_BUILD_FOLDER%"\packages\pythonx86.3.12.8\tools
4948
- copy "%APPVEYOR_BUILD_FOLDER%"\installer\buildPaths.bat.orig "%APPVEYOR_BUILD_FOLDER%"\installer\buildPaths.bat

installer/PythonScript.wxs

Lines changed: 72 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,25 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
1+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2+
43

54
<?if $(var.Platform) = x64 ?>
65
<?define ProductName = "PythonScript plugin for Notepad++ (64 bit)" ?>
7-
<?define Win64 = "yes" ?>
8-
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
9-
<?else ?>
6+
<?else?>
107
<?define ProductName = "PythonScript plugin for Notepad++" ?>
11-
<?define Win64 = "no" ?>
12-
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
13-
<?endif ?>
14-
15-
<Product Id="*" Language="1033" Manufacturer="Dave Brotherstone" Name="$(var.ProductName)"
16-
UpgradeCode="717FEC91-6F2B-459D-9868-0A3A037F5195"
17-
Version="$(var.version)">
18-
19-
20-
21-
<Package Id='*' InstallerVersion='200' Platform="$(var.Platform)" Compressed='yes' />
22-
23-
<Upgrade Id="717FEC91-6F2B-459D-9868-0A3A037F5195">
24-
<UpgradeVersion Minimum="0.0.0.0" Maximum="$(var.version)"
25-
Property="PREVIOUSVERSIONSINSTALLED"
26-
IncludeMinimum="yes" IncludeMaximum="no" />
8+
<?endif?>
9+
10+
<Package Language="1033" Manufacturer="Dave Brotherstone" Name="$(var.ProductName)" UpgradeCode="717FEC91-6F2B-459D-9868-0A3A037F5195" Version="$(var.version)" InstallerVersion="200"><Upgrade Id="717FEC91-6F2B-459D-9868-0A3A037F5195">
11+
<UpgradeVersion Minimum="0.0.0.0" Maximum="$(var.version)" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" />
2712
</Upgrade>
2813

29-
<Media Id='1' Cabinet='PythonScript.cab' EmbedCab='yes' />
30-
14+
<Media Id="1" Cabinet="PythonScript.cab" EmbedCab="yes" />
15+
3116
<InstallExecuteSequence>
32-
<RemoveExistingProducts Before="InstallInitialize" />
17+
<RemoveExistingProducts Before="InstallInitialize" />
3318
</InstallExecuteSequence>
3419

3520
<Property Id="INSTALLLEVEL" Value="5" />
36-
<Directory Id="TARGETDIR" Name="SourceDir">
37-
<Directory Id="$(var.PlatformProgramFilesFolder)">
38-
<Directory Id="INSTALLDIR" Name="Notepad++">
39-
<Directory Id="D_Plugins" Name="plugins">
40-
<Directory Id="D_PythonScript" Name="PythonScript">
41-
<Directory Id="D_PythonLib" Name="lib" />
42-
<Directory Id="D_Scripts" Name="scripts">
43-
<Component Id="C_startup.py" Guid="*" Win64="$(var.Win64)">
44-
<RemoveFile Id="Remove_F_startup.py" Name="startup.py" On="install"/>
45-
<RemoveFile Id="Remove_F_startup.pyc" Name="startup.pyc" On="install"/>
46-
<File Id="F_startup.py" KeyPath="yes" Name="startup.py" Source="$(var.baseDir)\scripts\startup.py" />
47-
</Component>
48-
<Directory Id="D_npp_unit_tests" Name="npp_unit_tests" />
49-
<Directory Id="D_SampleScripts" Name="Samples" />
50-
</Directory>
51-
<Directory Id="D_DocPythonScript" Name="doc"/>
52-
<Component Id="C_pythonscript.dll" Guid="*" Win64="$(var.Win64)">
53-
<RemoveFile Id="Remove_F_pythonscript.dll" Name="PythonScript.dll" On="install"/>
54-
<File Id="F_pythonscript.dll" Name="PythonScript.dll" Source="$(var.baseDir)\$(var.variantDir)\Release\PythonScript.dll" />
55-
</Component>
56-
<Component Id="C_python312.dll" Guid="*" Win64="$(var.Win64)">
57-
<RemoveFile Id="Remove_F_python312.dll" Name="python312.dll" On="install"/>
58-
<File Id="F_python312.dll" Name="python312.dll" Source="$(var.pythonDir)\python312.dll" />
59-
</Component>
60-
</Directory>
61-
</Directory>
62-
</Directory>
63-
</Directory>
64-
</Directory>
6521

66-
<Feature Id="FT_PythonScriptAll" Title="PythonScript Components" Display="expand" AllowAdvertise="no" ConfigurableDirectory="INSTALLDIR"
67-
Description="Install directory should be the install directory of your Notepad++ directory">
22+
<Feature Id="FT_PythonScriptAll" Title="PythonScript Components" Display="expand" AllowAdvertise="no" ConfigurableDirectory="INSTALLDIR" Description="Install directory should be the install directory of your Notepad++ directory">
6823
<Feature Id="FT_PythonScript" Title="PythonScript plugin" AllowAdvertise="no">
6924
<ComponentRef Id="C_startup.py" />
7025
<ComponentRef Id="C_pythonscript.dll" />
@@ -83,16 +38,72 @@
8338
<ComponentGroupRef Id="CG_PythonTclTkLibDll" />
8439
</Feature>
8540
<Feature Id="FT_UnitTests" Title="Unit Tests" Level="10" AllowAdvertise="no" Description="Unit tests for PythonScript. Not usually necessary, but if you are having problems, any issues reported from the tests will be useful for diagnosis.">
86-
<ComponentGroupRef Id="CG_UnitTests" />
41+
<ComponentGroupRef Id="CG_Unittests" />
8742
</Feature>
8843
</Feature>
89-
44+
9045
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
9146
<WixVariable Id="WixUIBannerBmp" Value="images\banner.bmp" />
9247
<WixVariable Id="WixUIDialogBmp" Value="images\dialog.bmp" />
93-
<UIRef Id="WixUI_FeatureTree" />
94-
95-
</Product>
48+
<ui:WixUI Id="WixUI_FeatureTree" />
49+
50+
<ComponentGroup Id="CG_PythonLib" Directory="D_PythonLib">
51+
<Files Include="..\pythonlib\full\**" />
52+
</ComponentGroup>
53+
54+
<ComponentGroup Id="CG_PythonLibDll" Directory="D_PythonLib">
55+
<Files Include="..\pythonlib\full_dll$(var.nameAddon)\**" />
56+
</ComponentGroup>
57+
58+
<ComponentGroup Id="CG_HtmlDocs" Directory="D_DocPythonScript">
59+
<Files Include="..\docs\build\html\**" />
60+
</ComponentGroup>
61+
62+
<ComponentGroup Id="CG_SampleScripts" Directory="D_SampleScripts">
63+
<Files Include="..\scripts\Samples\**" />
64+
</ComponentGroup>
65+
66+
<ComponentGroup Id="CG_PythonTclTkLib" Directory="D_PythonLib">
67+
<Files Include="..\pythonlib\tcl\**" />
68+
</ComponentGroup>
69+
70+
<ComponentGroup Id="CG_PythonTclTkLibDll" Directory="D_PythonLib">
71+
<Files Include="..\pythonlib\tcl_dll$(var.nameAddon)\**" />
72+
</ComponentGroup>
73+
74+
<ComponentGroup Id="CG_Unittests" Directory="D_npp_unit_tests">
75+
<Files Include="..\PythonScript\python_tests\**" />
76+
</ComponentGroup>
77+
78+
79+
<StandardDirectory Id="ProgramFiles6432Folder">
80+
<Directory Id="INSTALLDIR" Name="Notepad++">
81+
<Directory Id="D_Plugins" Name="plugins">
82+
<Directory Id="D_PythonScript" Name="PythonScript">
83+
<Directory Id="D_PythonLib" Name="lib" />
84+
<Directory Id="D_Scripts" Name="scripts">
85+
<Component Id="C_startup.py">
86+
<RemoveFile Id="Remove_F_startup.py" Name="startup.py" On="install" />
87+
<RemoveFile Id="Remove_F_startup.pyc" Name="startup.pyc" On="install" />
88+
<File Id="F_startup.py" KeyPath="yes" Name="startup.py" Source="$(var.baseDir)\scripts\startup.py" />
89+
</Component>
90+
<Directory Id="D_npp_unit_tests" Name="npp_unit_tests" />
91+
<Directory Id="D_SampleScripts" Name="Samples" />
92+
</Directory>
93+
<Directory Id="D_DocPythonScript" Name="doc" />
94+
<Component Id="C_pythonscript.dll">
95+
<RemoveFile Id="Remove_F_pythonscript.dll" Name="PythonScript.dll" On="install" />
96+
<File Id="F_pythonscript.dll" Name="PythonScript.dll" Source="$(var.baseDir)\$(var.variantDir)\Release\PythonScript.dll" />
97+
</Component>
98+
<Component Id="C_python312.dll">
99+
<RemoveFile Id="Remove_F_python312.dll" Name="python312.dll" On="install" />
100+
<File Id="F_python312.dll" Name="python312.dll" Source="$(var.pythonDir)\python312.dll" />
101+
</Component>
102+
</Directory>
103+
</Directory>
104+
</Directory>
105+
</StandardDirectory>
106+
</Package>
96107

97108

98109
</Wix>

installer/buildInstaller.bat

Lines changed: 7 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -43,105 +43,15 @@ mkdir %INST_TEMP_DIR%
4343
SET /p PYTHONSCRIPTVERSION= < %INST_TEMP_DIR%\version.txt
4444

4545

46-
echo Generating WiX information for ..\pythonlib\full
47-
heat dir ..\pythonlib\full -ag -cg CG_PythonLib -dr D_PythonScript -var var.pylibSource -t changeDirLib.xsl -o %INST_TEMP_DIR%\fullLib.wxs
48-
if NOT [%ERRORLEVEL%]==[0] (
49-
goto error
50-
)
51-
52-
echo Compiling python lib WiX source
53-
candle %INST_TEMP_DIR%\fullLib.wxs -o %INST_TEMP_DIR%\fullLib.wixobj -dpylibSource=..\pythonlib\full -arch %MSI_ARCH%
54-
if NOT [%ERRORLEVEL%]==[0] (
55-
goto error
56-
)
57-
58-
echo Generating WiX information for ..\pythonlib\full_dll%NAME_ADDON%
59-
heat dir ..\pythonlib\full_dll%NAME_ADDON% -ag -cg CG_PythonLibDll -dr D_PythonScript -var var.pylibSource -t changeDirLib.xsl -o %INST_TEMP_DIR%\fullLib_dll%NAME_ADDON%.wxs
60-
if NOT [%ERRORLEVEL%]==[0] (
61-
goto error
62-
)
63-
64-
echo Compiling python pyd lib WiX source
65-
candle %INST_TEMP_DIR%\fullLib_dll%NAME_ADDON%.wxs -o %INST_TEMP_DIR%\fullLib_dll%NAME_ADDON%.wixobj -dpylibSource=..\pythonlib\full_dll%NAME_ADDON% -arch %MSI_ARCH%
66-
if NOT [%ERRORLEVEL%]==[0] (
67-
goto error
68-
)
69-
70-
echo Generating WiX information for ..\pythonlib\tcl
71-
heat dir ..\pythonlib\tcl -ag -cg CG_PythonTclTkLib -dr D_PythonScript -var var.pylibSource -t changeDirLib.xsl -o %INST_TEMP_DIR%\tcl.wxs
72-
if NOT [%ERRORLEVEL%]==[0] (
73-
goto error
74-
)
75-
76-
echo Compiling tcl lib WiX source
77-
candle %INST_TEMP_DIR%\tcl.wxs -o %INST_TEMP_DIR%\tcl.wixobj -dpylibSource=..\pythonlib\tcl -arch %MSI_ARCH%
78-
if NOT [%ERRORLEVEL%]==[0] (
79-
goto error
80-
)
81-
82-
echo Generating WiX information for ..\pythonlib\tcl_dll%NAME_ADDON%
83-
heat dir ..\pythonlib\tcl_dll%NAME_ADDON% -ag -cg CG_PythonTclTkLibDll -dr D_PythonScript -var var.pylibSource -t changeDirLib.xsl -o %INST_TEMP_DIR%\tcl_dll%NAME_ADDON%.wxs
84-
if NOT [%ERRORLEVEL%]==[0] (
85-
goto error
86-
)
87-
88-
echo Compiling tcl lib WiX source
89-
candle %INST_TEMP_DIR%\tcl_dll%NAME_ADDON%.wxs -o %INST_TEMP_DIR%\tcl_dll%NAME_ADDON%.wixobj -dpylibSource=..\pythonlib\tcl_dll%NAME_ADDON% -arch %MSI_ARCH%
90-
if NOT [%ERRORLEVEL%]==[0] (
91-
goto error
92-
)
93-
94-
echo Generating WiX information for ..\PythonScript\scripts\Samples
95-
heat dir ..\scripts\Samples -ag -cg CG_SampleScripts -dr D_PythonScript -var var.scriptSource -t changeDirSampleScripts.xsl -o %INST_TEMP_DIR%\sampleScripts.wxs
96-
if NOT [%ERRORLEVEL%]==[0] (
97-
goto error
98-
)
99-
100-
echo Compiling Sample Scripts WiX source
101-
candle %INST_TEMP_DIR%\sampleScripts.wxs -o %INST_TEMP_DIR%\sampleScripts.wixobj -dscriptSource=..\scripts\Samples -arch %MSI_ARCH%
102-
if NOT [%ERRORLEVEL%]==[0] (
103-
goto error
104-
)
105-
106-
107-
echo Generating WiX information for ..\PythonScript\python_tests
108-
heat dir ..\PythonScript\python_tests -ag -cg CG_UnitTests -dr D_PythonScript -var var.unittestSource -t changeDirTests.xsl -o %INST_TEMP_DIR%\unittests.wxs -platform=%NAME_ADDON%
109-
if NOT [%ERRORLEVEL%]==[0] (
110-
goto error
111-
)
112-
113-
echo Compiling Unit test WiX source
114-
candle %INST_TEMP_DIR%\unittests.wxs -o %INST_TEMP_DIR%\unittests.wixobj -dunittestSource=..\PythonScript\python_tests -arch %MSI_ARCH%
115-
if NOT [%ERRORLEVEL%]==[0] (
116-
goto error
117-
)
118-
119-
echo Generating WiX information for ..\docs\build\html
120-
heat dir ..\docs\build\html -ag -cg CG_HtmlDocs -dr D_PythonScript -var var.htmldocsSource -t changeDirHtmlDoc.xsl -o %INST_TEMP_DIR%\htmldoc.wxs -platform=%NAME_ADDON%
121-
if NOT [%ERRORLEVEL%]==[0] (
122-
goto error
123-
)
124-
125-
echo Compiling Html doc WiX source
126-
candle %INST_TEMP_DIR%\htmldoc.wxs -o %INST_TEMP_DIR%\htmldoc.wixobj -dhtmldocsSource=..\docs\build\html -arch %MSI_ARCH%
127-
if NOT [%ERRORLEVEL%]==[0] (
128-
goto error
129-
)
130-
131-
echo Compiling main PythonScript installer
132-
candle pythonscript.wxs -o %INST_TEMP_DIR%\pythonscript.wixobj -dversion=%PYTHONSCRIPTVERSION% -dbaseDir=.. -dpythonDir=%PYTHONBUILDDIR% -dvariantDir=%PYTHONSCRIPTDLLDIR% -dPlatform=%MSI_ARCH% -arch %MSI_ARCH%
133-
if NOT [%ERRORLEVEL%]==[0] (
134-
goto error
135-
)
136-
137-
138-
echo Linking installer - generating MSI
139-
IF NOT EXIST "build\%PYTHONSCRIPTVERSION%" (
140-
mkdir build\%PYTHONSCRIPTVERSION%
141-
)
46+
cd ..\packages
47+
echo add UI extension globally
48+
wix extension add -g WixToolset.UI.wixext
49+
wix extension list -g
50+
cd ..\installer
14251

14352

144-
light %INST_TEMP_DIR%\pythonscript.wixobj %INST_TEMP_DIR%\fullLib.wixobj %INST_TEMP_DIR%\fullLib_dll%NAME_ADDON%.wixobj %INST_TEMP_DIR%\unittests.wixobj %INST_TEMP_DIR%\tcl.wixobj %INST_TEMP_DIR%\tcl_dll%NAME_ADDON%.wixobj %INST_TEMP_DIR%\sampleScripts.wixobj %INST_TEMP_DIR%\htmldoc.wixobj -o build\%PYTHONSCRIPTVERSION%\PythonScript_%PYTHONSCRIPTVERSION%%NAME_ADDON%.msi -ext WixUIExtension
53+
echo Compiling PythonScript installer
54+
wix build pythonscript.wxs -o build\%PYTHONSCRIPTVERSION%\PythonScript_%PYTHONSCRIPTVERSION%%NAME_ADDON%.msi -d version=%PYTHONSCRIPTVERSION% -d baseDir=.. -d pythonDir=%PYTHONBUILDDIR% -d variantDir=%PYTHONSCRIPTDLLDIR% -d Platform=%MSI_ARCH% -d nameAddon=%NAME_ADDON% -arch %MSI_ARCH% -ext "WixToolset.UI.wixext"
14555
if NOT [%ERRORLEVEL%]==[0] (
14656
goto error
14757
)

installer/buildReleaseZips.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ mkdir %INSTALLERDIR%\build\%PYTHONSCRIPTVERSION%
103103
cd %INST_TEMP_DIR%\release\Full\plugins\PythonScript
104104
%SEVENZIPEXE% a -r -tzip %INSTALLERDIR%\build\%PYTHONSCRIPTVERSION%\PythonScript_Full_%PYTHONSCRIPTVERSION%%NAME_ADDON%_PluginAdmin.zip .
105105

106-
cd %INST_TEMP_DIR%\release\Full
106+
cd %INSTALLERDIR%\%INST_TEMP_DIR%\release\Full
107107
%SEVENZIPEXE% a -r -t7z %INSTALLERDIR%\build\%PYTHONSCRIPTVERSION%\PythonScript_Full_%PYTHONSCRIPTVERSION%%NAME_ADDON%.7z .
108108
%SEVENZIPEXE% a -r -tzip %INSTALLERDIR%\build\%PYTHONSCRIPTVERSION%\PythonScript_Full_%PYTHONSCRIPTVERSION%%NAME_ADDON%.zip .
109109

installer/changeDirHtmlDoc.xsl

Lines changed: 0 additions & 7 deletions
This file was deleted.

installer/changeDirLib.xsl

Lines changed: 0 additions & 10 deletions
This file was deleted.

installer/changeDirSampleScripts.xsl

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)