Changeset 0046c6a in sasview for installers


Ignore:
Timestamp:
Aug 30, 2017 6:46:37 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:
0ccbd36
Parents:
156203a
Message:

reduce differences between setup_mac and setup_exe

Location:
installers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • installers/setup_exe.py

    r156203a r0046c6a  
    1717import os 
    1818import sys 
     19from glob import glob 
    1920import warnings 
    20 from glob import glob 
    2121import shutil 
    2222 
     
    2929#from idlelib.PyShell import warning_stream 
    3030 
     31if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
     32    raise RuntimeError("Must run setup_exe from the installers directory") 
     33 
    3134# 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") 
    3435root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    3536platform = '%s-%s'%(get_platform(), sys.version[:3]) 
     
    153154else: 
    154155    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  
     156msvcrtdll_data_files = ("Microsoft.VC90.CRT", msvcrtdll) if msvcrtdll else None 
    160157 
    161158class Target: 
     
    172169# to use the MatPlotLib. 
    173170# 
    174 path = os.getcwd() 
    175  
    176171matplotlibdatadir = matplotlib.get_data_path() 
    177172matplotlibdata = findall(matplotlibdatadir) 
    178173 
    179 DATA_FILES = [] 
     174data_files = [] 
    180175 
    181176if tinycc: 
    182     DATA_FILES += tinycc.data_files() 
    183  
    184 # Copying SLD data 
     177    data_files += tinycc.data_files() 
     178 
     179# Include data for supporting packages 
    185180import periodictable 
    186 DATA_FILES += periodictable.data_files() 
    187  
    188 from sas.sasgui.perspectives import fitting 
    189 DATA_FILES += fitting.data_files() 
    190  
    191 from sas.sasgui.perspectives import calculator 
    192 DATA_FILES += calculator.data_files() 
    193  
    194 from sas.sasgui.perspectives import invariant 
    195 DATA_FILES += invariant.data_files() 
    196  
    197 from sas.sasgui import guiframe 
    198 DATA_FILES += guiframe.data_files() 
     181data_files += periodictable.data_files() 
     182 
     183for f in matplotlibdata: 
     184    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) 
     185    data_files.append((os.path.split(dirname)[0], [f])) 
     186 
     187import sasmodels 
     188data_files += sasmodels.data_files() 
    199189 
    200190# precompile sas models into the sasview build path; doesn't matter too much 
     
    206196# include the compiled models as data; coordinate the target path for the 
    207197# data with installer_generator.py 
    208 DATA_FILES.append(('compiled_models', compiled_dlls)) 
    209  
    210 import sasmodels 
    211 DATA_FILES += sasmodels.data_files() 
    212  
    213 for f in matplotlibdata: 
    214     dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) 
    215     DATA_FILES.append((os.path.split(dirname)[0], [f])) 
    216  
    217 # Copy the settings file for the sas.dataloader file extension associations 
    218 from sas.sascalc.dataloader import readers 
    219 reader_config = os.path.join(readers.get_data_path(), 'defaults.json') 
    220 if os.path.isfile(reader_config): 
    221     DATA_FILES.append(('.', [reader_config])) 
     198data_files.append(('compiled_models', compiled_dlls)) 
     199 
     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() 
    222212 
    223213# 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 
    224220sas_path = os.path.join('..', 'src', 'sas') 
    225 DATA_FILES.append(('.', [os.path.join(sas_path, 'logging.ini')])) 
    226 sasview_path = os.path.join(sas_path, 'sasview') 
    227 config_files = [ 
    228     'custom_config.py', 
    229     'local_config.py', 
    230     ] 
    231 DATA_FILES.append(('.', [os.path.join(sasview_path, v) for v in config_files])) 
    232 DATA_FILES.append(('config', [os.path.join(sasview_path, 'custom_config.py')])) 
     221data_files.append(('.', [os.path.join(sas_path, 'logging.ini')])) 
    233222 
    234223if os.path.isfile("BUILD_NUMBER"): 
    235     DATA_FILES.append(('.', ["BUILD_NUMBER"])) 
    236  
     224    data_files.append(('.', ["BUILD_NUMBER"])) 
     225 
     226# Copying the images directory to the distribution directory. 
    237227images_dir = local_config.icon_path 
     228for f in findall(images_dir): 
     229    data_files.append(("images", [f])) 
     230 
     231# Copying the HTML help docs 
    238232media_dir = local_config.media_path 
     233for f in findall(media_dir): 
     234    data_files.append(("media", [f])) 
     235 
     236# Copying the sample data user data 
    239237test_dir = local_config.test_path 
    240 test_1d_dir = os.path.join(test_dir, "1d_data") 
    241 test_2d_dir = os.path.join(test_dir, "2d_data") 
    242 test_save_dir = os.path.join(test_dir, "save_states") 
    243 test_upcoming_dir = os.path.join(test_dir, "upcoming_formats") 
    244  
    245 # Copying the images directory to the distribution directory. 
    246 for f in findall(images_dir): 
    247     DATA_FILES.append(("images", [f])) 
    248  
    249 # Copying the HTML help docs 
    250 for f in findall(media_dir): 
    251     DATA_FILES.append(("media", [f])) 
    252  
    253 # Copying the sample data user data 
    254 for f in findall(test_1d_dir): 
    255     DATA_FILES.append((os.path.join("test", "1d_data"), [f])) 
    256  
    257 # Copying the sample data user data 
    258 for f in findall(test_2d_dir): 
    259     DATA_FILES.append((os.path.join("test", "2d_data"), [f])) 
    260  
    261 # Copying the sample data user data 
    262 for f in findall(test_save_dir): 
    263     DATA_FILES.append((os.path.join("test", "save_states"), [f])) 
    264  
    265 # Copying the sample data user data 
    266 for f in findall(test_upcoming_dir): 
    267     DATA_FILES.append((os.path.join("test", "upcoming_formats"), [f])) 
     238for f in findall(os.path.join(test_dir, "1d_data")): 
     239    data_files.append((os.path.join("test", "1d_data"), [f])) 
     240for f in findall(os.path.join(test_dir, "2d_data")): 
     241    data_files.append((os.path.join("test", "2d_data"), [f])) 
     242for f in findall(os.path.join(test_dir, "save_states")): 
     243    data_files.append((os.path.join("test", "save_states"), [f])) 
     244for f in findall(os.path.join(test_dir, "upcoming_formats")): 
     245    data_files.append((os.path.join("test", "upcoming_formats"), [f])) 
     246 
     247# See if the documentation has been built, and if so include it. 
     248if os.path.exists(doc_path): 
     249    for dirpath, dirnames, filenames in os.walk(doc_path): 
     250        for filename in filenames: 
     251            sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
     252            data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     253else: 
     254    raise Exception("You must first build the documentation before creating an installer.") 
    268255 
    269256# Copying opencl include files 
     
    271258opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    272259for f in findall(opencl_include_dir): 
    273     DATA_FILES.append((os.path.join("includes", "pyopencl"), [f])) 
     260    data_files.append((os.path.join("includes", "pyopencl"), [f])) 
    274261 
    275262# Numerical libraries 
     
    288275 
    289276if atlas_dlls: 
    290     DATA_FILES.append(('.', atlas_dlls)) 
     277    data_files.append(('.', atlas_dlls)) 
    291278elif mkl_dlls: 
    292     DATA_FILES.append(('.', mkl_dlls)) 
    293  
    294 # See if the documentation has been built, and if so include it. 
    295 if os.path.exists(doc_path): 
    296     for dirpath, dirnames, filenames in os.walk(doc_path): 
    297         for filename in filenames: 
    298             sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    299             DATA_FILES.append((sub_dir, [os.path.join(dirpath, filename)])) 
    300 else: 
    301     raise Exception("You must first build the documentation before creating an installer.") 
     279    data_files.append(('.', mkl_dlls)) 
    302280 
    303281if msvcrtdll_data_files is not None: 
    304282    # install the MSVC 9 runtime dll's into the application folder 
    305     DATA_FILES.append(msvcrtdll_data_files) 
     283    data_files.append(msvcrtdll_data_files) 
    306284 
    307285# NOTE: 
     
    328306packages.append('periodictable.core') # not found automatically 
    329307 
    330 # For an interactive interpreter, SasViewCom 
     308# For the interactive interpreter SasViewCom make sure ipython is available 
    331309packages.extend(['IPython', 'pyreadline', 'pyreadline.unicode_helper']) 
    332310 
     
    338316 
    339317# Exclude packages that are not needed but are often found on build systems 
    340 excludes = [ 
    341     'Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy', 
     318excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 
     319 
     320dll_excludes = [ 
    342321    # Various matplotlib backends we are not using 
    343322    'libgdk_pixbuf-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk-win32-2.0-0.dll', 
     
    393372            }, 
    394373    }, 
    395     data_files=DATA_FILES, 
     374    data_files=data_files, 
    396375) 
  • installers/setup_mac.py

    r156203a r0046c6a  
    1515 
    1616import os 
     17import sys 
    1718import string 
    18 import sys 
    1919 
    2020from distutils.util import get_platform 
     
    2626import macholib_patch 
    2727 
     28if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
     29    raise RuntimeError("Must run setup_exe from the installers directory") 
     30 
     31# put the build directory at the front of the path 
    2832root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    2933platform = '%s-%s'%(get_platform(), sys.version[:3]) 
    3034doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc') 
    31 env = os.path.join(root, 'sasview-install', 'lib', 'python2.7', 'site-packages') 
    32 #sys.path.insert(0, env) 
     35build_path = os.path.join(root, 'sasview-install', 'lib', 'python2.7', 'site-packages') 
     36#sys.path.insert(0, build_path) 
     37print("build path", build_path) 
    3338 
    3439#Extending recursion limit 
    3540sys.setrecursionlimit(10000) 
    3641 
    37 print("BUILDING PATH INSIDE", env) 
    38  
    3942from sas.sasview import local_config 
    4043 
    4144ICON = local_config.SetupIconFile_mac 
    42 RESOURCES_FILES = [] 
    43 DATA_FILES = [] 
    44  
    45 #Periodictable data file 
     45data_files = [] 
     46 
     47# Include data for supporting packages 
    4648import periodictable 
    47 DATA_FILES += periodictable.data_files() 
    48 #invariant and calculator help doc 
     49data_files += periodictable.data_files() 
     50 
     51import sasmodels 
     52data_files += sasmodels.data_files() 
     53 
     54# Data files for the different perspectives 
    4955from sas.sasgui.perspectives import fitting 
    50 DATA_FILES += fitting.data_files() 
     56data_files += fitting.data_files() 
     57 
    5158from sas.sasgui.perspectives import calculator 
    52 DATA_FILES += calculator.data_files() 
     59data_files += calculator.data_files() 
     60 
    5361from sas.sasgui.perspectives import invariant 
    54 DATA_FILES += invariant.data_files() 
    55 import sasmodels 
    56 DATA_FILES += sasmodels.data_files() 
     62data_files += invariant.data_files() 
     63 
    5764from sas.sasgui import guiframe 
    58 DATA_FILES += guiframe.data_files() 
    59  
    60 #CANSAxml reader data files 
    61 from sas.sascalc.dataloader import readers 
    62 RESOURCES_FILES.append(os.path.join(readers.get_data_path(), 'defaults.json')) 
     65data_files += guiframe.data_files() 
    6366 
    6467# Copy the config files 
     68sasview_path = os.path.join(sas_path, 'sasview') 
     69data_files.append(('.', [os.path.join(sasview_path, 'custom_config.py')])) 
     70data_files.append(('config', [os.path.join(sasview_path, 'custom_config.py')])) 
     71data_files.append(('.', [os.path.join(sasview_path, 'local_config.py')])) 
     72 
     73# Copy the logging config 
    6574sas_path = os.path.join('..', 'src', 'sas') 
    66 DATA_FILES.append(('.', [os.path.join(sas_path, 'logging.ini')])) 
    67 sasview_path = os.path.join(sas_path, 'sasview') 
    68 custom_config_file = os.path.join(sasview_path, 'custom_config.py') 
    69 local_config_file = os.path.join(sasview_path, 'local_config.py') 
    70 logging_ini = os.path.join(sas_path, 'logging.ini') 
    71 DATA_FILES.append(('.', [custom_config_file])) 
    72 DATA_FILES.append(('config', [custom_config_file])) 
    73 DATA_FILES.append(('.', [local_config_file])) 
    74 DATA_FILES.append(('.', [logging_ini])) 
     75data_files.append(('.', [os.path.join(sas_path, 'logging.ini')])) 
    7576 
    7677if os.path.isfile("BUILD_NUMBER"): 
    77     DATA_FILES.append(('.', ["BUILD_NUMBER"])) 
    78  
     78    data_files.append(('.', ["BUILD_NUMBER"])) 
     79 
     80# Copying the images directory to the distribution directory. 
    7981images_dir = local_config.icon_path 
     82for f in findall(images_dir): 
     83    data_files.append(("images", [f])) 
     84 
     85# Copying the HTML help docs 
    8086media_dir = local_config.media_path 
     87for f in findall(media_dir): 
     88    data_files.append(("media", [f])) 
     89 
     90# Copying the sample data user data 
    8191test_dir = local_config.test_path 
    82 test_1d_dir = os.path.join(test_dir, "1d_data") 
    83 test_2d_dir = os.path.join(test_dir, "2d_data") 
    84 test_save_dir = os.path.join(test_dir, "save_states") 
    85 test_upcoming_dir = os.path.join(test_dir, "upcoming_formats") 
    86  
    87 # Copying the images directory to the distribution directory. 
    88 for f in findall(images_dir): 
    89     DATA_FILES.append(("images", [f])) 
    90  
    91 # Copying the HTML help docs 
    92 for f in findall(media_dir): 
    93     DATA_FILES.append(("media", [f])) 
    94  
    95 # Copying the sample data user data 
    96 for f in findall(test_1d_dir): 
    97     DATA_FILES.append((os.path.join("test", "1d_data"), [f])) 
    98  
    99 # Copying the sample data user data 
    100 for f in findall(test_2d_dir): 
    101     DATA_FILES.append((os.path.join("test", "2d_data"), [f])) 
    102  
    103 # Copying the sample data user data 
    104 for f in findall(test_save_dir): 
    105     DATA_FILES.append((os.path.join("test", "save_states"), [f])) 
    106  
    107 # Copying the sample data user data 
    108 for f in findall(test_upcoming_dir): 
    109     DATA_FILES.append((os.path.join("test", "upcoming_formats"), [f])) 
     92for f in findall(os.path.join(test_dir, "1d_data")): 
     93    data_files.append((os.path.join("test", "1d_data"), [f])) 
     94for f in findall(os.path.join(test_dir, "2d_data")): 
     95    data_files.append((os.path.join("test", "2d_data"), [f])) 
     96for f in findall(os.path.join(test_dir, "save_states")): 
     97    data_files.append((os.path.join("test", "save_states"), [f])) 
     98for f in findall(os.path.join(test_dir, "upcoming_formats")): 
     99    data_files.append((os.path.join("test", "upcoming_formats"), [f])) 
     100 
     101# See if the documentation has been built, and if so include it. 
     102if os.path.exists(doc_path): 
     103    for dirpath, dirnames, filenames in os.walk(doc_path): 
     104        for filename in filenames: 
     105            sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
     106            data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     107else: 
     108    raise Exception("You must first build the documentation before creating an installer.") 
    110109 
    111110# Copying opencl include files 
     
    113112opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    114113for f in findall(opencl_include_dir): 
    115     DATA_FILES.append((os.path.join("includes", "pyopencl"), [f])) 
    116  
    117 # See if the documentation has been built, and if so include it. 
    118 print(doc_path) 
    119 if os.path.exists(doc_path): 
    120     for dirpath, dirnames, filenames in os.walk(doc_path): 
    121         for filename in filenames: 
    122             sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    123             DATA_FILES.append((sub_dir, [os.path.join(dirpath, filename)])) 
    124 else: 
    125     raise Exception("You must first build the documentation before creating an installer.") 
     114    data_files.append((os.path.join("includes", "pyopencl"), [f])) 
     115 
     116# Locate libxml2 library 
     117lib_locs = ['/usr/local/lib', '/usr/lib'] 
     118libxml_path = None 
     119for item in lib_locs: 
     120    libxml_path_test = '%s/libxml2.2.dylib' % item 
     121    if os.path.isfile(libxml_path_test): 
     122        libxml_path = libxml_path_test 
     123if libxml_path is None: 
     124    raise RuntimeError("Could not find libxml2 on the system") 
    126125 
    127126# locate file extensions 
     
    160159EXTENSIONS_LIST = find_extension() 
    161160 
    162  
    163161plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST, 
    164162                                         CFBundleTypeIconFile=ICON, 
    165163                                         CFBundleTypeName="sasview file", 
    166164                                         CFBundleTypeRole="Shell")],) 
    167  
    168 # Locate libxml2 library 
    169 lib_locs = ['/usr/local/lib', '/usr/lib'] 
    170 libxml_path = None 
    171 for item in lib_locs: 
    172     libxml_path_test = '%s/libxml2.2.dylib' % item 
    173     if os.path.isfile(libxml_path_test): 
    174         libxml_path = libxml_path_test 
    175 if libxml_path is None: 
    176     raise RuntimeError, "Could not find libxml2 on the system" 
    177165 
    178166#Get version - NB nasty hack. Need to find correct way to give path to installed sasview (AJJ) 
     
    194182           'iconfile': ICON, 
    195183           'frameworks': [libxml_path], 
    196            'resources': RESOURCES_FILES, 
     184           'resources': [], 
    197185           'plist': plist, 
    198186           'excludes' : EXCLUDES, 
     
    201189    name=APPNAME, 
    202190    app=APP, 
    203     data_files=DATA_FILES, 
     191    data_files=data_files, 
    204192    include_package_data=True, 
    205193    options={'py2app': OPTIONS}, 
Note: See TracChangeset for help on using the changeset viewer.