Package reflectometry :: Package model1d :: Package adaptor :: Module thReflUtil

Source Code for Module reflectometry.model1d.adaptor.thReflUtil

 1  """ 
 2  Set the environments 
 3  """ 
 4  import os, sys 
 5   
 6  ## environment name for home directory of PARK 
 7  PARK_PATH = 'parkPath' 
 8   
 9  ## the subdirectories that depends on 
10  DEP_DIRS = ('xmlUtil', 'fit', 'theory' ) 
11   
12   
13 -def SetEnviron():
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