Skip to content
Snippets Groups Projects
Commit 2a43b8cc authored by Wouter Bolsterlee's avatar Wouter Bolsterlee
Browse files

Call ffi.cdef() for header files in predictable order

Always call ffi.cdef() with a consistent ordering of the header files.
This avoids problems where CFFI generates different checksums (used in
.so filenames) at compile time and runtime, and tries to load the wrong
.so file.

Fixes issue #53 (https://github.com/pyca/pynacl/issues/53)
parent 0f3483ee
No related branches found
No related tags found
No related merge requests found
...@@ -36,8 +36,10 @@ HEADERS = glob.glob( ...@@ -36,8 +36,10 @@ HEADERS = glob.glob(
ffi = FFI() ffi = FFI()
# Add all of our header files # Add all of our header files, but sort first for consistency of the
for header in HEADERS: # hash that CFFI generates and uses in the .so filename (the order of
# glob() results cannot be relied on)
for header in sorted(HEADERS):
with open(header, "r") as hfile: with open(header, "r") as hfile:
ffi.cdef(hfile.read()) ffi.cdef(hfile.read())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment