Changeset 759a8ab in sasview for installers
- Timestamp:
- Aug 29, 2017 5:30:45 PM (7 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 25a42f99
- Parents:
- 7c64911 (diff), f001bc9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- installers
- Files:
-
- 4 added
- 1 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
installers/setup_exe.py
red03b99 r759a8ab 345 345 346 346 # Exclude packages that are not needed but are often found on build systems 347 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 348 349 347 excludes = [ 348 'Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy', 350 349 # Various matplotlib backends we are not using 351 350 'libgdk_pixbuf-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk-win32-2.0-0.dll', -
installers/installer_generator.py
ra1b8fee ra67ec83 6 6 from __future__ import print_function 7 7 8 import local_config 9 import os 8 import os 10 9 import string 11 10 11 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 12 sys.path.insert(0, os.path.join(root, 'sasview-install', 'Lib', 'site-packages')) 13 from sas.sasview import local_config 12 14 13 15 REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" … … 23 25 AppUpdatesURL = local_config._homepage 24 26 ChangesEnvironment = 'true' 25 DefaultDirName = os.path.join("{pf}" , AppName+Dev) 27 DefaultDirName = os.path.join("{pf}" , AppName+Dev) 26 28 DefaultGroupName = os.path.join(local_config.DefaultGroupName, AppVerName) 27 29 28 30 OutputBaseFilename = local_config.OutputBaseFilename 29 31 SetupIconFile = "images\\ball.ico" … … 46 48 list_app =[] 47 49 try: 48 50 49 51 #(ext, type, name, flags) 50 52 from sas.sascalc.dataloader.loader import Loader … … 55 57 if ext.strip() not in ['.*', ''] and ext.strip() not in list_data: 56 58 list_data.append((ext, 'string', file_type)) 57 except :59 except Exception: 58 60 pass 59 61 try: … … 61 63 if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 62 64 list_app.append((ext, 'string', file_type)) 63 except :65 except Exception: 64 66 pass 65 67 try: … … 67 69 file_type, ext = string.split(item, "|*", 1) 68 70 if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 69 list_app.append((ext, 'string', file_type)) 70 except :71 list_app.append((ext, 'string', file_type)) 72 except Exception: 71 73 pass 72 74 return list_data, list_app … … 91 93 % str(APPLICATION) 92 94 msg += """ValueType: %s; """ % str('string') 93 msg += """ValueName: "%s";\t""" %str('') 95 msg += """ValueName: "%s";\t""" %str('') 94 96 msg += """ValueData: \"""{app}\%s"" ""%s1\"""; \t"""% (str(APPLICATION), 95 str('%')) 97 str('%')) 96 98 msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 97 99 msg += "\n" 98 user_list = "Software\Classes" 100 user_list = "Software\Classes" 99 101 for (ext, type, _) in data_extension: 100 102 list = os.path.join(user_list, ext, openwithlist) … … 107 109 % (str(user_list), str(APPLICATION)) 108 110 msg += """ValueType: %s; """ % str('string') 109 msg += """ValueName: "%s";\t""" %str('') 111 msg += """ValueName: "%s";\t""" %str('') 110 112 msg += """ValueData: \"""{app}\%s"" ""%s1\"""; \t"""% (str(APPLICATION), 111 str('%')) 113 str('%')) 112 114 msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 113 msg += "\n" 115 msg += "\n" 114 116 if app_extension is not None and app_extension: 115 117 for (ext, type, _) in app_extension: 116 118 msg += """Root: HKCR;\tSubkey: "%s";\t""" % str(ext) 117 119 msg += """ValueType: %s;\t""" % str(type) 118 #file type empty set the current application as the default 120 #file type empty set the current application as the default 119 121 #reader for this file. change the value of file_type to another 120 122 #string modify the default reader … … 126 128 msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(APPLICATION) 127 129 msg += """ValueType: %s; """ % str('string') 128 msg += """ValueName: "%s";\t""" % str('') 129 msg += """ValueData: "{app}\%s";\t""" % str("SasView File") 130 msg += """ValueName: "%s";\t""" % str('') 131 msg += """ValueData: "{app}\%s";\t""" % str("SasView File") 130 132 msg += """ Flags: %s \t""" % str("uninsdeletekey noerror") 131 133 msg += "\n" 132 134 133 135 #execute the file on double-click 134 136 msg += """Root: HKCR; Subkey: "{app}\%s\shell\open\command";\t""" % str(APPLICATION) 135 137 msg += """ValueType: %s; """ % str('string') 136 msg += """ValueName: "%s";\t""" %str('') 138 msg += """ValueName: "%s";\t""" %str('') 137 139 msg += """ValueData: \"""{app}\%s"" ""%s1\""";\t"""% (str(APPLICATION), 138 str('%')) 140 str('%')) 139 141 msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 140 msg += "\n" 142 msg += "\n" 141 143 #create default icon 142 144 msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(SetupIconFile) 143 145 msg += """ValueType: %s; """ % str('string') 144 msg += """ValueName: "%s";\t""" % str('') 146 msg += """ValueName: "%s";\t""" % str('') 145 147 msg += """ValueData: "{app}\%s,0";\t""" % str(APPLICATION) 146 148 msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 147 msg += "\n" 148 149 149 msg += "\n" 150 151 150 152 #SASVIEWPATH 151 153 msg += """Root: HKLM; Subkey: "%s";\t""" % str('SYSTEM\CurrentControlSet\Control\Session Manager\Environment') 152 154 msg += """ValueType: %s; """ % str('expandsz') 153 msg += """ValueName: "%s";\t""" % str('SASVIEWPATH') 155 msg += """ValueName: "%s";\t""" % str('SASVIEWPATH') 154 156 msg += """ValueData: "{app}";\t""" 155 157 msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 156 158 msg += "\n" 157 159 158 160 #PATH 159 161 msg += """; Write to PATH (below) is disabled; need more tests\n""" 160 162 msg += """;Root: HKCU; Subkey: "%s";\t""" % str('Environment') 161 163 msg += """ValueType: %s; """ % str('expandsz') 162 msg += """ValueName: "%s";\t""" % str('PATH') 164 msg += """ValueName: "%s";\t""" % str('PATH') 163 165 msg += """ValueData: "%s;{olddata}";\t""" % str('%SASVIEWPATH%') 164 166 msg += """ Check: %s""" % str('NeedsAddPath()') 165 167 msg += "\n" 166 167 return msg 168 169 def write_language (language=['english'], msfile="compiler:Default.isl"):168 169 return msg 170 171 def write_languages(languages=('english',), msfile="compiler:Default.isl"): 170 172 """ 171 173 define the language of the application 172 """ 174 """ 173 175 msg = '' 174 if language :176 if languages: 175 177 msg = "\n\n[Languages]\n" 176 for lang in language: 177 msg += """Name: "%s";\tMessagesFile: "%s"\n""" % (str(lang), 178 str(msfile)) 179 return msg 178 for lang in languages: 179 msg += """Name: "%s";\tMessagesFile: "%s"\n""" % (str(lang), str(msfile)) 180 return msg 180 181 181 182 def write_tasks(): … … 201 202 msg += """Flags: ignoreversion recursesubdirs createallsubdirs\n""" 202 203 msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 203 msg += """Flags: recursesubdirs createallsubdirs\n""" 204 msg += """Flags: recursesubdirs createallsubdirs\n""" 204 205 msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 205 206 msg += """Flags: recursesubdirs createallsubdirs\n""" 206 msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 207 msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 207 208 msg += """Flags: recursesubdirs createallsubdirs\n""" 208 #msg += """Source: "dist\default_categories.json"; DestDir: "{userdesktop}\..\.sasview";\t""" 209 #msg += """Source: "dist\default_categories.json"; DestDir: "{userdesktop}\..\.sasview";\t""" 209 210 #msg += """DestName: "categories.json";\n""" 210 211 msg += """;\tNOTE: Don't use "Flags: ignoreversion" on any shared system files""" … … 235 236 msg = """\n\n[Run]\n""" 236 237 msg += """Filename: "{app}\%s";\t""" % str(APPLICATION) 237 msg += """Description: "{cm:LaunchProgram, %s}";\t""" %str(AppName) 238 msg += """Description: "{cm:LaunchProgram, %s}";\t""" %str(AppName) 238 239 msg += """Flags: nowait postinstall skipifsilent\n""" 239 240 msg += """; Install the Microsoft C++ DLL redistributable package if it is """ … … 260 261 msg = """\n\n[Dirs]\n""" 261 262 msg += """Name: "{app}\%s";\t""" % str('') 262 msg += """Permissions: everyone-modify\t""" 263 msg += """\n""" 263 msg += """Permissions: everyone-modify\t""" 264 msg += """\n""" 264 265 return msg 265 266 266 267 def write_code(): 267 268 """ 268 Code that checks the existing path and snaviewpath 269 Code that checks the existing path and snaviewpath 269 270 in the environmental viriables/PATH 270 271 """ 271 272 msg = """\n\n[Code]\n""" 272 msg += """function InstallVC90CRT(): Boolean;\n""" 273 msg += """function InstallVC90CRT(): Boolean;\n""" 273 274 msg += """begin\n""" 274 275 msg += """ Result := not DirExists('C:\WINDOWS\WinSxS\\x86_Microsoft.VC90.""" 275 276 msg += """CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375');\n""" 276 277 msg += """end;\n\n""" 277 msg += """function NeedsAddPath(): boolean;\n""" 278 msg += """var\n""" 278 msg += """function NeedsAddPath(): boolean;\n""" 279 msg += """var\n""" 279 280 msg += """ oldpath: string;\n""" 280 msg += """ newpath: string;\n""" 281 msg += """ pathArr: TArrayOfString;\n""" 282 msg += """ i: Integer;\n""" 283 msg += """begin\n""" 281 msg += """ newpath: string;\n""" 282 msg += """ pathArr: TArrayOfString;\n""" 283 msg += """ i: Integer;\n""" 284 msg += """begin\n""" 284 285 msg += """ RegQueryStringValue(HKEY_CURRENT_USER,'Environment',""" 285 286 msg += """'PATH', oldpath)\n""" … … 324 325 msg += """; installation.\n""" 325 326 msg += """Type: dirifempty; Name: "{app}"\n""" 326 msg += """\n""" 327 msg += """\n""" 327 328 return msg 328 329 … … 333 334 TEMPLATE += "\n; and local_config.py located in this directory.\n " 334 335 TEMPLATE += "; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!" 335 TEMPLATE += "\n[Setup]\n\n" 336 TEMPLATE += "\n[Setup]\n\n" 336 337 TEMPLATE += "ChangesAssociations=%s\n" %str('yes') 337 338 TEMPLATE += "AppName=%s\n" % str(AppName) … … 352 353 TEMPLATE += "PrivilegesRequired=%s\n" % str(PrivilegesRequired) 353 354 TEMPLATE += "UsePreviousAppDir=no\n" 354 355 355 356 TEMPLATE += write_registry(data_extension=DATA_EXTENSION, 356 357 app_extension=APP_EXTENSION) 357 TEMPLATE += write_language ()358 TEMPLATE += write_languages() 358 359 TEMPLATE += write_tasks() 359 360 TEMPLATE += write_file() … … 364 365 TEMPLATE += write_uninstalldelete() 365 366 path = '%s.iss' % str(INSTALLER_FILE) 366 f = open(path,'w') 367 f = open(path,'w') 367 368 f.write(TEMPLATE) 368 369 f.close() 369 370 print("Generate Inno setup installer script complete") 370 371 print("A new file %s.iss should be created.Please refresh your directory" % str(INSTALLER_FILE)) 371 372 372 373 if __name__ == "__main__": 373 374 generate_installer()
Note: See TracChangeset
for help on using the changeset viewer.