LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Functions | Variables
lsstimport Namespace Reference

Functions

def imp_load_module (name, args)
 

Variables

tuple SHARED_LIB_EXTENSION_LIST = ('.so', '.dylib')
 
tuple LIB_EXCEPTION_LIST = ('_lsstcppimport.so',)
 
 RTLD_GLOBAL = None
 
 RTLD_NOW = None
 
tuple options = ('os', 'DLFCN', 'ctypes')
 
 m = importlib.import_module(mod)
 
 DLFLAGS = RTLD_GLOBAL | RTLD_NOW
 
 orig_imp_load_module = imp.load_module
 
 load_module
 
 file
 

Function Documentation

◆ imp_load_module()

def lsstimport.imp_load_module (   name,
  args 
)

Definition at line 88 of file lsstimport.py.

88  def imp_load_module(name, *args):
89  pathParts = args[1].split(os.path.sep)
90  extension = os.path.splitext(pathParts[-1])[-1]
91  # Find all swigged LSST libs. Load _lsstcppimport.so by
92  # adding it to the EXCEPTIONLIST since it may not have lsst in
93  # the path (it's in $BASE_DIR/python, not
94  # $BASE_DIR/python/lsst). Also, look for paths that look like
95  # python/lsst as that is how to know if you are in an LSST
96  # package.
97  lsstIdx = [i for i, el in enumerate(pathParts) if el == 'python']
98  if pathParts[-1] in LIB_EXCEPTION_LIST or (extension in SHARED_LIB_EXTENSION_LIST and
99  pathParts[-1].startswith('_') and
100  'lsst' in [pathParts[i + 1] for i in lsstIdx]):
101  # Get currently set flags
102  originalDLFlags = sys.getdlopenflags()
103  # Set flags
104  sys.setdlopenflags(DLFLAGS)
105  try:
106  module = orig_imp_load_module(name, *args)
107  finally:
108  # Set original flags
109  sys.setdlopenflags(originalDLFlags)
110  else:
111  module = orig_imp_load_module(name, *args)
112  return module
orig_imp_load_module
Definition: lsstimport.py:85
def imp_load_module(name, args)
Definition: lsstimport.py:88

Variable Documentation

◆ DLFLAGS

lsstimport.DLFLAGS = RTLD_GLOBAL | RTLD_NOW

Definition at line 71 of file lsstimport.py.

◆ file

lsstimport.file

Definition at line 130 of file lsstimport.py.

◆ LIB_EXCEPTION_LIST

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

Definition at line 39 of file lsstimport.py.

◆ load_module

lsstimport.load_module

Definition at line 113 of file lsstimport.py.

◆ m

lsstimport.m = importlib.import_module(mod)

Definition at line 50 of file lsstimport.py.

◆ options

tuple lsstimport.options = ('os', 'DLFCN', 'ctypes')

Definition at line 47 of file lsstimport.py.

◆ orig_imp_load_module

lsstimport.orig_imp_load_module = imp.load_module

Definition at line 85 of file lsstimport.py.

◆ RTLD_GLOBAL

lsstimport.RTLD_GLOBAL = None

Definition at line 43 of file lsstimport.py.

◆ RTLD_NOW

int lsstimport.RTLD_NOW = None

Definition at line 44 of file lsstimport.py.

◆ SHARED_LIB_EXTENSION_LIST

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

Definition at line 38 of file lsstimport.py.