1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# We need to enable global symbol visibility for lupa in order to
# support binary module loading in Lua. If we can enable it here, we
# do it temporarily.
def _try_import_with_global_library_symbols():
try:
import DLFCN
dlopen_flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL
except ImportError:
import ctypes
dlopen_flags = ctypes.RTLD_GLOBAL
import sys
old_flags = sys.getdlopenflags()
try:
sys.setdlopenflags(dlopen_flags)
import lupa._lupa
finally:
sys.setdlopenflags(old_flags)
try:
_try_import_with_global_library_symbols()
except:
pass
del _try_import_with_global_library_symbols
# the following is all that should stay in the namespace:
from lupa._lupa import *
try:
from lupa.version import __version__
except ImportError:
pass
|