- Timestamp:
- May 2, 2017 3:58:01 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:
- d66dbcc
- Parents:
- 74d9780 (diff), 658dd57 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
run.py
r899e084 r914ba0a 1 # -*- coding: utf-8 -*- 1 2 #!/usr/bin/env python 3 2 4 """ 3 5 Run sasview in place. This allows sasview to use the python … … 14 16 """ 15 17 18 import imp 16 19 import os 17 20 import sys 18 import imp19 21 from contextlib import contextmanager 20 from os.path import abspath, dirname, join as joinpath 22 from os.path import join as joinpath 23 from os.path import abspath, dirname 21 24 22 25 … … 34 37 sys.path.insert(0, path) 35 38 39 36 40 @contextmanager 37 41 def cd(path): … … 44 48 os.chdir(old_dir) 45 49 50 46 51 def import_package(modname, path): 47 52 """Import a package into a particular point in the python namespace""" 48 mod = imp.load_source(modname, abspath(joinpath(path, '__init__.py')))53 mod = imp.load_source(modname, abspath(joinpath(path, '__init__.py'))) 49 54 sys.modules[modname] = mod 50 55 mod.__path__ = [abspath(path)] 51 56 return mod 57 52 58 53 59 def import_dll(modname, build_path): … … 56 62 ext = sysconfig.get_config_var('SO') 57 63 # build_path comes from context 58 path = joinpath(build_path, *modname.split('.')) +ext59 # print "importing", modname, "from", path64 path = joinpath(build_path, *modname.split('.')) + ext 65 # print "importing", modname, "from", path 60 66 return imp.load_dynamic(modname, path) 67 61 68 62 69 def prepare(): … … 70 77 from distutils.util import get_platform 71 78 root = abspath(dirname(__file__)) 72 platform = '%s-%s' %(get_platform(),sys.version[:3])73 build_path = joinpath(root, 'build', 'lib.'+platform)74 75 # Notify the help menu that the Sphinx documentation is in a different 79 platform = '%s-%s' % (get_platform(), sys.version[:3]) 80 build_path = joinpath(root, 'build', 'lib.' + platform) 81 82 # Notify the help menu that the Sphinx documentation is in a different 76 83 # place than it otherwise would be. 77 84 os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") … … 82 89 #if not os.path.exists(mplconfig): os.mkdir(mplconfig) 83 90 #import matplotlib 84 # matplotlib.use('Agg')85 # print matplotlib.__file__91 # matplotlib.use('Agg') 92 # print matplotlib.__file__ 86 93 #import pylab; pylab.hold(False) 87 94 # add periodictable to the path 88 try: import periodictable 89 except: addpath(joinpath(root, '..','periodictable')) 95 try: 96 import periodictable 97 except: 98 addpath(joinpath(root, '..', 'periodictable')) 90 99 91 try: import bumps 92 except: addpath(joinpath(root, '..','bumps')) 100 try: 101 import bumps 102 except: 103 addpath(joinpath(root, '..', 'bumps')) 93 104 94 105 # select wx version … … 114 125 import sas.sascalc.pr 115 126 sas.sascalc.pr.core = import_package('sas.sascalc.pr.core', 116 joinpath(build_path, 'sas', 'sascalc', 'pr', 'core')) 127 joinpath(build_path, 'sas', 'sascalc', 'pr', 'core')) 128 129 # Compiled modules need to be pulled from the build directory. 130 # Some packages are not where they are needed, so load them explicitly. 131 import sas.sascalc.file_converter 132 sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 133 joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core')) 117 134 118 135 import sas.sascalc.calculator 119 136 sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 120 joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core'))137 joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 121 138 122 139 sys.path.append(build_path) 123 140 124 #print "\n".join(sys.path) 141 # print "\n".join(sys.path) 142 125 143 126 144 if __name__ == "__main__": 145 # Need to add absolute path before actual prepare call, 146 # so logging can be done during initialization process too 147 root = abspath(dirname(__file__)) 148 addpath(joinpath(root, 'sasview')) 149 from logger_config import SetupLogger 150 logger = SetupLogger(__name__).config_development() 151 152 logger.debug("Starting SASVIEW in debug mode.") 127 153 prepare() 128 154 from sas.sasview.sasview import run_gui 129 155 run_gui() 156 logger.debug("Ending SASVIEW in debug mode.")
Note: See TracChangeset
for help on using the changeset viewer.