Changeset 724af06 in sasview for installers


Ignore:
Timestamp:
Sep 21, 2017 1:12:37 PM (7 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:
12d3e0e
Parents:
ce81f70 (diff), d76c43a (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
2 edited
7 moved

Legend:

Unmodified
Added
Removed
  • installers/README.txt

    r2f6d340 r724af06  
    441- Features 
    55=========== 
     6    - New in Version 4.1.2 
     7      -------------------- 
     8      This point release is a bug-fix release addressing: 
     9 
     10       - Fixes #984: PDF Reports Generate Empty PDFs 
     11       - Fixes a path typo 
     12       - 64 bit and 32 bit Windows executables now available 
     13 
     14      It is recommended that all users upgrade to this version 
     15 
     16    - New in Version 4.1.1 
     17      -------------------- 
     18      This point release is a bug-fix release addressing: 
     19 
     20       - Fixes #948: Mathjax CDN is going away 
     21       - Fixes #938: Cannot read canSAS1D file output by SasView 
     22       - Fixes #960: Save project throws error if empty fit page 
     23       - Fixes #929: Problem deleting data in first fit page 
     24       - Fixes #918: Test folders not bundled with release 
     25       - Fixes an issue with the live discovery of plugin models 
     26       - Fixes an issue with the NXcanSAS data loader 
     27       - Updated tutorials for SasView 4.x.y 
     28 
    629    - New in Version 4.1.0 
    730      ------------------ 
  • installers/sasview.spec

    r2f6d340 r724af06  
    138138 'sasmodels.core', 
    139139 'pyopencl', 
    140  'tinycc' 
     140 'tinycc', 
     141 'xhtml2pdf' 
    141142] 
    142143 
  • installers/installer_generator.py

    ra1b8fee r460d3a1  
    66from __future__ import print_function 
    77 
    8 import local_config 
    9 import os  
     8import os 
     9import sys 
    1010import string 
    1111 
    12  
    13 REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" 
     12root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
     13sys.path.insert(0, os.path.join(root, 'sasview-install', 'Lib', 'site-packages')) 
     14from sas.sasview import local_config 
     15 
     16#REG_PROGRAM = """{app}\MYPROG.EXE"" ""%1""" 
    1417APPLICATION = str(local_config.__appname__ )+ '.exe' 
    1518AppName = str(local_config.__appname__ ) 
     
    2326AppUpdatesURL = local_config._homepage 
    2427ChangesEnvironment = 'true' 
    25 DefaultDirName = os.path.join("{pf}" , AppName+Dev)  
     28DefaultDirName = os.path.join("{pf}" , AppName+Dev) 
    2629DefaultGroupName = os.path.join(local_config.DefaultGroupName, AppVerName) 
    27                                  
     30 
    2831OutputBaseFilename = local_config.OutputBaseFilename 
    29 SetupIconFile = "images\\ball.ico" 
     32SetupIconFile = local_config.SetupIconFile_win 
    3033LicenseFile = 'license.txt' 
    3134DisableProgramGroupPage = 'yes' 
     
    4649    list_app =[] 
    4750    try: 
    48          
     51 
    4952        #(ext, type, name, flags) 
    5053        from sas.sascalc.dataloader.loader import Loader 
     
    5558            if ext.strip() not in ['.*', ''] and ext.strip() not in list_data: 
    5659                list_data.append((ext, 'string', file_type)) 
    57     except: 
     60    except Exception: 
    5861        pass 
    5962    try: 
     
    6164        if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 
    6265            list_app.append((ext, 'string', file_type)) 
    63     except: 
     66    except Exception: 
    6467        pass 
    6568    try: 
     
    6770            file_type, ext = string.split(item, "|*", 1) 
    6871            if ext.strip() not in ['.', ''] and ext.strip() not in list_app: 
    69                 list_app.append((ext, 'string', file_type))  
    70     except: 
     72                list_app.append((ext, 'string', file_type)) 
     73    except Exception: 
    7174        pass 
    7275    return list_data, list_app 
     
    9194                              %  str(APPLICATION) 
    9295        msg += """ValueType: %s; """ % str('string') 
    93         msg += """ValueName: "%s";\t""" %str('')  
     96        msg += """ValueName: "%s";\t""" %str('') 
    9497        msg += """ValueData: \"""{app}\%s""  ""%s1\"""; \t"""% (str(APPLICATION), 
    95                                                           str('%'))     
     98                                                          str('%')) 
    9699        msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    97100        msg += "\n" 
    98         user_list = "Software\Classes"  
     101        user_list = "Software\Classes" 
    99102        for (ext, type, _) in data_extension: 
    100103            list = os.path.join(user_list, ext, openwithlist) 
     
    107110                              %  (str(user_list), str(APPLICATION)) 
    108111        msg += """ValueType: %s; """ % str('string') 
    109         msg += """ValueName: "%s";\t""" %str('')  
     112        msg += """ValueName: "%s";\t""" %str('') 
    110113        msg += """ValueData: \"""{app}\%s""  ""%s1\"""; \t"""% (str(APPLICATION), 
    111                                                           str('%'))     
     114                                                          str('%')) 
    112115        msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    113         msg += "\n"         
     116        msg += "\n" 
    114117    if app_extension is not None and app_extension: 
    115118        for (ext, type, _) in app_extension: 
    116119            msg +=  """Root: HKCR;\tSubkey: "%s";\t""" % str(ext) 
    117120            msg += """ValueType: %s;\t""" % str(type) 
    118             #file type empty set the current application as the default  
     121            #file type empty set the current application as the default 
    119122            #reader for this file. change the value of file_type to another 
    120123            #string modify the default reader 
     
    126129    msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(APPLICATION) 
    127130    msg += """ValueType: %s; """ % str('string') 
    128     msg += """ValueName: "%s";\t""" % str('')  
    129     msg += """ValueData: "{app}\%s";\t""" % str("SasView File")  
     131    msg += """ValueName: "%s";\t""" % str('') 
     132    msg += """ValueData: "{app}\%s";\t""" % str("SasView File") 
    130133    msg += """ Flags: %s \t""" % str("uninsdeletekey  noerror") 
    131134    msg += "\n" 
    132          
     135 
    133136    #execute the file on double-click 
    134137    msg += """Root: HKCR; Subkey: "{app}\%s\shell\open\command";\t"""  %  str(APPLICATION) 
    135138    msg += """ValueType: %s; """ % str('string') 
    136     msg += """ValueName: "%s";\t""" %str('')  
     139    msg += """ValueName: "%s";\t""" %str('') 
    137140    msg += """ValueData: \"""{app}\%s""  ""%s1\""";\t"""% (str(APPLICATION), 
    138                                                           str('%'))   
     141                                                          str('%')) 
    139142    msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 
    140     msg += "\n"                                                       
     143    msg += "\n" 
    141144    #create default icon 
    142145    msg += """Root: HKCR; Subkey: "{app}\%s";\t""" % str(SetupIconFile) 
    143146    msg += """ValueType: %s; """ % str('string') 
    144     msg += """ValueName: "%s";\t""" % str('')  
     147    msg += """ValueName: "%s";\t""" % str('') 
    145148    msg += """ValueData: "{app}\%s,0";\t""" % str(APPLICATION) 
    146149    msg += """ Flags: %s \t""" % str("uninsdeletevalue noerror") 
    147     msg += "\n"   
    148  
    149      
     150    msg += "\n" 
     151 
     152 
    150153    #SASVIEWPATH 
    151154    msg += """Root: HKLM; Subkey: "%s";\t"""  %  str('SYSTEM\CurrentControlSet\Control\Session Manager\Environment') 
    152155    msg += """ValueType: %s; """ % str('expandsz') 
    153     msg += """ValueName: "%s";\t""" % str('SASVIEWPATH')  
     156    msg += """ValueName: "%s";\t""" % str('SASVIEWPATH') 
    154157    msg += """ValueData: "{app}";\t""" 
    155158    msg += """ Flags: %s""" % str('uninsdeletevalue noerror') 
    156159    msg += "\n" 
    157      
     160 
    158161    #PATH 
    159162    msg += """; Write to PATH (below) is disabled; need more tests\n""" 
    160163    msg += """;Root: HKCU; Subkey: "%s";\t"""  %  str('Environment') 
    161164    msg += """ValueType: %s; """ % str('expandsz') 
    162     msg += """ValueName: "%s";\t""" % str('PATH')  
     165    msg += """ValueName: "%s";\t""" % str('PATH') 
    163166    msg += """ValueData: "%s;{olddata}";\t""" % str('%SASVIEWPATH%') 
    164167    msg += """ Check: %s""" % str('NeedsAddPath()') 
    165168    msg += "\n" 
    166          
    167     return msg 
    168  
    169 def write_language(language=['english'], msfile="compiler:Default.isl"):   
     169 
     170    return msg 
     171 
     172def write_languages(languages=('english',), msfile="compiler:Default.isl"): 
    170173    """ 
    171174    define the language of the application 
    172     """  
     175    """ 
    173176    msg = '' 
    174     if language: 
     177    if languages: 
    175178        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  
     179        for lang in languages: 
     180            msg += """Name: "%s";\tMessagesFile: "%s"\n""" % (str(lang), str(msfile)) 
     181    return msg 
    180182 
    181183def write_tasks(): 
     
    201203    msg += """Flags: ignoreversion recursesubdirs createallsubdirs\n""" 
    202204    msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
    203     msg += """Flags: recursesubdirs createallsubdirs\n"""  
     205    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    204206    msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 
    205207    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    206     msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t"""  
     208    msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 
    207209    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    208     #msg += """Source: "dist\default_categories.json";    DestDir: "{userdesktop}\..\.sasview";\t"""  
     210    #msg += """Source: "dist\default_categories.json";    DestDir: "{userdesktop}\..\.sasview";\t""" 
    209211    #msg += """DestName: "categories.json";\n""" 
    210212    msg += """;\tNOTE: Don't use "Flags: ignoreversion" on any shared system files""" 
     
    235237    msg = """\n\n[Run]\n""" 
    236238    msg += """Filename: "{app}\%s";\t""" % str(APPLICATION) 
    237     msg += """Description: "{cm:LaunchProgram, %s}";\t""" %str(AppName)  
     239    msg += """Description: "{cm:LaunchProgram, %s}";\t""" %str(AppName) 
    238240    msg += """Flags: nowait postinstall skipifsilent\n""" 
    239241    msg += """; Install the Microsoft C++ DLL redistributable package if it is """ 
     
    260262    msg = """\n\n[Dirs]\n""" 
    261263    msg += """Name: "{app}\%s";\t""" % str('') 
    262     msg += """Permissions: everyone-modify\t"""  
    263     msg += """\n"""   
     264    msg += """Permissions: everyone-modify\t""" 
     265    msg += """\n""" 
    264266    return msg 
    265267 
    266268def write_code(): 
    267269    """ 
    268     Code that checks the existing path and snaviewpath  
     270    Code that checks the existing path and snaviewpath 
    269271    in the environmental viriables/PATH 
    270272    """ 
    271273    msg = """\n\n[Code]\n""" 
    272     msg += """function InstallVC90CRT(): Boolean;\n"""  
     274    msg += """function InstallVC90CRT(): Boolean;\n""" 
    273275    msg += """begin\n""" 
    274276    msg += """    Result := not DirExists('C:\WINDOWS\WinSxS\\x86_Microsoft.VC90.""" 
    275277    msg += """CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375');\n""" 
    276278    msg += """end;\n\n""" 
    277     msg += """function NeedsAddPath(): boolean;\n"""  
    278     msg += """var\n"""  
     279    msg += """function NeedsAddPath(): boolean;\n""" 
     280    msg += """var\n""" 
    279281    msg += """  oldpath: string;\n""" 
    280     msg += """  newpath: string;\n"""  
    281     msg += """  pathArr:    TArrayOfString;\n"""  
    282     msg += """  i:        Integer;\n"""  
    283     msg += """begin\n"""  
     282    msg += """  newpath: string;\n""" 
     283    msg += """  pathArr:    TArrayOfString;\n""" 
     284    msg += """  i:        Integer;\n""" 
     285    msg += """begin\n""" 
    284286    msg += """  RegQueryStringValue(HKEY_CURRENT_USER,'Environment',""" 
    285287    msg += """'PATH', oldpath)\n""" 
     
    324326    msg += """; installation.\n""" 
    325327    msg += """Type: dirifempty; Name: "{app}"\n""" 
    326     msg += """\n"""   
     328    msg += """\n""" 
    327329    return msg 
    328330 
     
    333335    TEMPLATE += "\n; and local_config.py located in this directory.\n " 
    334336    TEMPLATE += "; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!" 
    335     TEMPLATE += "\n[Setup]\n\n"  
     337    TEMPLATE += "\n[Setup]\n\n" 
    336338    TEMPLATE += "ChangesAssociations=%s\n" %str('yes') 
    337339    TEMPLATE += "AppName=%s\n" % str(AppName) 
     
    352354    TEMPLATE += "PrivilegesRequired=%s\n" % str(PrivilegesRequired) 
    353355    TEMPLATE += "UsePreviousAppDir=no\n" 
    354     
     356 
    355357    TEMPLATE += write_registry(data_extension=DATA_EXTENSION, 
    356358                                app_extension=APP_EXTENSION) 
    357     TEMPLATE += write_language() 
     359    TEMPLATE += write_languages() 
    358360    TEMPLATE += write_tasks() 
    359361    TEMPLATE += write_file() 
     
    364366    TEMPLATE += write_uninstalldelete() 
    365367    path = '%s.iss' % str(INSTALLER_FILE) 
    366     f = open(path,'w')  
     368    f = open(path,'w') 
    367369    f.write(TEMPLATE) 
    368370    f.close() 
    369371    print("Generate Inno setup installer script complete") 
    370372    print("A new file %s.iss should be created.Please refresh your directory" % str(INSTALLER_FILE)) 
    371      
     373 
    372374if __name__ == "__main__": 
    373375    generate_installer() 
  • installers/setup_exe.py

    rcd57c7d4 r92df9cbd  
    33# 
    44# The setup to create a Windows executable. 
    5 # Inno Setup can then be used with the installer.iss file  
    6 # in the top source directory to create an installer.  
     5# Inno Setup can then be used with the installer.iss file 
     6# in the top source directory to create an installer. 
    77# 
    88# Setuptools clashes with py2exe 0.6.8 (and probably later too). 
    99# For that reason, most of the code needs to have direct imports 
    10 # that are not going through pkg_resources.  
     10# that are not going through pkg_resources. 
    1111# 
    1212# Attention should be paid to dynamic imports. Data files can 
     
    1717import os 
    1818import sys 
     19from glob import glob 
    1920import warnings 
    20 from glob import glob 
    2121import shutil 
    2222 
     
    2525from distutils.filelist import findall 
    2626from distutils.sysconfig import get_python_lib 
    27 import py2exe 
    2827 
    2928#from idlelib.PyShell import warning_stream 
    3029 
     30# Need the installer dir on the python path to find helper modules 
     31installer_dir = os.path.abspath(os.path.dirname(__file__)) 
     32if installer_dir != os.path.abspath(os.getcwd()): 
     33    raise RuntimeError("Must run setup_exe from the installers directory") 
     34sys.path.append(installer_dir) 
     35 
     36# Need the installer dir on the python path to find helper modules 
     37if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
     38    raise RuntimeError("Must run setup_exe from the installers directory") 
     39sys.path.append(installer_dir) 
     40 
    3141# put the build directory at the front of the path 
    32 if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
    33     raise RuntimeError("Must run setup_exe from the sasview directory") 
    3442root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    3543platform = '%s-%s'%(get_platform(), sys.version[:3]) 
    36 build_path = os.path.join(root, 'build', 'lib.'+platform) 
    37 #build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 
     44doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc') 
     45build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 
    3846sys.path.insert(0, build_path) 
    3947 
    40 import local_config 
     48from sas.sasview import local_config 
    4149from installer_generator import generate_installer 
    4250 
     
    6270        del sys.argv[path_flag_idx+1] 
    6371        sys.argv.remove('--extrapath') 
    64 except: 
     72except Exception: 
    6573    print("Error processing extra python path needed to build SasView\n  %s" % 
    6674          sys.exc_value) 
     
    149157    """%{'arch': arch} 
    150158 
    151 if is_64bits: 
    152     msvcrtdll = glob(r"C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 
    153 else: 
    154     msvcrtdll = glob(r"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 
    155 if msvcrtdll: 
    156     msvcrtdll_data_files = ("Microsoft.VC90.CRT", msvcrtdll) 
    157 else: 
    158     msvcrtdll_data_files = None 
    159  
    160  
    161159class Target: 
    162160    def __init__(self, **kw): 
     
    168166        self.name = "SasView" 
    169167 
     168data_files = [] 
     169 
     170if tinycc: 
     171    data_files += tinycc.data_files() 
     172 
     173# Include data for supporting packages 
     174import periodictable 
     175data_files += periodictable.data_files() 
     176 
    170177# 
    171178# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib 
    172179# to use the MatPlotLib. 
    173180# 
    174 path = os.getcwd() 
    175  
    176 media_dir = os.path.join(path, "media") 
    177 images_dir = os.path.join(path, "images") 
    178 test_dir = os.path.join(path, "test") 
    179 test_1d_dir = os.path.join(path, "test\\1d_data") 
    180 test_2d_dir = os.path.join(path, "test\\2d_data") 
    181 test_sesans_dir = os.path.join(path, "test\\sesans_data") 
    182 test_convertible_dir = os.path.join(path, "test\\convertible_files") 
    183 test_save_dir = os.path.join(path, "test\\save_states") 
    184 test_coord_dir = os.path.join(path, "test\\coordinate_data") 
    185 test_image_dir = os.path.join(path, "test\\image_data") 
    186 test_other_dir = os.path.join(path, "test\\other_files") 
    187  
    188 matplotlibdatadir = matplotlib.get_data_path() 
    189 matplotlibdata = findall(matplotlibdatadir) 
    190  
    191 site_loc = get_python_lib() 
    192 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    193  
    194 data_files = [] 
    195  
    196 if tinycc: 
    197     data_files += tinycc.data_files() 
    198  
    199 # Copying SLD data 
    200 import periodictable 
    201 data_files += periodictable.data_files() 
    202  
    203 import sas.sasgui.perspectives.fitting as fitting 
    204 data_files += fitting.data_files() 
    205  
    206 import sas.sasgui.perspectives.calculator as calculator 
    207 data_files += calculator.data_files() 
    208  
    209 import sas.sasgui.perspectives.invariant as invariant 
    210 data_files += invariant.data_files() 
    211  
    212 import sas.sasgui.guiframe as guiframe 
    213 data_files += guiframe.data_files() 
     181mpl_dir = matplotlib.get_data_path() 
     182for dirpath, dirnames, filenames in os.walk(mpl_dir): 
     183    target_dir = os.path.join("mpl-data", os.path.relpath(dirpath, mpl_dir)) 
     184    source_files = [os.path.join(dirpath, f) for f in filenames] 
     185    data_files.append((target_dir, source_files)) 
     186 
     187import sasmodels 
     188data_files += sasmodels.data_files() 
    214189 
    215190# precompile sas models into the sasview build path; doesn't matter too much 
     
    223198data_files.append(('compiled_models', compiled_dlls)) 
    224199 
    225 import sasmodels 
    226 data_files += sasmodels.data_files() 
    227  
    228 for f in matplotlibdata: 
    229     dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) 
    230     data_files.append((os.path.split(dirname)[0], [f])) 
    231  
    232 # Copy the settings file for the sas.dataloader file extension associations 
    233 import sas.sascalc.dataloader.readers 
    234 f = os.path.join(sas.sascalc.dataloader.readers.get_data_path()) 
    235 if os.path.isfile(f): 
    236     data_files.append(('.', [f])) 
    237 f = 'custom_config.py' 
    238 if os.path.isfile(f): 
    239     data_files.append(('.', [f])) 
    240     data_files.append(('config', [f])) 
    241 f = 'local_config.py' 
    242 if os.path.isfile(f): 
    243     data_files.append(('.', [f])) 
    244  
    245 f = 'logging.ini' 
    246 if os.path.isfile(f): 
    247     data_files.append(('.', [f])) 
    248  
    249 # numerical libraries 
     200# Data files for the different perspectives 
     201from sas.sasgui.perspectives import fitting 
     202data_files += fitting.data_files() 
     203 
     204from sas.sasgui.perspectives import calculator 
     205data_files += calculator.data_files() 
     206 
     207from sas.sasgui.perspectives import invariant 
     208data_files += invariant.data_files() 
     209 
     210from sas.sasgui import guiframe 
     211data_files += guiframe.data_files() 
     212 
     213# Copy the config files 
     214sasview_path = os.path.join('..', 'src', 'sas', 'sasview') 
     215data_files.append(('.', [os.path.join(sasview_path, 'custom_config.py')])) 
     216data_files.append(('config', [os.path.join(sasview_path, 'custom_config.py')])) 
     217data_files.append(('.', [os.path.join(sasview_path, 'local_config.py')])) 
     218 
     219# Copy the logging config 
     220sas_path = os.path.join('..', 'src', 'sas') 
     221data_files.append(('.', [os.path.join(sas_path, 'logging.ini')])) 
     222 
     223if os.path.isfile("BUILD_NUMBER"): 
     224    data_files.append(('.', ["BUILD_NUMBER"])) 
     225 
     226# Copying the images directory to the distribution directory. 
     227data_files.append(("images", findall(local_config.icon_path))) 
     228 
     229# Copying the HTML help docs 
     230data_files.append(("media", findall(local_config.media_path))) 
     231 
     232# Copying the sample data user data 
     233test_dir = local_config.test_path 
     234for dirpath, dirnames, filenames in os.walk(test_dir): 
     235    target_dir = os.path.join("test", os.path.relpath(dirpath, test_dir)) 
     236    source_files = [os.path.join(dirpath, f) for f in filenames] 
     237    data_files.append((target_dir, source_files)) 
     238 
     239# See if the documentation has been built, and if so include it. 
     240if os.path.exists(doc_path): 
     241    for dirpath, dirnames, filenames in os.walk(doc_path): 
     242        target_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
     243        source_files = [os.path.join(dirpath, f) for f in filenames] 
     244        data_files.append((target_dir, source_files)) 
     245else: 
     246    raise Exception("You must first build the documentation before creating an installer.") 
     247 
     248# Copying opencl include files 
     249opencl_source = os.path.join(get_python_lib(), "pyopencl", "cl") 
     250opencl_target = os.path.join("includes", "pyopencl") 
     251data_files.append((opencl_target, findall(opencl_source))) 
     252 
     253# Numerical libraries 
     254python_root = os.path.dirname(os.path.abspath(sys.executable)) 
    250255def dll_check(dll_path, dlls): 
    251256    dll_includes = [os.path.join(dll_path, dll+'.dll') for dll in dlls] 
    252257    return [dll for dll in dll_includes if os.path.exists(dll)] 
    253258 
    254 python_root = os.path.dirname(os.path.abspath(sys.executable)) 
    255259# Check for ATLAS 
    256 dll_path = os.path.join(python_root, 'lib', 'site-packages', 'numpy', 'core') 
    257 dlls = ['numpy-atlas'] 
    258 atlas_dlls = dll_check(dll_path, dlls) 
     260numpy_path = os.path.join(python_root, 'lib', 'site-packages', 'numpy', 'core') 
     261atlas_dlls = dll_check(numpy_path, ['numpy-atlas']) 
    259262 
    260263# Check for MKL 
    261 dll_path = os.path.join(python_root, 'Library', 'bin') 
    262 dlls = ['mkl_core', 'mkl_def', 'libiomp5md'] 
    263 mkl_dlls = dll_check(dll_path, dlls) 
     264mkl_path = os.path.join(python_root, 'Library', 'bin') 
     265mkl_dlls = dll_check(mkl_path, ['mkl_core', 'mkl_def', 'libiomp5md']) 
    264266 
    265267if atlas_dlls: 
     
    268270    data_files.append(('.', mkl_dlls)) 
    269271 
    270 if os.path.isfile("BUILD_NUMBER"): 
    271     data_files.append(('.', ["BUILD_NUMBER"])) 
    272  
    273 # Copying the images directory to the distribution directory. 
    274 for f in findall(images_dir): 
    275     data_files.append(("images", [f])) 
    276  
    277 # Copying the HTML help docs 
    278 for f in findall(media_dir): 
    279     data_files.append(("media", [f])) 
    280  
    281 # Copying the sample data user data 
    282 for f in findall(test_1d_dir): 
    283     data_files.append(("test\\1d_data", [f])) 
    284 for f in findall(test_2d_dir): 
    285     data_files.append(("test\\2d_data", [f])) 
    286 for f in findall(test_save_dir): 
    287     data_files.append(("test\\save_states", [f])) 
    288 for f in findall(test_sesans_dir): 
    289     data_files.append(("test\\sesans_data", [f])) 
    290 for f in findall(test_convertible_dir): 
    291     data_files.append(("test\\convertible_files", [f])) 
    292 for f in findall(test_coord_dir): 
    293     data_files.append(("test\\coordinate_data", [f])) 
    294 for f in findall(test_image_dir): 
    295     data_files.append(("test\\image_data", [f])) 
    296 for f in findall(test_other_dir): 
    297     data_files.append(("test\\other_files", [f])) 
    298  
    299 # Copying opencl include files 
    300 for f in findall(opencl_include_dir): 
    301     data_files.append(("includes\\pyopencl",[f])) 
    302  
    303 # See if the documentation has been built, and if so include it. 
    304 doc_path = os.path.join(build_path, "doc") 
    305 if os.path.exists(doc_path): 
    306     for dirpath, dirnames, filenames in os.walk(doc_path): 
    307         for filename in filenames: 
    308             sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    309             data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     272if is_64bits: 
     273    msvcrtdll = glob(r"C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 
    310274else: 
    311     raise Exception("You must first build the documentation before creating an installer.") 
    312  
    313 if msvcrtdll_data_files is not None: 
     275    msvcrtdll = glob(r"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 
     276if msvcrtdll: 
    314277    # install the MSVC 9 runtime dll's into the application folder 
    315     data_files.append(msvcrtdll_data_files) 
     278    data_files.append(("Microsoft.VC90.CRT", msvcrtdll)) 
    316279 
    317280# NOTE: 
     
    322285packages = [ 
    323286    'matplotlib', 'scipy', 'encodings', 'comtypes', 'h5py', 
    324     'win32com', 'xhtml2pdf', 'bumps','sasmodels', 'sas', 
     287    'win32com', 'xhtml2pdf', 'bumps', 'sasmodels', 'sas', 
    325288    ] 
    326289packages.extend([ 
     
    337300    ]) 
    338301packages.append('periodictable.core') # not found automatically 
    339 # packages.append('IPython') 
     302 
     303# For the interactive interpreter SasViewCom make sure ipython is available 
     304#packages.extend(['IPython', 'pyreadline', 'pyreadline.unicode_helper']) 
     305 
     306# individual models 
    340307includes = ['site', 'lxml._elementpath', 'lxml.etree'] 
    341308 
     
    345312# Exclude packages that are not needed but are often found on build systems 
    346313excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 
    347  
    348314 
    349315dll_excludes = [ 
     
    352318    'tcl84.dll', 'tk84.dll', 'QtGui4.dll', 'QtCore4.dll', 
    353319    # numpy 1.8 openmp bindings (still seems to use all the cores without them) 
     320    # ... but we seem to need them when building from anaconda, so don't exclude ... 
    354321    #'libiomp5md.dll', 'libifcoremd.dll', 'libmmd.dll', 'svml_dispmd.dll','libifportMD.dll', 
    355322    'numpy-atlas.dll', 
     
    365332 
    366333target_wx_client = Target( 
    367     description = 'SasView', 
    368     script = 'sasview.py', 
    369     icon_resources = [(1, os.path.join(images_dir, "ball.ico"))], 
    370     other_resources = [(24, 1, manifest)], 
    371     dest_base = "SasView" 
     334    description='SasView', 
     335    script='sasview_gui.py', 
     336    icon_resources=[(1, local_config.SetupIconFile_win)], 
     337    other_resources=[(24, 1, manifest)], 
     338    dest_base="SasView" 
    372339) 
    373340 
    374 # bundle_option = 2 
     341target_console_client = Target( 
     342    description='SasView console', 
     343    script='sasview_console.py', 
     344    icon_resources=[(1, local_config.SetupIconFile_win)], 
     345    other_resources=[(24, 1, manifest)], 
     346    dest_base="SasViewCom" 
     347) 
     348 
     349#bundle_option = 3 if is_64bits else 2 
    375350bundle_option = 3 
    376 if is_64bits: 
    377     bundle_option = 3 
    378351generate_installer() 
    379352#initialize category stuff 
     
    381354#CategoryInstaller.check_install(s) 
    382355 
     356#import pprint; pprint.pprint(data_files); sys.exit() 
     357 
     358import py2exe 
    383359setup( 
    384360    windows=[target_wx_client], 
    385     console=[], 
     361    console=[target_console_client], 
    386362    options={ 
    387363        'py2exe': { 
Note: See TracChangeset for help on using the changeset viewer.