From 5a015cb57588db937fe5724bd6c33bdfeac2a6d4 Mon Sep 17 00:00:00 2001 From: Donald Stufft <donald@stufft.io> Date: Sat, 5 Oct 2013 16:54:01 -0400 Subject: [PATCH] Work around cffi suffix issue https://bitbucket.org/cffi/cffi/issue/110/ --- nacl/nacl.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nacl/nacl.py b/nacl/nacl.py index afb04afe..f959123d 100644 --- a/nacl/nacl.py +++ b/nacl/nacl.py @@ -7,13 +7,24 @@ from __future__ import division import functools import os.path +from distutils.sysconfig import get_config_vars + +import cffi.verifier + from cffi import FFI -from cffi.verifier import Verifier __all__ = ["ffi", "lib"] +# Monkeypatch cffi.verifier._get_so_suffix to return the same as distutils +# See: https://bitbucket.org/cffi/cffi/issue/110/ +def _get_so_suffix(): + return get_config_vars().get("EXT_SUFFIX", ".so") + +cffi.verifier._get_so_suffix = _get_so_suffix + + ffi = FFI() ffi.cdef( # Secret Key Encryption @@ -76,7 +87,7 @@ ffi.cdef( ) -ffi.verifier = Verifier(ffi, +ffi.verifier = cffi.verifier.Verifier(ffi, "#include <sodium.h>", # We need to link to the sodium library -- GitLab