diff options
Diffstat (limited to 'lib/Crypto/SelfTest/st_common.py')
-rw-r--r-- | lib/Crypto/SelfTest/st_common.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Crypto/SelfTest/st_common.py b/lib/Crypto/SelfTest/st_common.py index c56eac5..627ace7 100644 --- a/lib/Crypto/SelfTest/st_common.py +++ b/lib/Crypto/SelfTest/st_common.py @@ -59,4 +59,16 @@ def b2a_hex(s): # For completeness return binascii.b2a_hex(s) +def handle_fastmath_import_error(): + from distutils.sysconfig import get_config_var + import inspect, os.path + ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO") + _fm_path = os.path.normpath(os.path.dirname(os.path.abspath( + inspect.getfile(inspect.currentframe()))) + +"/../../PublicKey/_fastmath"+ext_suffix) + if os.path.exists(_fm_path): + raise ImportError("While the _fastmath module exists, importing "+ + "it failed. This may point to the gmp or mpir shared library "+ + "not being in the path. _fastmath was found at "+_fm_path) + # vim:set ts=4 sw=4 sts=4 expandtab: |