[OSX] Try to seek homebrew installation of openssl, fixes #76

This commit is contained in:
Francis Chong 2013-05-14 00:45:03 +08:00
parent de98abb466
commit a041d48375
1 changed files with 17 additions and 13 deletions

View File

@ -415,17 +415,21 @@ except:
OpenSSL = _OpenSSL('libcrypto.dylib')
except:
try:
from os import path
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
OpenSSL = _OpenSSL(lib_path)
# try homebrew installation
OpenSSL = _OpenSSL('/usr/local/opt/openssl/lib/libcrypto.dylib')
except:
if 'linux' in sys.platform or 'darwin' in sys.platform:
try:
from ctypes.util import find_library
OpenSSL = _OpenSSL(find_library('ssl'))
except Exception, err:
sys.stderr.write('(On Linux) Couldn\'t find and load the OpenSSL library. You must install it. If you believe that you already have it installed, this exception information might be of use:\n')
from ctypes.util import find_library
OpenSSL = _OpenSSL(find_library('ssl'))
else:
raise Exception("Couldn't find and load the OpenSSL library. You must install it.")
try:
from os import path
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
OpenSSL = _OpenSSL(lib_path)
except:
if 'linux' in sys.platform or 'darwin' in sys.platform:
try:
from ctypes.util import find_library
OpenSSL = _OpenSSL(find_library('ssl'))
except Exception, err:
sys.stderr.write('(On Linux) Couldn\'t find and load the OpenSSL library. You must install it. If you believe that you already have it installed, this exception information might be of use:\n')
from ctypes.util import find_library
OpenSSL = _OpenSSL(find_library('ssl'))
else:
raise Exception("Couldn't find and load the OpenSSL library. You must install it.")