diff options
author | Craig Citro <craigcitro@google.com> | 2015-05-22 23:28:00 -0700 |
---|---|---|
committer | Craig Citro <craigcitro@google.com> | 2015-05-26 11:49:53 -0700 |
commit | df8f98e09f6f95e9032668b743c6125f22c35a3f (patch) | |
tree | 733c229a303052dcc4f423c0e5a0a3c84a9a18ea /oauth2client/crypt.py | |
parent | c61bdf4565782db82172b450284fb969150dd32b (diff) | |
download | oauth2client-df8f98e09f6f95e9032668b743c6125f22c35a3f.tar.gz |
Check for OpenSSL.crypto when detecting OpenSSL.
Previously, we assumed that anyone using `OpenSSL` would have installed it via
a mechanism like `pip`; this has come back to bite us.
We modify our code to look for `OpenSSL.crypto`, not just `OpenSSL`, and add
another (unpleasant) test.
Fixes #190.
Diffstat (limited to 'oauth2client/crypt.py')
-rw-r--r-- | oauth2client/crypt.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/oauth2client/crypt.py b/oauth2client/crypt.py index 19f9d9f..9e3aede 100644 --- a/oauth2client/crypt.py +++ b/oauth2client/crypt.py @@ -57,10 +57,14 @@ def _TryOpenSslImport(): """ try: - _ = imp.find_module('OpenSSL') + _, _package_dir, _ = imp.find_module('OpenSSL') + if not (os.path.isfile(os.path.join(_package_dir, 'crypto.py')) or + os.path.isfile(os.path.join(_package_dir, 'crypto.so')) or + os.path.isdir(os.path.join(_package_dir, 'crypto'))): + raise ImportError('No module named OpenSSL.crypto') return except ImportError: - import OpenSSL + import OpenSSL.crypto try: |