diff --git a/MANIFEST.in b/MANIFEST.in index 1feebdd5ed51b193e1ea873811d3a153127a51e8..bd6f93709bccac485ab119c791a6b56dde31b540 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -35,4 +35,4 @@ recursive-include tests *.py recursive-include tests/data * # Remove CFFI files -recursive-exclude nacl _cffi_*.c +recursive-exclude nacl *.c diff --git a/nacl/nacl.py b/nacl/nacl.py index df1d3d90338da882b13e3c9f3d52c401a7dcfc57..afb04afe4d03fd1fd4f7236f087935b49e52f98a 100644 --- a/nacl/nacl.py +++ b/nacl/nacl.py @@ -79,11 +79,6 @@ ffi.cdef( ffi.verifier = Verifier(ffi, "#include <sodium.h>", - # We need to set a tmp directory otherwise when build_ext is run it'll get - # built in nacl/*.so but when ffi.verifier.load_library() is run it'll - # look (and ultimately build again) in nacl/__pycache__/*.so - tmpdir=os.path.abspath(os.path.dirname(__file__)), - # We need to link to the sodium library libraries=["sodium"], @@ -141,6 +136,12 @@ class Library(object): self._ffi = ffi self._initalized = False + # This prevents the compile_module() from being called, the module + # should have been compiled by setup.py + def _compile_module(*args, **kwargs): + raise RuntimeError("Cannot compile module during runtime") + self._ffi.verifier.compile_module = _compile_module + def __getattr__(self, name): if not self._initalized: self._lib = self._ffi.verifier.load_library() diff --git a/setup.py b/setup.py index 3a1b20813271ed730ab9b7a1378557f8f1c6ca7d..9787d911797921bdc2e8f9e931a6ae56320dd66c 100644 --- a/setup.py +++ b/setup.py @@ -185,7 +185,7 @@ setup( "include_dirs": [ sodium("include/sodium"), ], - "sources": map(sodium, [ + "sources": [sodium(s) for s in [ "crypto_auth/crypto_auth.c", "crypto_auth/hmacsha256/auth_hmacsha256_api.c", "crypto_auth/hmacsha256/ref/hmac_hmacsha256.c", @@ -312,7 +312,7 @@ setup( "sodium/core.c", "sodium/utils.c", "sodium/version.c", - ]), + ]], }), ], diff --git a/tox.ini b/tox.ini index f9e837d8a398883004e30044af78a97b3e323009..143fb362e8b60482be594c6d42af60edc23fdc1f 100644 --- a/tox.ini +++ b/tox.ini @@ -4,5 +4,4 @@ envlist = py26,py27,pypy,py32,py33 [testenv] deps = pytest - pytest-cov -commands = py.test --cov=nacl/ +commands = py.test