Browse Source

Resolve issue #57 (#58)

* Check if libsecp256k1 has ecdh modules

* Download libsecp256k1 when necessary

When building the clib, it is possible that libsecp256k1's sources are
not present causing the build to fail. This ensures they are downloaded
before starting the build.
anonswap
Michael A Borders 5 years ago
committed by Ofek Lev
parent
commit
ff7c336c4e
  1. 4
      setup.py
  2. 5
      setup_support.py

4
setup.py

@ -139,6 +139,10 @@ class build_clib(_build_clib):
if e.errno != errno.EEXIST:
raise
if not os.path.exists(absolute('libsecp256k1')):
# library needs to be downloaded
self.get_source_files()
if not os.path.exists(absolute('libsecp256k1/configure')):
# configure script hasn't been generated yet
autogen = absolute('libsecp256k1/autogen.sh')

5
setup_support.py

@ -69,6 +69,11 @@ def _find_lib():
ffi = FFI()
try:
ffi.dlopen("secp256k1")
if os.path.exists('/usr/include/secp256k1_ecdh.h'):
return True
else:
# The system library lacks the ecdh module
return False
except OSError:
if 'LIB_DIR' in os.environ:
for path in glob.glob(os.path.join(os.environ['LIB_DIR'], "*secp256k1*")):

Loading…
Cancel
Save