Using InnoSetup to create an installer

The following shows a sample InnoSetup script to create an installer for the sample wxPython application shown on the py2exe page.

What Objects are Involved

You will need the following

* py2exe

* InnoSetup I use the QuickStart package as it includes the ISTools which has a nice wizard to help you get going in creating the script you need to create.

Process Overview

Freeze your application using e.g. py2exe and then create and run the InnoSetup installer script, a sample is shown below.

Special Concerns

I use InnoSetup version 5.2.3 with ISTool version 5.2.1, have not yet tried the newer version which is supporting Unicode.

Code Sample

Following is the script to create an installer for the little sample application shown on the py2exe page. The script should be pretty easy to understand. Should a command not be clear please check the help included with InnoSetup.

The script assumes the following folder structure.

application work folder

   1 ; Script generated by the Inno Setup Script Wizard.
   2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
   3 
   4 ; then did a few changes to make maintenance, move to other folder easier
   5 ;
   6 ; define the path to your work folder
   7 #define BaseFolder "C:\Dev\aaTests\py2exe\simpleWx"
   8 
   9 ; get version information from the exe
  10 #define ExeName BaseFolder+"\dist\simplewx.exe"
  11 #define AppVersionNo GetFileVersion(ExeName)
  12 #define AppMajorVersionIdx Pos(".", AppVersionNo)
  13 #define AppMinorVersionTemp Copy(AppVersionNo, AppMajorVersionIdx +1)
  14 #define AppMajorVersionNo Copy(AppVersionNo, 1, AppMajorVersionIdx -1)
  15 #define AppMinorVersionNo Copy(AppMinorVersionTemp, 1, Pos(".", AppMinorVersionTemp)-1)
  16 
  17 ; define some more stuff, mainly to just keep it all at the beginning
  18 #define MyAppName "My Program"
  19 #define MyAppPublisher "My Company, Inc."
  20 #define MyAppURL "http://www.example.com/"
  21 #define MyAppSupportURL "http://www.example.com/support"
  22 #define MyAppUpdatesURL "http://www.example.com/downloads"
  23 
  24 #define MyAppExeName "simplewx.exe"
  25 
  26 #define OutputFileName "setup-simplewx"
  27 
  28 
  29 
  30 [Setup]
  31 ; NOTE: The value of AppId uniquely identifies this application.
  32 ; Do not use the same AppId value in installers for other applications.
  33 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  34 AppId={{451B698D-E97F-444E-9FA9-B7180E450563}
  35 AppName={#MyAppName}
  36 AppVersion={#AppVersionNo}
  37 AppVerName={#MyAppName} version {#AppMajorVersionNo}.{#AppMinorVersionNo}
  38 AppPublisher={#MyAppPublisher}
  39 AppPublisherURL={#MyAppURL}
  40 AppSupportURL={#MyAppSupportURL}
  41 AppUpdatesURL={#MyAppUpdatesURL}
  42 ; following should probably be something like "{pf}\yourappname" for a real application
  43 DefaultDirName=c:\temp\samplewx
  44 DefaultGroupName=simplewx - py2exe package sample
  45 AllowNoIcons=yes
  46 
  47 OutputBaseFilename={#OutputFileName}_{#AppVersionNo}
  48 
  49 ; bzip/9 is better by about 400KB over zip/9 and lzma is even better
  50 Compression=lzma/ultra
  51 ; following would reduce size a bit more
  52 ;SolidCompression=yes
  53 
  54 [Languages]
  55 Name: english; MessagesFile: compiler:Default.isl
  56 
  57 [Tasks]
  58 Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  59 Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  60 
  61 [Files]
  62 Source: ..\dist\simplewx.exe; DestDir: {app}; Flags: ignoreversion
  63 Source: ..\dist\python26.dll; DestDir: {app}; Flags: ignoreversion
  64 Source: ..\dist\w9xpopen.exe; DestDir: {app}; Flags: ignoreversion
  65 Source: ..\dist\lib\*; DestDir: {app}\lib; Flags: ignoreversion recursesubdirs createallsubdirs
  66 Source: ..\dist\Microsoft.VC90.CRT\*; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion recursesubdirs createallsubdirs
  67 ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
  68 
  69 [Icons]
  70 Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
  71 Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon
  72 Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon
  73 
  74 [Run]
  75 Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent
  76 

Other wiki pages to check

Comments

Please feel free to provide any feedback on this page either here, on the wxPython-user list or to werner.bruhin at free.fr.

InnoSetup (last edited 2009-07-24 08:08:54 by ABordeaux-156-1-12-192)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.