setup.iss 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ; Script de création du programme d'installation Pardit
  2. #define MyAppName "pardit"
  3. #define MyAppVersion "0.2"
  4. #define FileVersion "0-2"
  5. #define MyAppPublisher "Conseil Départemental du Bas-Rhin"
  6. #define MyAppURL "http://codebox/Culture-Territo-BI/pardit"
  7. #define MyAppLocation "C:\Applications_CD67\MRI-PARDIT\"
  8. #define PythonVersion "3.6-32"
  9. [Setup]
  10. AppId={{C8002CE1-D79C-4B0C-AD8A-73F43D219CD6}}
  11. AppName={#MyAppName}
  12. AppVersion={#MyAppVersion}
  13. AppPublisher={#MyAppPublisher}
  14. AppPublisherURL={#MyAppURL}
  15. AppSupportURL={#MyAppURL}
  16. AppUpdatesURL={#MyAppURL}
  17. DefaultDirName={#MyAppLocation}{#MyAppName}
  18. DefaultGroupName={#MyAppName}
  19. Compression=lzma
  20. PrivilegesRequired=lowest
  21. SolidCompression=yes
  22. VersionInfoCompany=Conseil Départemental du Bas-Rhin
  23. DisableDirPage=yes
  24. DisableProgramGroupPage=yes
  25. DisableFinishedPage=yes
  26. OutputDir=.
  27. OutputBaseFilename=setup-{#MyAppName}
  28. ChangesEnvironment=yes
  29. UninstallFilesDir={app}\uninstall\
  30. [Languages]
  31. Name: "french"; MessagesFile: "compiler:Languages\French.isl"
  32. [Files]
  33. Source: "ui\*"; DestDir: "{app}\ui"; Flags: ignoreversion recursesubdirs
  34. Source: "core\*"; DestDir: "{app}\core"; Flags: ignoreversion recursesubdirs
  35. Source: "bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs
  36. Source: "doc\*"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs
  37. Source: "templates\*"; DestDir: "{app}\templates"; Flags: ignoreversion recursesubdirs
  38. Source: "pardit.py"; DestDir: "{app}"; Flags: ignoreversion
  39. Source: "pardit.yaml"; DestDir: "{app}"; Flags: ignoreversion
  40. Source: "README.md"; DestDir: "{app}"; Flags: ignoreversion
  41. Source: "requirements.txt"; DestDir: "{app}"; Flags: ignoreversion
  42. Source: "logo.png"; DestDir: "{app}"; Flags: ignoreversion
  43. Source: "pardit.ico"; DestDir: "{app}"; Flags: ignoreversion
  44. Source: "updater.py"; DestDir: "{app}"; Flags: ignoreversion
  45. Source: "version.txt"; DestDir: "{app}"; Flags: ignoreversion
  46. Source: "bin\pip67.exe"; DestDir: "{code:PythonDir}\Scripts"; Flags: onlyifdoesntexist
  47. [Icons]
  48. Name: "{group}\{#MyAppName}"; Filename: "pythonw.exe"; Parameters: "{app}\{#MyAppName}.py"; WorkingDir: "{app}"; IconFilename: "{app}\pardit.ico"
  49. Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
  50. Name: "{commondesktop}\{#MyAppName}"; Filename: "pythonw.exe"; Parameters: "{app}\{#MyAppName}.py"; WorkingDir: "{app}"; IconFilename: "{app}\pardit.ico"
  51. [Run]
  52. Filename: "pip67.exe"; Parameters: "install -r {app}\requirements.txt"; StatusMsg: "Installation des librairies complémentaires"; Flags: runhidden
  53. [Code]
  54. function PythonDir(Param: String): String;
  55. var
  56. ErrorCode: Integer;
  57. PythonDirpath: String;
  58. begin
  59. if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Python\PythonCore\{#PythonVersion}\InstallPath', '', PythonDirpath) OR
  60. RegQueryStringValue(HKLM, 'SOFTWARE\Python\PythonCore\{#PythonVersion}\InstallPath', '', PythonDirpath) then
  61. begin
  62. Result := PythonDirpath;
  63. end
  64. else
  65. begin
  66. Result := '';
  67. end
  68. end;
  69. function PythonExec(Param: String): String;
  70. var
  71. PythonDirPath: String;
  72. PythonPath: String;
  73. begin
  74. PythonDirPath := PythonDir('');
  75. if DirExists(PythonDirPath) then
  76. begin
  77. Result := PythonDirPath + 'python.exe';
  78. end
  79. else
  80. begin
  81. Result := '';
  82. end
  83. end;
  84. function InitializeSetup(): Boolean;
  85. var
  86. PythonPath : String;
  87. begin
  88. PythonPath := PythonExec('');
  89. if not FileExists(PythonPath) then
  90. begin
  91. MsgBox('Python {#PythonVersion} doit être installé.' + #13#10 + 'Installation annulée.', mbError, MB_OK);
  92. Result := False;
  93. Exit;
  94. end
  95. Result := True;
  96. end;