-
Notifications
You must be signed in to change notification settings - Fork 431
Conversation
Previously, when confirming OpenSSL is installed, we checked that the module was installed, and verified that `crypto.py` was contained in the package directory. However, this can cause issues in cases of non-standard installs. In addition, the `imp.find_module` call already raises an `ImportError` in the case that the module is missing, so this second check isn't needed. Instead, we just drop the explicit check for `crypto.py` in the `OpenSSL` directory.
@craigcitro I looked at #159 and didn't find any discussion, but I'm fairly certain that |
I'm fairly certain I used http://stackoverflow.com/q/14050281/1068170 as my reference and also recall using It seems the most reasonable explanation for if not os.path.isfile(os.path.join(_package_dir, 'crypto.py')): is to verify that the removed line from OpenSSL import crypto still works. Testing out in ~/Desktop $ virtualenv venv
~/Desktop $ source venv/bin/activate
(venv) ~/Desktop $ pip install pyOpenSSL==0.13
Collecting pyOpenSSL==0.13
...
(venv) ~/Desktop $ ls -1 venv/local/lib/python2.7/site-packages/OpenSSL/
crypto.so*
__init__.py
__init__.pyc
rand.so*
SSL.so*
test/
tsafe.py
tsafe.pyc
version.py
version.pyc
(venv) ~/Desktop $ cat venv/local/lib/python2.7/site-packages/OpenSSL/version.py
# Copyright (C) AB Strakt
# Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
"""
pyOpenSSL - A simple wrapper around the OpenSSL library
"""
__version__ = '0.13' |
@craigcitro WDYT of all that? |
@dhermes I guess I'm confused - the python docs explicitly say where will this fail? |
Yeah you can disregard my first comment. It's safe(ish, mostly) to say that it will throw when it doesn't exist. More WDYT of the check of |
do we think there's a case where someone could have |
No I don't think so. The flipside: we could check for |
Simplify OpenSSL checks in crypt.py.
Previously, when confirming OpenSSL is installed, we checked that the module
was installed, and verified that
crypto.py
was contained in the packagedirectory.
However, this can cause issues in cases of non-standard installs. In addition,
the
imp.find_module
call already raises anImportError
in the case thatthe module is missing, so this second check isn't needed.
Instead, we just drop the explicit check for
crypto.py
in theOpenSSL
directory.
PTAL @dhermes