ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change
on this file since 7d077d1 was
ded2ce3,
checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago
|
missing module importer added
|
-
Property mode set to
100755
|
File size:
1.2 KB
|
Line | |
---|
1 | """ |
---|
2 | Prepare python system path to point to right locations |
---|
3 | """ |
---|
4 | import imp |
---|
5 | import os |
---|
6 | import sys |
---|
7 | def addpath(path): |
---|
8 | """ |
---|
9 | Add a directory to the python path environment, and to the PYTHONPATH |
---|
10 | environment variable for subprocesses. |
---|
11 | """ |
---|
12 | path = os.path.abspath(path) |
---|
13 | if 'PYTHONPATH' in os.environ: |
---|
14 | PYTHONPATH = path + os.pathsep + os.environ['PYTHONPATH'] |
---|
15 | else: |
---|
16 | PYTHONPATH = path |
---|
17 | os.environ['PYTHONPATH'] = PYTHONPATH |
---|
18 | sys.path.insert(0, path) |
---|
19 | |
---|
20 | def import_package(modname, path): |
---|
21 | """Import a package into a particular point in the python namespace""" |
---|
22 | mod = imp.load_source(modname, os.path.abspath(os.path.join(path,'__init__.py'))) |
---|
23 | sys.modules[modname] = mod |
---|
24 | mod.__path__ = [os.path.abspath(path)] |
---|
25 | return mod |
---|
26 | |
---|
27 | root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) |
---|
28 | addpath(os.path.join(root, 'src')) |
---|
29 | #addpath(os.path.join(root, '../sasmodels/')) |
---|
30 | import sas |
---|
31 | from distutils.util import get_platform |
---|
32 | sas.sasview = import_package('sas.sasview', os.path.join(root,'sasview')) |
---|
33 | platform = '%s-%s'%(get_platform(),sys.version[:3]) |
---|
34 | build_path = os.path.join(root, 'build','lib.'+platform) |
---|
35 | sys.path.append(build_path) |
---|
Note: See
TracBrowser
for help on using the repository browser.