Skip to content

Commit 3c58fb9

Browse files
add prebuilt libsecp256k1
1 parent 6690f9f commit 3c58fb9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
448 KB
Binary file not shown.

tests/tests/util/secp256k1.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ctypes, os
1+
import ctypes, os, sys
22
import ctypes.util
33

44
from ctypes import (
@@ -17,6 +17,12 @@
1717

1818
def _init(flags = (CONTEXT_SIGN | CONTEXT_VERIFY)):
1919
library_path = ctypes.util.find_library('libsecp256k1')
20+
if library_path is None:
21+
CURRENT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)))
22+
if sys.platform == 'darwin':
23+
library_path = os.path.abspath(os.path.join(CURRENT_DIR, "prebuilt/libsecp256k1.dylib"))
24+
else:
25+
library_path = os.path.abspath(os.path.join(CURRENT_DIR, "prebuilt/libsecp256k1.so"))
2026

2127
secp256k1 = ctypes.cdll.LoadLibrary(library_path)
2228

0 commit comments

Comments
 (0)