From 3c5295dca37c5355b7a4a448f711c9ab14185252 Mon Sep 17 00:00:00 2001 From: Adib Taraben Date: Thu, 15 Nov 2012 23:12:16 +0100 Subject: add wix scripts to nuild win32 .msi package (bzr r11875) --- packaging/wix/README | 19 ++++++++++ packaging/wix/files.py | 86 ++++++++++++++++++++++++++++++++++++++++++++++ packaging/wix/inkscape.wxs | 77 +++++++++++++++++++++++++++++++++++++++++ packaging/wix/install.bat | 30 ++++++++++++++++ packaging/wix/next_uuid.py | 10 ++++++ packaging/wix/wixenv.bat | 4 +++ 6 files changed, 226 insertions(+) create mode 100644 packaging/wix/README create mode 100644 packaging/wix/files.py create mode 100644 packaging/wix/inkscape.wxs create mode 100644 packaging/wix/install.bat create mode 100644 packaging/wix/next_uuid.py create mode 100644 packaging/wix/wixenv.bat (limited to 'packaging') diff --git a/packaging/wix/README b/packaging/wix/README new file mode 100644 index 000000000..5f1118d7e --- /dev/null +++ b/packaging/wix/README @@ -0,0 +1,19 @@ +howto create windows msi installer + +you need: +1. windows installer XML installed and callable from your path + get it from http://wixtoolset.org/ + the installer is tested using version 3.6 +2. python installed and callable from your path + the installer is tested using version 2.7 + +build the installer +1. build inkscape +2. set environment variables + wixenv.bat +2. create installer using batch + install.bat + +when completed there should be inkscape.msi in your path + + diff --git a/packaging/wix/files.py b/packaging/wix/files.py new file mode 100644 index 000000000..7cddcc6a9 --- /dev/null +++ b/packaging/wix/files.py @@ -0,0 +1,86 @@ +#!/usr/bin/python + + +# list files in directory +import os +import uuid + +directory_ids = {} +file_ids = {} + +def indent(level): + indentstring = '' + for i in range(level): + indentstring += ' ' + return indentstring + +def directory(root, breadcrumb, level): + """ + list all files and directory recursivly + create the file_ids dictionary to be used in ComponentGroup references + """ + global file_ids + global directory_ids + # first list files within directory + files = [ f for f in os.listdir(root) if os.path.isfile(os.path.join(root,f)) ] + for file in files: + file_key = os.path.join(root, file) + _id = '_%06d' % (len(file_ids.keys()) + 1) + file_ids[file_key] = 'component' + _id + wxs.write(indent(level)+ "\n") + wxs.write(indent(level + 1)+ "\n") + wxs.write(indent(level)+ "\n") + # then all directories + + dirs = [ f for f in os.listdir(root) if os.path.isdir(os.path.join(root,f)) ] + for dir in dirs: + directory_key = breadcrumb + '__' + dir + if not directory_key in directory_ids.keys(): + directory_ids[directory_key] = 'dir_%06d' % (len(directory_ids.keys()) + 1) + wxs.write(indent(level) + "\n") + directory(os.path.join(root, dir), directory_key, level + 1) + wxs.write(indent(level) + "\n") + + +def ComponentGroup(name, condition, level): + """ + add componentgroup that contain all items from file_ids that match condition + remove the matched elements from file_ids + """ + global file_ids + keys = [k for k in file_ids.keys() if condition in k] + wxs.write(indent(level) + "\n") + for component in keys: + wxs.write(indent(level + 1) + "\n") + wxs.write(indent(level) + "\n") + for key in keys: + del file_ids[key] + +with open('files.wxs', 'w') as wxs: + wxs.write("\n") + wxs.write("\n") + wxs.write(indent(1) + "\n") + wxs.write(indent(2) + "\n") + wxs.write(indent(2) + "\n") + wxs.write(indent(3) + "\n") + wxs.write(indent(4) + "\n") + print "start parsing ..\..\inkscape" + directory('..\..\inkscape', 'inkscape', 5) + print "found %d files" % len(file_ids.keys()) + wxs.write(indent(4) + "\n") + wxs.write(indent(3) + "\n") + # link to ProgrmMenu + wxs.write(indent(3) + "\n") + wxs.write(indent(4) + "\n") + wxs.write(indent(3) + "\n") + wxs.write(indent(3) + "\n") + wxs.write(indent(2) + "\n") + ComponentGroup("Examples", 'inkscape\\share\\examples', 2) + ComponentGroup("Tutorials", 'inkscape\\share\\tutorials\\', 2) + ComponentGroup("Translations", '\\locale\\', 2) + ComponentGroup("AllOther", '', 2) + wxs.write(indent(1) + "\n") + wxs.write("\n") + + + diff --git a/packaging/wix/inkscape.wxs b/packaging/wix/inkscape.wxs new file mode 100644 index 000000000..823c54d99 --- /dev/null +++ b/packaging/wix/inkscape.wxs @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/wix/install.bat b/packaging/wix/install.bat new file mode 100644 index 000000000..14596113c --- /dev/null +++ b/packaging/wix/install.bat @@ -0,0 +1,30 @@ +@echo set environment parameter ... +rem call wixenv.bat + +@echo todo implement custom icon and artwork +@echo todo insert files from ../source/release + +@echo call wix compiler ... +candle inkscape.wxs -ext WiXUtilExtension +@if NOT %ERRORLEVEL% == 0 goto theend + +candle files.wxs +@if NOT %ERRORLEVEL% == 0 goto theend + +@echo call wix linker ... +light -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj -o inkscape.msi +@if NOT %ERRORLEVEL% == 0 goto theend + +@echo the installer is now created +goto theend + +@echo install ... +msiexec /i inkscape.msi /l*v inkscape.log + +pause the program is now installed. press any key to run uninstaller ... +@echo deinstall ... +msiexec /x inkscape.msi + +@echo ... finished + +:theend diff --git a/packaging/wix/next_uuid.py b/packaging/wix/next_uuid.py new file mode 100644 index 000000000..6ed20b506 --- /dev/null +++ b/packaging/wix/next_uuid.py @@ -0,0 +1,10 @@ +import uuid + +""" +a helper script to simply generate some new UUID +""" + +out = open('next_uuid.txt', 'wt') +for i in xrange(10): + out.write(str(uuid.uuid4()) + '\n') + diff --git a/packaging/wix/wixenv.bat b/packaging/wix/wixenv.bat new file mode 100644 index 000000000..85db740df --- /dev/null +++ b/packaging/wix/wixenv.bat @@ -0,0 +1,4 @@ +@echo Setting environment variables for creating msi installer +IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs +IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.6\bin +set PATH=%DEVLIBS_PATH%\python;%WIX_PATH%;%PATH% -- cgit v1.2.3