2
pycryptopp - Python wrappers for Crypto++
5
__version__ = "unknown"
7
from _version import __version__
9
# We're running in a tree that hasn't run "./setup.py darcsver", and didn't
10
# come with a _version.py, so we don't know what our version is. This should
11
# not happen very often.
14
# we import our glue .so here, and then other modules use the copy in
15
# sys.modules. We wrap the import with RTLD_GLOBAL to make the C++ symbols in
16
# our _pycryptopp.so glue match the symbols defined in libcrypto++.so . On
17
# windows, which has RTLD_GLOBAL but not sys.getdlopenflags), we just import
18
# it normally, because windows is basically always in RTLD_GLOBAL mode.
22
use_RTLD_GLOBAL = hasattr(sys, "getdlopenflags")
25
from ctypes import RTLD_GLOBAL as RTLD_GLOBAL_FROM_CTYPES
26
RTLD_GLOBAL = RTLD_GLOBAL_FROM_CTYPES # hack to hush pyflakes
27
del RTLD_GLOBAL_FROM_CTYPES
29
# ctypes was added in Python 2.5 -- we still support Python 2.4, which
31
from dl import RTLD_GLOBAL as RTLD_GLOBAL_FROM_DL
32
RTLD_GLOBAL = RTLD_GLOBAL_FROM_DL
33
del RTLD_GLOBAL_FROM_DL
34
flags = sys.getdlopenflags()
38
sys.setdlopenflags(flags|RTLD_GLOBAL)
40
import _pycryptopp # all that work for one little import
44
sys.setdlopenflags(flags)
45
del flags, RTLD_GLOBAL
48
def _import_my_names(thismodule, prefix):
49
for name in dir(_pycryptopp):
50
if name.startswith(prefix):
51
myname = name[len(prefix):]
52
thismodule[myname] = getattr(_pycryptopp, name)
54
import publickey, hash, cipher
56
quiet_pyflakes=[__version__, publickey, hash, cipher, _pycryptopp]
57
del sys, quiet_pyflakes