Changeset 0046c6a in sasview for installers/setup_mac.py
- Timestamp:
- Aug 30, 2017 6:46:37 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:
- 0ccbd36
- Parents:
- 156203a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
installers/setup_mac.py
r156203a r0046c6a 15 15 16 16 import os 17 import sys 17 18 import string 18 import sys19 19 20 20 from distutils.util import get_platform … … 26 26 import macholib_patch 27 27 28 if 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 28 32 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 29 33 platform = '%s-%s'%(get_platform(), sys.version[:3]) 30 34 doc_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) 35 build_path = os.path.join(root, 'sasview-install', 'lib', 'python2.7', 'site-packages') 36 #sys.path.insert(0, build_path) 37 print("build path", build_path) 33 38 34 39 #Extending recursion limit 35 40 sys.setrecursionlimit(10000) 36 41 37 print("BUILDING PATH INSIDE", env)38 39 42 from sas.sasview import local_config 40 43 41 44 ICON = local_config.SetupIconFile_mac 42 RESOURCES_FILES = [] 43 DATA_FILES = [] 44 45 #Periodictable data file 45 data_files = [] 46 47 # Include data for supporting packages 46 48 import periodictable 47 DATA_FILES += periodictable.data_files() 48 #invariant and calculator help doc 49 data_files += periodictable.data_files() 50 51 import sasmodels 52 data_files += sasmodels.data_files() 53 54 # Data files for the different perspectives 49 55 from sas.sasgui.perspectives import fitting 50 DATA_FILES += fitting.data_files() 56 data_files += fitting.data_files() 57 51 58 from sas.sasgui.perspectives import calculator 52 DATA_FILES += calculator.data_files() 59 data_files += calculator.data_files() 60 53 61 from sas.sasgui.perspectives import invariant 54 DATA_FILES += invariant.data_files() 55 import sasmodels 56 DATA_FILES += sasmodels.data_files() 62 data_files += invariant.data_files() 63 57 64 from 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')) 65 data_files += guiframe.data_files() 63 66 64 67 # Copy the config files 68 sasview_path = os.path.join(sas_path, 'sasview') 69 data_files.append(('.', [os.path.join(sasview_path, 'custom_config.py')])) 70 data_files.append(('config', [os.path.join(sasview_path, 'custom_config.py')])) 71 data_files.append(('.', [os.path.join(sasview_path, 'local_config.py')])) 72 73 # Copy the logging config 65 74 sas_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])) 75 data_files.append(('.', [os.path.join(sas_path, 'logging.ini')])) 75 76 76 77 if 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. 79 81 images_dir = local_config.icon_path 82 for f in findall(images_dir): 83 data_files.append(("images", [f])) 84 85 # Copying the HTML help docs 80 86 media_dir = local_config.media_path 87 for f in findall(media_dir): 88 data_files.append(("media", [f])) 89 90 # Copying the sample data user data 81 91 test_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])) 92 for f in findall(os.path.join(test_dir, "1d_data")): 93 data_files.append((os.path.join("test", "1d_data"), [f])) 94 for f in findall(os.path.join(test_dir, "2d_data")): 95 data_files.append((os.path.join("test", "2d_data"), [f])) 96 for f in findall(os.path.join(test_dir, "save_states")): 97 data_files.append((os.path.join("test", "save_states"), [f])) 98 for 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. 102 if 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)])) 107 else: 108 raise Exception("You must first build the documentation before creating an installer.") 110 109 111 110 # Copying opencl include files … … 113 112 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 114 113 for 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 117 lib_locs = ['/usr/local/lib', '/usr/lib'] 118 libxml_path = None 119 for 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 123 if libxml_path is None: 124 raise RuntimeError("Could not find libxml2 on the system") 126 125 127 126 # locate file extensions … … 160 159 EXTENSIONS_LIST = find_extension() 161 160 162 163 161 plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST, 164 162 CFBundleTypeIconFile=ICON, 165 163 CFBundleTypeName="sasview file", 166 164 CFBundleTypeRole="Shell")],) 167 168 # Locate libxml2 library169 lib_locs = ['/usr/local/lib', '/usr/lib']170 libxml_path = None171 for item in lib_locs:172 libxml_path_test = '%s/libxml2.2.dylib' % item173 if os.path.isfile(libxml_path_test):174 libxml_path = libxml_path_test175 if libxml_path is None:176 raise RuntimeError, "Could not find libxml2 on the system"177 165 178 166 #Get version - NB nasty hack. Need to find correct way to give path to installed sasview (AJJ) … … 194 182 'iconfile': ICON, 195 183 'frameworks': [libxml_path], 196 'resources': RESOURCES_FILES,184 'resources': [], 197 185 'plist': plist, 198 186 'excludes' : EXCLUDES, … … 201 189 name=APPNAME, 202 190 app=APP, 203 data_files= DATA_FILES,191 data_files=data_files, 204 192 include_package_data=True, 205 193 options={'py2app': OPTIONS},
Note: See TracChangeset
for help on using the changeset viewer.