|
|
@@ -1,141 +0,0 @@
|
|
|
-; Installation program script for Hello world
|
|
|
-
|
|
|
-; WARNING: do not forget to regenerate the AppId (Inno Setup > Tools > Generate GUI) ; Double the bracklaces
|
|
|
-#define AppGuid "{3ABFE415-C8DA-43E8-91BD-0DFD8231A58F}"
|
|
|
-
|
|
|
-; Version of the installer
|
|
|
-#define FileVersion "1.0.0"
|
|
|
-
|
|
|
-; Application short name (also the name of the install directory)
|
|
|
-#define AppName "hello_world"
|
|
|
-
|
|
|
-; Application verbose name
|
|
|
-#define AppVerboseName "Python Hello World"
|
|
|
-
|
|
|
-; Application current version
|
|
|
-#define AppVersion "0.1"
|
|
|
-
|
|
|
-; Publisher's name
|
|
|
-#define AppPublisher "Conseil Départemental du Bas-Rhin"
|
|
|
-
|
|
|
-; Website
|
|
|
-#define AppURL "http://codebox/lab/Python_3-6-1"
|
|
|
-
|
|
|
-; Install diretory
|
|
|
-#define AppLocation "{%temp}"
|
|
|
-
|
|
|
-; Python version required
|
|
|
-#define PythonVersion "3.6-32"
|
|
|
-
|
|
|
-[Setup]
|
|
|
-AppId={{#AppGuid}}
|
|
|
-VersionInfoVersion={#FileVersion}
|
|
|
-AppName={#AppVerboseName}
|
|
|
-AppVersion={#AppVersion}
|
|
|
-AppPublisher={#AppPublisher}
|
|
|
-AppPublisherURL={#AppURL}
|
|
|
-AppSupportURL={#AppURL}
|
|
|
-AppUpdatesURL={#AppURL}
|
|
|
-DefaultDirName={#AppLocation}\\{#AppName}
|
|
|
-DefaultGroupName={#AppName}
|
|
|
-Compression=lzma
|
|
|
-PrivilegesRequired=lowest
|
|
|
-SolidCompression=yes
|
|
|
-VersionInfoCompany={#AppPublisher}
|
|
|
-DisableDirPage=yes
|
|
|
-DisableProgramGroupPage=yes
|
|
|
-DisableFinishedPage=yes
|
|
|
-OutputDir=.
|
|
|
-OutputBaseFilename=setup-{#AppName}
|
|
|
-ChangesEnvironment=yes
|
|
|
-UninstallFilesDir={app}\uninstall\
|
|
|
-
|
|
|
-[Languages]
|
|
|
-Name: "french"; MessagesFile: "compiler:Languages\French.isl"
|
|
|
-
|
|
|
-[Files]
|
|
|
-; Files to be installed
|
|
|
-Source: "core\*"; DestDir: "{app}\core"; Flags: recursesubdirs
|
|
|
-Source: "ui\*"; DestDir: "{app}\ui"; Flags: recursesubdirs
|
|
|
-Source: "main.py"; DestDir: "{app}"
|
|
|
-Source: "updater.py"; DestDir: "{app}"
|
|
|
-Source: "icon.ico"; DestDir: "{app}"
|
|
|
-Source: "requirements.txt"; DestDir: "{app}"
|
|
|
-Source: "VERSION"; DestDir: "{app}"
|
|
|
-
|
|
|
-[Icons]
|
|
|
-; Shortcuts to be created in the menu bar and on the desktop
|
|
|
-; WARNING: Because it's an UI app, pythonw.exe is used. Replace with 'python.exe' for a console app.
|
|
|
-Name: "{group}\{#AppName}"; Filename: "{code:fPythonDir}\pythonw.exe"; Parameters: """{app}\main.py"""; WorkingDir: "{app}"; IconFilename: "{app}\icon.ico"
|
|
|
-Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
|
|
|
-Name: "{commondesktop}\{#AppName}"; Filename: "{code:fPythonDir}\pythonw.exe"; Parameters: """{app}\main.py"""; WorkingDir: "{app}"; IconFilename: "{app}\icon.ico"
|
|
|
-
|
|
|
-[Code]
|
|
|
-var
|
|
|
- sPythonDir: String;
|
|
|
- sPythonExecPath: String;
|
|
|
- sPythonWExecPath: String;
|
|
|
-
|
|
|
-// Return the directory containing the python executable
|
|
|
-procedure UpdatePythonDir();
|
|
|
-var
|
|
|
- Dirname: String;
|
|
|
-begin
|
|
|
- sPythonDir := '';
|
|
|
-
|
|
|
- if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Python\PythonCore\{#PythonVersion}\InstallPath', '', Dirname) OR
|
|
|
- RegQueryStringValue(HKLM, 'SOFTWARE\Python\PythonCore\{#PythonVersion}\InstallPath', '', Dirname) then
|
|
|
- begin
|
|
|
- sPythonDir := Dirname;
|
|
|
- sPythonExecPath := Dirname + 'python.exe'
|
|
|
- sPythonWExecPath := Dirname + 'pythonw.exe'
|
|
|
- end
|
|
|
-end;
|
|
|
-
|
|
|
-// Initial checkup
|
|
|
-function InitializeSetup(): Boolean;
|
|
|
-begin
|
|
|
- UpdatePythonDir();
|
|
|
-
|
|
|
- // check that python is installed
|
|
|
- if not FileExists(sPythonExecPath) then
|
|
|
- begin
|
|
|
- MsgBox('Python {#PythonVersion} doit être installé.' + #13#10 + 'Installation annulée.', mbError, MB_OK);
|
|
|
- Result := False;
|
|
|
- Exit;
|
|
|
- end
|
|
|
-
|
|
|
- Result := True;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure CurStepChanged(CurStep: TSetupStep);
|
|
|
-var
|
|
|
- ShowCmd: Integer;
|
|
|
- ExitCode: Integer;
|
|
|
-begin
|
|
|
- if CurStep = ssPostInstall then
|
|
|
- begin
|
|
|
-
|
|
|
- // Search for a requirements.txt file,and process it if exists
|
|
|
- if FileExists(ExpandConstant('{app}\requirements.txt')) then
|
|
|
- begin
|
|
|
-
|
|
|
- if WizardSilent then begin ShowCmd := SW_HIDE end else begin ShowCmd := SW_SHOWNORMAL end
|
|
|
- Exec(sPythonDir + 'Scripts\pip67.exe', 'install -r ' + ExpandConstant('"{app}\requirements.txt"'), '', ShowCmd, ewWaitUntilTerminated, ExitCode);
|
|
|
-
|
|
|
- if ExitCode <> 0 then
|
|
|
- begin
|
|
|
- MsgBox('Python 3.6 - Une erreur s''est produite lors de l''installation des librairies' + #13#10 + '[' + SysErrorMessage(ExitCode) + ']', mbError, MB_OK);
|
|
|
- Exit;
|
|
|
- end
|
|
|
- Log('Installed in ' + ExpandConstant('{app}'))
|
|
|
- end
|
|
|
- end
|
|
|
-end;
|
|
|
-
|
|
|
-// Scripted Constants for use in the other sections
|
|
|
-function fPythonDir(Param: String): String;
|
|
|
-begin
|
|
|
- Result := sPythonDir;
|
|
|
-end;
|
|
|
-
|