From d7f5965ada9179bd223fa73785d27280bcc75d6c Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 8 Oct 2016 17:36:21 +0200 Subject: Packaging: Some initial fixes for WiX (MSI installer) (bzr r15244.1.1) --- packaging/wix/files.py | 13 +++++++++---- packaging/wix/helpers.py | 23 +++++++++++++++++++++++ packaging/wix/install.bat | 4 +++- packaging/wix/version.py | 11 +++++++++-- packaging/wix/wixenv.bat | 20 +++++--------------- 5 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 packaging/wix/helpers.py (limited to 'packaging') diff --git a/packaging/wix/files.py b/packaging/wix/files.py index ada4d62f2..8026a5259 100644 --- a/packaging/wix/files.py +++ b/packaging/wix/files.py @@ -1,10 +1,12 @@ #!/usr/bin/python +from __future__ import print_function -# list files in directory import os import uuid +from helpers import get_inkscape_dist_dir + directory_ids = {} file_ids = {} @@ -59,6 +61,9 @@ def ComponentGroup(name, condition, level): for key in keys: del file_ids[key] +#get directory containing the inkscape distribution files +inkscape_dist_dir = get_inkscape_dist_dir() + with open('files.wxs', 'w') as wxs: wxs.write("\n") wxs.write("\n") @@ -68,9 +73,9 @@ with open('files.wxs', 'w') as wxs: wxs.write(indent(2) + "\n") wxs.write(indent(3) + "\n") wxs.write(indent(4) + "\n") - print "start parsing ..\..\inkscape" - directory('..\..\inkscape', 'inkscape', 5, ['inkscape.dbg', 'inkview.dbg', 'gdb.exe']) - print "found %d files" % len(file_ids.keys()) + print("start parsing files from " + inkscape_dist_dir) + directory(inkscape_dist_dir, 'inkscape', 5, ['inkscape.dbg', 'inkview.dbg', 'gdb.exe']) + print("found %d files" % len(file_ids.keys())) wxs.write(indent(4) + "\n") wxs.write(indent(3) + "\n") # link to ProgrmMenu diff --git a/packaging/wix/helpers.py b/packaging/wix/helpers.py new file mode 100644 index 000000000..5fe9e6a52 --- /dev/null +++ b/packaging/wix/helpers.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +from __future__ import print_function + +import os +import sys + +# check where to look for the inkscape files to bundle +# - btool builds used [root]/inkscape +# - cmake builds use [root]/build/inkscape unless "DESTDIR" is specified +def get_inkscape_dist_dir(): + # fisrt check the environment variable + sourcedir = os.getenv('INKSCAPE_DIST_PATH') + if sourcedir is None: + sourcedir = '' + if not os.path.isdir(sourcedir): + sourcedir = '..\\..\\inkscape' + if not os.path.isdir(sourcedir): + sourcedir = '..\\..\\build\\inkscape' + if not os.path.isdir(sourcedir): + print("could not find inkscape distribution files, please set environment variable 'INKSCAPE_DIST_PATH'") + sys.exit(1) + return sourcedir \ No newline at end of file diff --git a/packaging/wix/install.bat b/packaging/wix/install.bat index 1b42a596b..f0dd0bdee 100644 --- a/packaging/wix/install.bat +++ b/packaging/wix/install.bat @@ -1,9 +1,11 @@ @echo build files.wxs python files.py +@if NOT %ERRORLEVEL% == 0 goto theend @echo create version information for /f "tokens=*" %%a in ('python version.py') do (set INKSCAPE_VER=%%a) +@if NOT %ERRORLEVEL% == 0 goto theend @echo call wix compiler ... candle inkscape.wxs -ext WiXUtilExtension @@ -27,6 +29,6 @@ pause the program is now installed. press any key to run uninstaller ... @echo deinstall ... msiexec /x inkscape-%INKSCAPE_VER%.msi -@echo ... finished :theend +@echo ... finished \ No newline at end of file diff --git a/packaging/wix/version.py b/packaging/wix/version.py index dc5e06de9..a7ffebaa0 100644 --- a/packaging/wix/version.py +++ b/packaging/wix/version.py @@ -1,8 +1,12 @@ #!/usr/bin/python +from __future__ import print_function + import os import struct +from helpers import get_inkscape_dist_dir + version = '' versionstr = '' architecture = '' @@ -27,7 +31,10 @@ def is64bitArchitecture(filename): return True return False -if is64bitArchitecture('..\..\inkscape\inkscape.exe'): +#get directory containing the inkscape distribution files +inkscape_dist_dir = get_inkscape_dist_dir() + +if is64bitArchitecture(inkscape_dist_dir + '\\inkscape.exe'): architecture = '-x64' else: architecture = '' @@ -44,7 +51,7 @@ with open('..\..\src\inkscape.rc', 'r') as rc: versionstr = versionstr.replace('"', '') versionstr = versionstr.replace("'", "") # version = version.replace("+", "_") - print versionstr + architecture + print(versionstr + architecture) if 'versioninfo' in line.lower(): isversioninfo = True if 'begin' in line.lower(): diff --git a/packaging/wix/wixenv.bat b/packaging/wix/wixenv.bat index 2cddd7146..106898683 100644 --- a/packaging/wix/wixenv.bat +++ b/packaging/wix/wixenv.bat @@ -1,19 +1,9 @@ -@echo Setting environment variables for creating msi installer +@echo Setting environment variables for creating msi installer (adjust if necesssary!) -@echo detect OS version -ver | findstr /i "6\.1\." > nul -IF %ERRORLEVEL% EQU 0 goto win7 - -@rem all other cases -IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.9\bin -IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs -goto setpath - -:win7 -IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.9\bin +IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.10\bin IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs -:setpath -set PATH=%DEVLIBS_PATH%\python;%WIX_PATH%;%PATH% +rem uncomment and adjust the line below if your Inkscape distribution files are in a non-standard location +rem IF "%INKSCAPE_DIST_PATH%"=="" set INKSCAPE_DIST_PATH=..\..\build\inkscape -:end +set PATH=%DEVLIBS_PATH%\python;%WIX_PATH%;%PATH% \ No newline at end of file -- cgit v1.2.3