Changeset 80c2c85 in sasview for sasview/setup_exe.py


Ignore:
Timestamp:
Jun 28, 2016 3:10:33 PM (8 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:
3aa2f3c
Parents:
899e084 (diff), 5552396 (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 sasview-cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasview/setup_exe.py

    r5552396 r899e084  
    3333root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    3434platform = '%s-%s'%(get_platform(), sys.version[:3]) 
    35 build_path = os.path.join(root, 'build', 'lib.'+platform) 
    36 #build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 
     35build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 
    3736sys.path.insert(0, build_path) 
    38  
    39 import local_config 
     37doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc') 
     38 
     39from sas.sasview import local_config 
    4040from installer_generator import generate_installer 
    4141 
     
    174174path = os.getcwd() 
    175175 
    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_save_dir = os.path.join(path, "test\\save_states") 
    182 test_upcoming_dir = os.path.join(path, "test\\upcoming_formats") 
    183  
    184176matplotlibdatadir = matplotlib.get_data_path() 
    185177matplotlibdata = findall(matplotlibdatadir) 
     
    188180opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    189181 
    190 data_files = [] 
     182DATA_FILES = [] 
    191183 
    192184if tinycc: 
    193     data_files += tinycc.data_files() 
     185    DATA_FILES += tinycc.data_files() 
    194186 
    195187# Copying SLD data 
    196188import periodictable 
    197 data_files += periodictable.data_files() 
    198  
    199 import sas.sasgui.perspectives.fitting as fitting 
    200 data_files += fitting.data_files() 
    201  
    202 import sas.sasgui.perspectives.calculator as calculator 
    203 data_files += calculator.data_files() 
    204  
    205 import sas.sasgui.perspectives.invariant as invariant 
    206 data_files += invariant.data_files() 
    207  
    208 import sas.sasgui.guiframe as guiframe 
    209 data_files += guiframe.data_files() 
     189DATA_FILES += periodictable.data_files() 
     190 
     191from sas.sasgui.perspectives import fitting 
     192DATA_FILES += fitting.data_files() 
     193 
     194from sas.sasgui.perspectives import calculator 
     195DATA_FILES += calculator.data_files() 
     196 
     197from sas.sasgui.perspectives import invariant 
     198DATA_FILES += invariant.data_files() 
     199 
     200from sas.sasgui import guiframe 
     201DATA_FILES += guiframe.data_files() 
    210202 
    211203# precompile sas models into the sasview build path; doesn't matter too much 
     
    217209# include the compiled models as data; coordinate the target path for the 
    218210# data with installer_generator.py 
    219 data_files.append(('compiled_models', compiled_dlls)) 
     211DATA_FILES.append(('compiled_models', compiled_dlls)) 
    220212 
    221213import sasmodels 
    222 data_files += sasmodels.data_files() 
     214DATA_FILES += sasmodels.data_files() 
    223215 
    224216for f in matplotlibdata: 
    225217    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) 
    226     data_files.append((os.path.split(dirname)[0], [f])) 
     218    DATA_FILES.append((os.path.split(dirname)[0], [f])) 
    227219 
    228220# Copy the settings file for the sas.dataloader file extension associations 
    229 import sas.sascalc.dataloader.readers 
    230 f = os.path.join(sas.sascalc.dataloader.readers.get_data_path(), 'defaults.json') 
    231 if os.path.isfile(f): 
    232     data_files.append(('.', [f])) 
    233 f = 'custom_config.py' 
    234 if os.path.isfile(f): 
    235     data_files.append(('.', [f])) 
    236     data_files.append(('config', [f])) 
    237 f = 'local_config.py' 
    238 if os.path.isfile(f): 
    239     data_files.append(('.', [f])) 
    240  
    241 f = 'default_categories.json' 
    242 if os.path.isfile(f): 
    243     data_files.append(('.', [f])) 
     221from sas.sascalc.dataloader import readers 
     222reader_config = os.path.join(readers.get_data_path(), 'defaults.json') 
     223if os.path.isfile(reader_config): 
     224    DATA_FILES.append(('.', [reader_config])) 
     225 
     226# Copy the config files 
     227sasview_path = os.path.join('..','src','sas','sasview') 
     228custom_config_file = os.path.join(sasview_path, 'custom_config.py') 
     229local_config_file = os.path.join(sasview_path, 'local_config.py') 
     230DATA_FILES.append(('.', [custom_config_file])) 
     231DATA_FILES.append(('config', [custom_config_file])) 
     232DATA_FILES.append(('.', [local_config_file])) 
     233 
     234# default_categories.json is beside the config files 
     235category_config = os.path.join(os.path.dirname(local_config_file), 
     236                               'default_categories.json') 
     237if os.path.isfile(category_config): 
     238    DATA_FILES.append(('.', [category_config])) 
    244239     
    245240if os.path.isfile("BUILD_NUMBER"): 
    246     data_files.append(('.', ["BUILD_NUMBER"])) 
     241    DATA_FILES.append(('.', ["BUILD_NUMBER"])) 
     242 
     243images_dir = local_config.icon_path 
     244media_dir = local_config.media_path 
     245images_dir = local_config.icon_path 
     246test_dir = local_config.test_path 
     247test_1d_dir = os.path.join(test_dir, "1d_data") 
     248test_2d_dir = os.path.join(test_dir, "2d_data") 
     249test_save_dir = os.path.join(test_dir, "save_states") 
     250test_upcoming_dir = os.path.join(test_dir, "upcoming_formats") 
    247251 
    248252# Copying the images directory to the distribution directory. 
    249253for f in findall(images_dir): 
    250     if not ".svn" in f: 
    251         data_files.append(("images", [f])) 
     254    DATA_FILES.append(("images", [f])) 
    252255 
    253256# Copying the HTML help docs 
    254257for f in findall(media_dir): 
    255     if not ".svn" in f: 
    256         data_files.append(("media", [f])) 
     258    DATA_FILES.append(("media", [f])) 
    257259 
    258260# Copying the sample data user data 
    259261for f in findall(test_1d_dir): 
    260     if not ".svn" in f: 
    261         data_files.append(("test\\1d_data", [f])) 
     262    DATA_FILES.append(("test\\1d_data", [f])) 
    262263 
    263264# Copying the sample data user data 
    264265for f in findall(test_2d_dir): 
    265     if not ".svn" in f: 
    266         data_files.append(("test\\2d_data", [f])) 
     266    DATA_FILES.append(("test\\2d_data", [f])) 
    267267 
    268268# Copying the sample data user data 
    269269for f in findall(test_save_dir): 
    270     if not ".svn" in f: 
    271         data_files.append(("test\\save_states", [f])) 
     270    DATA_FILES.append(("test\\save_states", [f])) 
    272271 
    273272# Copying the sample data user data 
    274273for f in findall(test_upcoming_dir): 
    275     if not ".svn" in f: 
    276         data_files.append(("test\\upcoming_formats", [f])) 
     274    DATA_FILES.append(("test\\upcoming_formats", [f])) 
    277275 
    278276# Copying opencl include files 
    279277for f in findall(opencl_include_dir): 
    280     data_files.append(("includes\\pyopencl",[f])) 
     278    DATA_FILES.append(("includes\\pyopencl", [f])) 
    281279 
    282280# See if the documentation has been built, and if so include it. 
    283 doc_path = os.path.join(build_path, "doc") 
    284281if os.path.exists(doc_path): 
    285282    for dirpath, dirnames, filenames in os.walk(doc_path): 
    286283        for filename in filenames: 
    287284            sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    288             data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     285            DATA_FILES.append((sub_dir, [os.path.join(dirpath, filename)])) 
    289286else: 
    290287    raise Exception("You must first build the documentation before creating an installer.") 
     
    292289if msvcrtdll_data_files is not None: 
    293290    # install the MSVC 9 runtime dll's into the application folder 
    294     data_files.append(msvcrtdll_data_files) 
     291    DATA_FILES.append(msvcrtdll_data_files) 
    295292 
    296293# NOTE: 
     
    316313    ]) 
    317314packages.append('periodictable.core') # not found automatically 
    318 #packages.append('IPython') 
     315# For an interactive interpreter, SasViewCom 
     316packages.extend(['IPython','pyreadline','pyreadline.unicode_helper']) 
     317 
     318# individual models 
    319319includes = ['site', 'lxml._elementpath', 'lxml.etree'] 
    320320 
     
    331331    'tcl84.dll', 'tk84.dll', 'QtGui4.dll', 'QtCore4.dll', 
    332332    # numpy 1.8 openmp bindings (still seems to use all the cores without them) 
     333    # ... but we seem to need them when building from anaconda, so don't exclude ... 
    333334    #'libiomp5md.dll', 'libifcoremd.dll', 'libmmd.dll', 'svml_dispmd.dll','libifportMD.dll', 
    334335    # microsoft C runtime (not allowed to ship with the app; need to ship vcredist 
     
    342343    ] 
    343344 
     345# extra dlls not found automatically 
     346python_root = os.path.dirname(os.path.abspath(sys.executable)) 
     347dll_path = os.path.join(python_root, 'Library', 'bin') 
     348# the following are found already: 'mkl_intel_thread', 'libmmd', 'libifcoremd' 
     349dll_includes = ['mkl_core', 'mkl_def', 'libiomp5md'] 
     350dll_includes = [os.path.join(dll_path, dll+'.dll') for dll in dll_includes] 
     351dll_includes = [dll for dll in dll_includes if os.path.exists(dll)] 
     352if dll_includes: 
     353   DATA_FILES.append(('.', dll_includes)) 
     354 
    344355target_wx_client = Target( 
    345356    description = 'SasView', 
    346     script = 'sasview.py', 
    347     icon_resources = [(1, os.path.join(images_dir, "ball.ico"))], 
     357    script = 'sasview_gui.py', 
     358    icon_resources = [(1, local_config.SetupIconFile_win)], 
    348359    other_resources = [(24, 1, manifest)], 
    349360    dest_base = "SasView" 
    350361    ) 
     362 
     363target_console_client = Target( 
     364    description = 'SasView console', 
     365    script = 'sasview_console.py', 
     366    icon_resources = [(1, local_config.SetupIconFile_win)], 
     367    other_resources = [(24, 1, manifest)], 
     368    dest_base = "SasViewCom" 
     369) 
    351370 
    352371bundle_option = 2 
     
    360379setup( 
    361380    windows=[target_wx_client], 
    362     console=[], 
     381    console=[target_console_client], 
    363382    options={ 
    364383        'py2exe': { 
     
    372391            }, 
    373392    }, 
    374     data_files=data_files, 
     393    data_files=DATA_FILES, 
    375394) 
Note: See TracChangeset for help on using the changeset viewer.