LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Functions | Variables
lsstimport Namespace Reference

Functions

def imp_load_module
 

Variables

tuple SHARED_LIB_EXTENSION_LIST = ('.so', '.dylib')
 
tuple LIB_EXCEPTION_LIST = ('_lsstcppimport.so',)
 
int RTLD_GLOBAL = -1
 
int RTLD_NOW = -1
 
 DLFLAGS = RTLD_GLOBAL|RTLD_NOW
 
 orig_imp_load_module = imp.load_module
 

Function Documentation

def lsstimport.imp_load_module (   name,
  args 
)

Definition at line 75 of file lsstimport.py.

75 
76  def imp_load_module(name, *args):
77  pathParts = args[1].split(os.path.sep)
78  extension = os.path.splitext(pathParts[-1])[-1]
79  #Find all swigged LSST libs. Load _lsstcppimport.so by adding it to the EXCEPTIONLIST
80  #since it may not have lsst in the path (it's in $BASE_DIR/python, not $BASE_DIR/python/lsst).
81  #Also, look for paths that look like python/lsst as that is how to know if you are in an LSST
82  #package.
83  lsstIdx = [i for i, el in enumerate(pathParts) if el == 'python']
84  if pathParts[-1] in LIB_EXCEPTION_LIST or (extension in SHARED_LIB_EXTENSION_LIST and pathParts[-1].startswith('_')\
85  and 'lsst' in [pathParts[i+1] for i in lsstIdx]):
86  #Get currently set flags
87  originalDLFlags = sys.getdlopenflags()
88  #Set flags
89  sys.setdlopenflags(DLFLAGS)
90  try:
91  module = orig_imp_load_module(name, *args)
92  finally:
93  #Set original flags
94  sys.setdlopenflags(originalDLFlags)
95  else:
96  module = orig_imp_load_module(name, *args)
return module
def imp_load_module
Definition: lsstimport.py:75
orig_imp_load_module
Definition: lsstimport.py:73

Variable Documentation

lsstimport.DLFLAGS = RTLD_GLOBAL|RTLD_NOW

Definition at line 58 of file lsstimport.py.

tuple lsstimport.LIB_EXCEPTION_LIST = ('_lsstcppimport.so',)

Definition at line 34 of file lsstimport.py.

lsstimport.orig_imp_load_module = imp.load_module

Definition at line 73 of file lsstimport.py.

lsstimport.RTLD_GLOBAL = -1

Definition at line 38 of file lsstimport.py.

lsstimport.RTLD_NOW = -1

Definition at line 39 of file lsstimport.py.

tuple lsstimport.SHARED_LIB_EXTENSION_LIST = ('.so', '.dylib')

Definition at line 33 of file lsstimport.py.