1 """
2 Set the environments
3 """
4 import os, sys
5
6
7 PARK_PATH = 'parkPath'
8
9
10 DEP_DIRS = ('xmlUtil', 'fit', 'theory' )
11
12
14 """ Set the environment."""
15 if PARK_PATH not in os.environ:
16 try:
17 pdir = os.path.dirname(os.path.dirname(
18 os.path.dirname(os.path.abspath(__file__))))
19 except:
20 raise EnvironmentError, 'environment "park" is not found or set'
21 else:
22 pdir = os.environ[PARK_PATH]
23
24 if pdir not in sys.path:
25 sys.path.append(pdir)
26
27 for d0 in DEP_DIRS:
28 fullDir = os.path.join(pdir, d0)
29 if os.path.isdir(fullDir) and fullDir not in sys.path:
30 sys.path.append(fullDir)
31