Skip to content

pyca/cryptography: cffi build and __file__ #26

@alexzorin

Description

@alexzorin

Hello,

Very cool project - it's what I wish Oracle's Graal could do for Python.

I'm wondering whether you could give a hint for using pyca/cryptography. I'm actually trying to see how hard it would be to build Certbot, but this is the minimal repro:

[[packaging_rule]]
type = "pip-install-simple"
package = "cryptography==2.7"

[[embedded_python_run]]
mode = "eval"
code = "from cryptography.hazmat.backends import default_backend; default_backend()"

Runtime error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "cryptography.hazmat.backends", line 15, in default_backend
  File "cryptography.hazmat.backends.openssl", line 7, in <module>
  File "cryptography.hazmat.backends.openssl.backend", line 18, in <module>
  File "cryptography.x509", line 8, in <module>
  File "cryptography.x509.base", line 16, in <module>
  File "cryptography.x509.extensions", line 19, in <module>
  File "cryptography.hazmat.primitives.constant_time", line 11, in <module>
ModuleNotFoundError: No module named 'cryptography.hazmat.bindings._constant_time'

Looking at how pyca/cryptography seems to build this module, I believe this is a variation of the __file__ problem described in the docs.

I've not had much success with applying the advice from the docs. I think this might be because of the use of __file__ as part of the cffi build process rather than something happening at runtime. I'm not that familiar with the Python runtime in general 🤷‍♂️.

If this is too complex or impossible at the moment, that's okay too! Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityFor compatibility issues with 3rd party Python projectspython-build-standaloneBugs and feature requests for python-build-standalone

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions