From 2feea02b6ce56eacbb39012aeb030aa91995b7ec Mon Sep 17 00:00:00 2001 From: inso <insomniak.fr@gmaiL.com> Date: Sat, 30 Jul 2016 12:50:05 +0200 Subject: [PATCH] Squashed commit of the following: commit 6401b3a4bea4418ef679ce638077fb3fae08c80a Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 12:44:37 2016 +0200 Install and remove later vcredist commit f60fc4d13b8f45ca5e1914645983fb76c83eeeff Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 12:32:42 2016 +0200 Fix vcredist names commit eebea91ab4cd7ea669fc01f1c73f634a398574c3 Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 12:24:36 2016 +0200 Fix name of vcredist*.exe commit bd35a9d38b3d18cd2735870acf145db08c4f47a6 Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 12:17:40 2016 +0200 Force packaging of exe file commit ef19494679c11d6cae75822b81d3b0e63e27b259 Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 12:06:18 2016 +0200 Fix call commit 9f5ee0145c95cd5f03ec7573168b1b225ef3d8d3 Author: Insoleet <insomniak.fr@gmail.com> Date: Sat Jul 30 11:51:37 2016 +0200 Fix download of vcredist commit 4e6e11bc95cd90359deb2c723a8e555859c4c7ca Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 11:43:37 2016 +0200 Fix vars commit 77f0c9d34b1262e4dfa61c843f51c1fdf0345106 Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 11:31:39 2016 +0200 Fix call commit 51d633e344d227bcd9c136b4f72b88b61fa75260 Author: inso <insomniak.fr@gmaiL.com> Date: Sat Jul 30 11:27:19 2016 +0200 Download vcredist and package in innosetup --- appveyor.yml | 10 +++++--- ci/appveyor/download_vcredist.ps1 | 6 +++++ ci/appveyor/sakia.iss | 42 +++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 ci/appveyor/download_vcredist.ps1 diff --git a/appveyor.yml b/appveyor.yml index 0e340f37..560434ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,11 +48,13 @@ build_script: - ".\\ci\\appveyor\\tests.cmd" - echo %errorlevel% + - powershell .\\ci\\appveyor\\download_vcredist.ps1 -target %cd%\\ci\\appveyor + # Windows Installer - - if [%APPVEYOR_REPO_TAG_NAME%] neq [] choco install -y InnoSetup - - if [%APPVEYOR_REPO_TAG_NAME%] neq [] set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH% - - if [%APPVEYOR_REPO_TAG_NAME%] neq [] iscc %cd%\ci\appveyor\sakia.iss /DROOT_PATH=%cd% - - if [%APPVEYOR_REPO_TAG_NAME%] neq [] move %cd%\sakia.exe %cd%\sakia-%APPVEYOR_REPO_TAG_NAME%-win%PYTHON_ARCH%.exe + - choco install -y InnoSetup + - set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH% + - iscc %cd%\ci\appveyor\sakia.iss /DROOT_PATH=%cd% + - move %cd%\sakia.exe %cd%\sakia-%APPVEYOR_REPO_TAG_NAME%-win%PYTHON_ARCH%.exe artifacts: - path: dist diff --git a/ci/appveyor/download_vcredist.ps1 b/ci/appveyor/download_vcredist.ps1 new file mode 100644 index 00000000..3400604e --- /dev/null +++ b/ci/appveyor/download_vcredist.ps1 @@ -0,0 +1,6 @@ +Param([String]$target) + +Write-Host "Downloading vcredist to $target" +(New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/A/4/D/A4D9F1D3-6449-49EB-9A6E-902F61D8D14B/vcredist_x86.exe', "$target\vcredist_x86.exe") +(New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/A/4/D/A4D9F1D3-6449-49EB-9A6E-902F61D8D14B/vcredist_x64.exe', "$target\vcredist_x64.exe") + diff --git a/ci/appveyor/sakia.iss b/ci/appveyor/sakia.iss index 3b22f038..465ebc6f 100644 --- a/ci/appveyor/sakia.iss +++ b/ci/appveyor/sakia.iss @@ -47,6 +47,8 @@ Source: "{#MyAppSrc}\sakia.ico"; DestDir: "{app}\"; Flags: ignoreversion recurse Source: "{#MyAppSrc}\sakia.png"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs Source: "{#MyAppSrc}\LICENSE"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs Source: "{#MyAppSrc}\ci\appveyor\after_install.cmd"; DestDir: "{app}\"; Flags: ignoreversion +Source: "{#MyAppSrc}\ci\appveyor\vcredist_x86.exe"; DestDir: "{tmp}\"; Flags: ignoreversion deleteafterinstall +Source: "{#MyAppSrc}\ci\appveyor\vcredist_x64.exe"; DestDir: "{tmp}\"; Flags: ignoreversion deleteafterinstall [Icons] Name: "{group}\{#MyAppName}"; IconFilename: "{app}\sakia.ico"; Filename: "{app}\{#MyAppExeName}" @@ -54,9 +56,49 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" Name: "{commondesktop}\{#MyAppName}"; IconFilename: "{app}\sakia.ico"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [Run] +#define VCmsg "Installing Microsoft Visual C++ Redistributable...." + +[Run] +Filename: "{tmp}\vcredist_x86.exe"; StatusMsg: "{#VCmsg}"; Check: not IsWin64 and not VCinstalled +Filename: "{tmp}\vcredist_x64.exe"; StatusMsg: "{#VCmsg}"; Check: IsWin64 and not VCinstalled Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Filename: "{app}\after_install.cmd"; Description: "Delete ALL existing data"; Flags: postinstall nowait skipifsilent unchecked +[Code] +function VCinstalled: Boolean; + // By Michael Weiner <mailto:spam@cogit.net> + // Function for Inno Setup Compiler + // 13 November 2015 + // Returns True if Microsoft Visual C++ Redistributable is installed, otherwise False. + // The programmer may set the year of redistributable to find; see below. + var + names: TArrayOfString; + i: Integer; + dName, key, year: String; + begin + // Year of redistributable to find; leave null to find installation for any year. + year := ''; + Result := False; + key := 'Software\Microsoft\Windows\CurrentVersion\Uninstall'; + // Get an array of all of the uninstall subkey names. + if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, key, names) then + // Uninstall subkey names were found. + begin + i := 0 + while ((i < GetArrayLength(names)) and (Result = False)) do + // The loop will end as soon as one instance of a Visual C++ redistributable is found. + begin + // For each uninstall subkey, look for a DisplayName value. + // If not found, then the subkey name will be used instead. + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, key + '\' + names[i], 'DisplayName', dName) then + dName := names[i]; + // See if the value contains both of the strings below. + Result := (Pos(Trim('Visual C++ ' + year),dName) * Pos('Redistributable',dName) <> 0) + i := i + 1; + end; + end; + end; + [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. -- GitLab