6
votes

I am developing an application that needs python to be installed to execute. I am thinking of creating an installer(for windows) which will install the required setups automatically before installing my application. I have gone through inno setup which looks like a better solution for my requirement.I am new to both python and inno setup.Can Any body provide some links and guidelines on this.Any help is appreciated.

2
Quote from python website "Python releases include an excellent Windows installer" - What is your question?Sir Rufo
@sir Rufo My application need python environment for its functionality,So before installing my application I need to check whether python is installed or not,so I thought of making it automated by using an installer which will check for python and will install it if python is not found. I have observed inno setup as a good tool for such purposes.So would like to have some inno set up scripts or guidelines for the same.dileepVikram
So you are looking for something to integrate the python installer? Then you should update your question :o)Sir Rufo
The keyword here is prerequisites and this is very common (e.g. deploying .Net applications)Sir Rufo

2 Answers

6
votes

if you are thinking of creating an installer(for windows) which will install the required setups automatically before Lauching(installing) my application

then the below script will help you to do this...you need to mention python executable in runsection and files section as like winscp in this script.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{BD59E856-F194-4E05-A93B-89089F3E3E9D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\softwares\winscp512setup.exe"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\winscp512setup.exe"; Description: "Before launching this application you need to install xxx this ,so please install this and then launch"; Flags: nowait shellexec skipifsilent
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 

you can find whether python is installed or not by using these below ways

1.Direxists function(Here you can Check whether python directory exists in program files or not )

2.filexists function(with this you can check python files are there in the users systems )

3.Query the registry with the python registry key names(HKEY_LOCAL_MACHINE\SOFTWARE\Python)..

then if you get result positive then go for your application installation other wise install python for windows and then run your applications. you need to pack python for windows setup with the help of files section. you must use [Code] section of inno setup, to use above function.

please see pascal script : support functions in inno setup help file..

5
votes

If your program depends on many 3rd party packages and not just the Python standard library then it might be easier to freeze it using cx_Freeze or py2exe and then package all files into an installer using Inno Setup.