Changeset 0046c6a in sasview for installers
- Timestamp:
- Aug 30, 2017 4: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
- Location:
- installers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
installers/setup_exe.py
r156203a r0046c6a 17 17 import os 18 18 import sys 19 from glob import glob 19 20 import warnings 20 from glob import glob21 21 import shutil 22 22 … … 29 29 #from idlelib.PyShell import warning_stream 30 30 31 if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 32 raise RuntimeError("Must run setup_exe from the installers directory") 33 31 34 # 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")34 35 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 35 36 platform = '%s-%s'%(get_platform(), sys.version[:3]) … … 153 154 else: 154 155 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 156 msvcrtdll_data_files = ("Microsoft.VC90.CRT", msvcrtdll) if msvcrtdll else None 160 157 161 158 class Target: … … 172 169 # to use the MatPlotLib. 173 170 # 174 path = os.getcwd()175 176 171 matplotlibdatadir = matplotlib.get_data_path() 177 172 matplotlibdata = findall(matplotlibdatadir) 178 173 179 DATA_FILES= []174 data_files = [] 180 175 181 176 if tinycc: 182 DATA_FILES+= tinycc.data_files()183 184 # Copying SLD data177 data_files += tinycc.data_files() 178 179 # Include data for supporting packages 185 180 import 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() 181 data_files += periodictable.data_files() 182 183 for 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 187 import sasmodels 188 data_files += sasmodels.data_files() 199 189 200 190 # precompile sas models into the sasview build path; doesn't matter too much … … 206 196 # include the compiled models as data; coordinate the target path for the 207 197 # data with installer_generator.py 208 DATA_FILES.append(('compiled_models', compiled_dlls))209 210 import sasmodels211 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]))198 data_files.append(('compiled_models', compiled_dlls)) 199 200 # Data files for the different perspectives 201 from sas.sasgui.perspectives import fitting 202 data_files += fitting.data_files() 203 204 from sas.sasgui.perspectives import calculator 205 data_files += calculator.data_files() 206 207 from sas.sasgui.perspectives import invariant 208 data_files += invariant.data_files() 209 210 from sas.sasgui import guiframe 211 data_files += guiframe.data_files() 222 212 223 213 # Copy the config files 214 sasview_path = os.path.join('..', 'src', 'sas', 'sasview') 215 data_files.append(('.', [os.path.join(sasview_path, 'custom_config.py')])) 216 data_files.append(('config', [os.path.join(sasview_path, 'custom_config.py')])) 217 data_files.append(('.', [os.path.join(sasview_path, 'local_config.py')])) 218 219 # Copy the logging config 224 220 sas_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')])) 221 data_files.append(('.', [os.path.join(sas_path, 'logging.ini')])) 233 222 234 223 if 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. 237 227 images_dir = local_config.icon_path 228 for f in findall(images_dir): 229 data_files.append(("images", [f])) 230 231 # Copying the HTML help docs 238 232 media_dir = local_config.media_path 233 for f in findall(media_dir): 234 data_files.append(("media", [f])) 235 236 # Copying the sample data user data 239 237 test_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])) 238 for f in findall(os.path.join(test_dir, "1d_data")): 239 data_files.append((os.path.join("test", "1d_data"), [f])) 240 for f in findall(os.path.join(test_dir, "2d_data")): 241 data_files.append((os.path.join("test", "2d_data"), [f])) 242 for f in findall(os.path.join(test_dir, "save_states")): 243 data_files.append((os.path.join("test", "save_states"), [f])) 244 for 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. 248 if 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)])) 253 else: 254 raise Exception("You must first build the documentation before creating an installer.") 268 255 269 256 # Copying opencl include files … … 271 258 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 272 259 for 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])) 274 261 275 262 # Numerical libraries … … 288 275 289 276 if atlas_dlls: 290 DATA_FILES.append(('.', atlas_dlls))277 data_files.append(('.', atlas_dlls)) 291 278 elif 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)) 302 280 303 281 if msvcrtdll_data_files is not None: 304 282 # 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) 306 284 307 285 # NOTE: … … 328 306 packages.append('periodictable.core') # not found automatically 329 307 330 # For an interactive interpreter, SasViewCom308 # For the interactive interpreter SasViewCom make sure ipython is available 331 309 packages.extend(['IPython', 'pyreadline', 'pyreadline.unicode_helper']) 332 310 … … 338 316 339 317 # Exclude packages that are not needed but are often found on build systems 340 excludes = [ 341 'Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy', 318 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 319 320 dll_excludes = [ 342 321 # Various matplotlib backends we are not using 343 322 'libgdk_pixbuf-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk-win32-2.0-0.dll', … … 393 372 }, 394 373 }, 395 data_files= DATA_FILES,374 data_files=data_files, 396 375 ) -
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.