; Script de création du programme d'installation Pardit #define MyAppName "pardit" #define MyAppVersion "0.2" #define FileVersion "0-2" #define MyAppPublisher "Conseil Départemental du Bas-Rhin" #define MyAppURL "http://codebox/Culture-Territo-BI/pardit" #define MyAppLocation "C:\Applications_CD67\MRI-PARDIT\" #define PythonVersion "3.6-32" [Setup] AppId={{C8002CE1-D79C-4B0C-AD8A-73F43D219CD6}} AppName={#MyAppName} AppVersion={#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={#MyAppLocation}{#MyAppName} DefaultGroupName={#MyAppName} Compression=lzma PrivilegesRequired=lowest SolidCompression=yes VersionInfoCompany=Conseil Départemental du Bas-Rhin DisableDirPage=yes DisableProgramGroupPage=yes DisableFinishedPage=yes OutputDir=. OutputBaseFilename=setup-{#MyAppName} ChangesEnvironment=yes UninstallFilesDir={app}\uninstall\ [Languages] Name: "french"; MessagesFile: "compiler:Languages\French.isl" [Files] Source: "ui\*"; DestDir: "{app}\ui"; Flags: ignoreversion recursesubdirs Source: "core\*"; DestDir: "{app}\core"; Flags: ignoreversion recursesubdirs Source: "bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs Source: "doc\*"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs Source: "templates\*"; DestDir: "{app}\templates"; Flags: ignoreversion recursesubdirs Source: "pardit.py"; DestDir: "{app}"; Flags: ignoreversion Source: "pardit.yaml"; DestDir: "{app}"; Flags: ignoreversion Source: "README.md"; DestDir: "{app}"; Flags: ignoreversion Source: "requirements.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "logo.png"; DestDir: "{app}"; Flags: ignoreversion Source: "pardit.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "updater.py"; DestDir: "{app}"; Flags: ignoreversion Source: "version.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "bin\pip67.exe"; DestDir: "{code:PythonDir}\Scripts"; Flags: onlyifdoesntexist [Icons] Name: "{group}\{#MyAppName}"; Filename: "pythonw.exe"; Parameters: "{app}\{#MyAppName}.py"; WorkingDir: "{app}"; IconFilename: "{app}\pardit.ico" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" Name: "{commondesktop}\{#MyAppName}"; Filename: "pythonw.exe"; Parameters: "{app}\{#MyAppName}.py"; WorkingDir: "{app}"; IconFilename: "{app}\pardit.ico" [Run] Filename: "pip67.exe"; Parameters: "install -r {app}\requirements.txt"; StatusMsg: "Installation des librairies complémentaires"; Flags: runhidden [Code] function PythonDir(Param: String): String; var ErrorCode: Integer; PythonDirpath: String; begin if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Python\PythonCore\{#PythonVersion}\InstallPath', '', PythonDirpath) OR RegQueryStringValue(HKLM, 'SOFTWARE\Python\PythonCore\{#PythonVersion}\InstallPath', '', PythonDirpath) then begin Result := PythonDirpath; end else begin Result := ''; end end; function PythonExec(Param: String): String; var PythonDirPath: String; PythonPath: String; begin PythonDirPath := PythonDir(''); if DirExists(PythonDirPath) then begin Result := PythonDirPath + 'python.exe'; end else begin Result := ''; end end; function InitializeSetup(): Boolean; var PythonPath : String; begin PythonPath := PythonExec(''); if not FileExists(PythonPath) then begin MsgBox('Python {#PythonVersion} doit être installé.' + #13#10 + 'Installation annulée.', mbError, MB_OK); Result := False; Exit; end Result := True; end;