ocspbuilder icon indicating copy to clipboard operation
ocspbuilder copied to clipboard

Remove import ocspbuilder from setup.py

Open mrtndwrd opened this issue 8 years ago • 6 comments

This import creates a problem when running setup.py install:

$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    import ocspbuilder
  File ".../ocspbuilder/ocspbuilder/__init__.py", line 10, in <module>
    from asn1crypto import x509, keys, core, ocsp
ImportError: No module named asn1crypto

I'd suggest removing it, although you need another way to track your version number. I don't see any special reason why it should be in the module init.py, so you could just move the version string to the setup.py maybe? If you agree, I would be happy to make a pull request as well

mrtndwrd avatar Jan 19 '17 15:01 mrtndwrd

Mostly this is just a side effect of following a file layout pattern from some of the other light-weight modules sitting on top of oscrypto and asn1crypto.

It would probably make sense to move the version info into _version.py, OCSPResponseBuilder into _response_builder.py and OCSPRequestBuilder into _request_builder.py. If you want to take a pass at that, I’d certainly be amenable.

The two functions at the bottom of __init__.py have lived in a file named _types.py in oscrypto and asn1crypto. The only other thing would be _writer(), which should probably go into something like _decorators.py.

This restructuring should allow importing just oscrypto._version into setup.py, which should resolve the issue you are running into.

I will probably take a whack at this issue here and the other modularcrypto modules at some point, even if you don’t feel like sending a PR.

wbond avatar Jan 19 '17 15:01 wbond

As of ddb424decd0d5d422c85a1f80c046f6cc26233f1, ocspbuilder.version exists and is used in setup.py, which should prevent this issue.

I haven't made a new release yet due to a backlog on Travis CI.

wbond avatar Jan 24 '17 19:01 wbond

This unfortunately does not solve the issue:

mati@dt ~/git/mati/ocspbuilder $ virtualenv -p /usr/bin/python3 .
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in ./bin/python3
Not overwriting existing python script ./bin/python (you must use ./bin/python3)
Installing setuptools, pip...done.
mati@dt ~/git/mati/ocspbuilder $ source bin/activate
(ocspbuilder)mati@dt ~/git/mati/ocspbuilder $ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from ocspbuilder import version
  File "/home/mati/git/mati/ocspbuilder/ocspbuilder/__init__.py", line 10, in <module>
    from asn1crypto import x509, keys, core, ocsp
ImportError: No module named 'asn1crypto'

(this is on Python 3.4)

mathiasertl avatar Feb 11 '18 18:02 mathiasertl

Trying to import ocsp module gives an error:

>>> from cryptography.x509 import ocsp Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'ocsp'

Python version 3.6

eragonriddle avatar Nov 05 '18 17:11 eragonriddle

@eragonriddle This is not the cryptography project.

wbond avatar Nov 05 '18 17:11 wbond

Got it, sorry about that

eragonriddle avatar Nov 05 '18 17:11 eragonriddle