Changeset 0046c6a in sasview for installers/setup_exe.py
- 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
- File:
-
- 1 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 )
Note: See TracChangeset
for help on using the changeset viewer.