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

Merged
siuying merged 1 commits from homebrew into master 2013-05-14 17:56:11 +02:00
Showing only changes of commit a041d48375 - Show all commits

View File

@ -415,17 +415,21 @@ except:
OpenSSL = _OpenSSL('libcrypto.dylib') OpenSSL = _OpenSSL('libcrypto.dylib')
except: except:
try: try:
from os import path # try homebrew installation
lib_path = path.join(sys._MEIPASS, "libeay32.dll") OpenSSL = _OpenSSL('/usr/local/opt/openssl/lib/libcrypto.dylib')
OpenSSL = _OpenSSL(lib_path)
except: except:
if 'linux' in sys.platform or 'darwin' in sys.platform: try:
try: from os import path
from ctypes.util import find_library lib_path = path.join(sys._MEIPASS, "libeay32.dll")
OpenSSL = _OpenSSL(find_library('ssl')) OpenSSL = _OpenSSL(lib_path)
except Exception, err: except:
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') if 'linux' in sys.platform or 'darwin' in sys.platform:
from ctypes.util import find_library try:
OpenSSL = _OpenSSL(find_library('ssl')) from ctypes.util import find_library
else: OpenSSL = _OpenSSL(find_library('ssl'))
raise Exception("Couldn't find and load the OpenSSL library. You must install it.") 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.")