Changeset 759a8ab in sasview for installers


Ignore:
Timestamp:
Aug 29, 2017 5:30:45 PM (2 years ago)
Author:
Paul Kienzle <pkienzle@…>
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.
Message:

Merge branch 'master' into ticket-887-reorg

Location:
installers
Files:
4 added
1 edited
8 moved

Legend:

Unmodified
Added
Removed
  • installers/setup_exe.py

    red03b99 r759a8ab  
    345345 
    346346# Exclude packages that are not needed but are often found on build systems 
    347 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 
    348  
    349  
     347excludes = [ 
     348    'Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy', 
    350349    # Various matplotlib backends we are not using 
    351350    'libgdk_pixbuf-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk-win32-2.0-0.dll', 
  • installers/installer_generator.py

    ra1b8fee ra67ec83  
    66from __future__ import print_function 
    77 
    8 import local_config 
    9 import os  
     8import os 
    109import string 
    1110 
     11root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
     12sys.path.insert(0, os.path.join(root, 'sasview-install', 'Lib', 'site-packages')) 
     13from sas.sasview import local_config 
    1214 
    1315REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" 
     
    2325AppUpdatesURL = local_config._homepage 
    2426ChangesEnvironment = 'true' 
    25 DefaultDirName = os.path.join("{pf}" , AppName+Dev)  
     27DefaultDirName = os.path.join("{pf}" , AppName+Dev) 
    2628DefaultGroupName = os.path.join(local_config.DefaultGroupName, AppVerName) 
    27                                  
     29 
    2830OutputBaseFilename = local_config.OutputBaseFilename 
    2931SetupIconFile = "images\\ball.ico" 
     
    4648    list_app =[] 
    4749    try: 
    48          
     50 
    4951        #(ext, type, name, flags) 
    5052        from sas.sascalc.dataloader.loader import Loader 
     
    5557            if ext.strip() not in ['.*', ''] and ext.strip() not in list_data: 
    5658                list_data.append((ext, 'string', file_type)) 
    57     except: 
     59    except Exception: 
    5860        pass 
    5961    try: 
     
    6163        if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 
    6264            list_app.append((ext, 'string', file_type)) 
    63     except: 
     65    except Exception: 
    6466        pass 
    6567    try: 
     
    6769            file_type, ext = string.split(item, "|*", 1) 
    6870            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: 
    7173        pass 
    7274    return list_data, list_app 
     
    9193                              %  str(APPLICATION) 
    9294        msg += """ValueType: %s; """ % str('string') 
    93         msg += """ValueName: "%s";\t""" %str('')  
     95        msg += """ValueName: "%s";\t""" %str('') 
    9496        msg += """ValueData: \"""{app}\%s""  ""%s1\"""; \t"""% (str(APPLICATION), 
    95                                                           str('%'))     
     97                                                          str('%')) 
    9698        msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    9799        msg += "\n" 
    98         user_list = "Software\Classes"  
     100        user_list = "Software\Classes" 
    99101        for (ext, type, _) in data_extension: 
    100102            list = os.path.join(user_list, ext, openwithlist) 
     
    107109                              %  (str(user_list), str(APPLICATION)) 
    108110        msg += """ValueType: %s; """ % str('string') 
    109         msg += """ValueName: "%s";\t""" %str('')  
     111        msg += """ValueName: "%s";\t""" %str('') 
    110112        msg += """ValueData: \"""{app}\%s""  ""%s1\"""; \t"""% (str(APPLICATION), 
    111                                                           str('%'))     
     113                                                          str('%')) 
    112114        msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    113         msg += "\n"         
     115        msg += "\n" 
    114116    if app_extension is not None and app_extension: 
    115117        for (ext, type, _) in app_extension: 
    116118            msg +=  """Root: HKCR;\tSubkey: "%s";\t""" % str(ext) 
    117119            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 
    119121            #reader for this file. change the value of file_type to another 
    120122            #string modify the default reader 
     
    126128    msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(APPLICATION) 
    127129    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") 
    130132    msg += """ Flags: %s \t""" % str("uninsdeletekey  noerror") 
    131133    msg += "\n" 
    132          
     134 
    133135    #execute the file on double-click 
    134136    msg += """Root: HKCR; Subkey: "{app}\%s\shell\open\command";\t"""  %  str(APPLICATION) 
    135137    msg += """ValueType: %s; """ % str('string') 
    136     msg += """ValueName: "%s";\t""" %str('')  
     138    msg += """ValueName: "%s";\t""" %str('') 
    137139    msg += """ValueData: \"""{app}\%s""  ""%s1\""";\t"""% (str(APPLICATION), 
    138                                                           str('%'))   
     140                                                          str('%')) 
    139141    msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 
    140     msg += "\n"                                                       
     142    msg += "\n" 
    141143    #create default icon 
    142144    msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(SetupIconFile) 
    143145    msg += """ValueType: %s; """ % str('string') 
    144     msg += """ValueName: "%s";\t""" % str('')  
     146    msg += """ValueName: "%s";\t""" % str('') 
    145147    msg += """ValueData: "{app}\%s,0";\t""" % str(APPLICATION) 
    146148    msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 
    147     msg += "\n"   
    148  
    149      
     149    msg += "\n" 
     150 
     151 
    150152    #SASVIEWPATH 
    151153    msg += """Root: HKLM; Subkey: "%s";\t"""  %  str('SYSTEM\CurrentControlSet\Control\Session Manager\Environment') 
    152154    msg += """ValueType: %s; """ % str('expandsz') 
    153     msg += """ValueName: "%s";\t""" % str('SASVIEWPATH')  
     155    msg += """ValueName: "%s";\t""" % str('SASVIEWPATH') 
    154156    msg += """ValueData: "{app}";\t""" 
    155157    msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    156158    msg += "\n" 
    157      
     159 
    158160    #PATH 
    159161    msg += """; Write to PATH (below) is disabled; need more tests\n""" 
    160162    msg += """;Root: HKCU; Subkey: "%s";\t"""  %  str('Environment') 
    161163    msg += """ValueType: %s; """ % str('expandsz') 
    162     msg += """ValueName: "%s";\t""" % str('PATH')  
     164    msg += """ValueName: "%s";\t""" % str('PATH') 
    163165    msg += """ValueData: "%s;{olddata}";\t""" % str('%SASVIEWPATH%') 
    164166    msg += """ Check: %s""" % str('NeedsAddPath()') 
    165167    msg += "\n" 
    166          
    167     return msg 
    168  
    169 def write_language(language=['english'], msfile="compiler:Default.isl"):   
     168 
     169    return msg 
     170 
     171def write_languages(languages=('english',), msfile="compiler:Default.isl"): 
    170172    """ 
    171173    define the language of the application 
    172     """  
     174    """ 
    173175    msg = '' 
    174     if language: 
     176    if languages: 
    175177        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 
    180181 
    181182def write_tasks(): 
     
    201202    msg += """Flags: ignoreversion recursesubdirs createallsubdirs\n""" 
    202203    msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
    203     msg += """Flags: recursesubdirs createallsubdirs\n"""  
     204    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    204205    msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 
    205206    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""" 
    207208    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""" 
    209210    #msg += """DestName: "categories.json";\n""" 
    210211    msg += """;\tNOTE: Don't use "Flags: ignoreversion" on any shared system files""" 
     
    235236    msg = """\n\n[Run]\n""" 
    236237    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) 
    238239    msg += """Flags: nowait postinstall skipifsilent\n""" 
    239240    msg += """; Install the Microsoft C++ DLL redistributable package if it is """ 
     
    260261    msg = """\n\n[Dirs]\n""" 
    261262    msg += """Name: "{app}\%s";\t""" % str('') 
    262     msg += """Permissions: everyone-modify\t"""  
    263     msg += """\n"""   
     263    msg += """Permissions: everyone-modify\t""" 
     264    msg += """\n""" 
    264265    return msg 
    265266 
    266267def write_code(): 
    267268    """ 
    268     Code that checks the existing path and snaviewpath  
     269    Code that checks the existing path and snaviewpath 
    269270    in the environmental viriables/PATH 
    270271    """ 
    271272    msg = """\n\n[Code]\n""" 
    272     msg += """function InstallVC90CRT(): Boolean;\n"""  
     273    msg += """function InstallVC90CRT(): Boolean;\n""" 
    273274    msg += """begin\n""" 
    274275    msg += """    Result := not DirExists('C:\WINDOWS\WinSxS\\x86_Microsoft.VC90.""" 
    275276    msg += """CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375');\n""" 
    276277    msg += """end;\n\n""" 
    277     msg += """function NeedsAddPath(): boolean;\n"""  
    278     msg += """var\n"""  
     278    msg += """function NeedsAddPath(): boolean;\n""" 
     279    msg += """var\n""" 
    279280    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""" 
    284285    msg += """  RegQueryStringValue(HKEY_CURRENT_USER,'Environment',""" 
    285286    msg += """'PATH', oldpath)\n""" 
     
    324325    msg += """; installation.\n""" 
    325326    msg += """Type: dirifempty; Name: "{app}"\n""" 
    326     msg += """\n"""   
     327    msg += """\n""" 
    327328    return msg 
    328329 
     
    333334    TEMPLATE += "\n; and local_config.py located in this directory.\n " 
    334335    TEMPLATE += "; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!" 
    335     TEMPLATE += "\n[Setup]\n\n"  
     336    TEMPLATE += "\n[Setup]\n\n" 
    336337    TEMPLATE += "ChangesAssociations=%s\n" %str('yes') 
    337338    TEMPLATE += "AppName=%s\n" % str(AppName) 
     
    352353    TEMPLATE += "PrivilegesRequired=%s\n" % str(PrivilegesRequired) 
    353354    TEMPLATE += "UsePreviousAppDir=no\n" 
    354     
     355 
    355356    TEMPLATE += write_registry(data_extension=DATA_EXTENSION, 
    356357                                app_extension=APP_EXTENSION) 
    357     TEMPLATE += write_language() 
     358    TEMPLATE += write_languages() 
    358359    TEMPLATE += write_tasks() 
    359360    TEMPLATE += write_file() 
     
    364365    TEMPLATE += write_uninstalldelete() 
    365366    path = '%s.iss' % str(INSTALLER_FILE) 
    366     f = open(path,'w')  
     367    f = open(path,'w') 
    367368    f.write(TEMPLATE) 
    368369    f.close() 
    369370    print("Generate Inno setup installer script complete") 
    370371    print("A new file %s.iss should be created.Please refresh your directory" % str(INSTALLER_FILE)) 
    371      
     372 
    372373if __name__ == "__main__": 
    373374    generate_installer() 
Note: See TracChangeset for help on using the changeset viewer.