Skip to content

Commit

Permalink
(ref) correct differences between pkg-config and pkgconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
MementoRC committed Dec 27, 2023
1 parent f8bb9fc commit 75f9a5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ def has_c_libraries(self):
if os.name == 'nt' or sys.platform == 'win32':
# Apparently, the linker on Windows interprets -lxxx as xxx.lib, not libxxx.lib
for i, v in enumerate(extension.__dict__.get('extra_link_args')):
if v.endswith('.lib'):
extension.__dict__['extra_link_args'][i] = f'lib{v}'
extension.__dict__['extra_link_args'][i] = v.replace('-L', '/LIBPATH:')

if v.startswith('-l'):
v = v.replace('-l', 'lib')
extension.__dict__['extra_link_args'][i] = f'{v}.lib'

setup_kwargs = dict(
setup_requires=['cffi>=1.3.0', 'requests'],
Expand Down
5 changes: 2 additions & 3 deletions setup_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ def _find_lib():
from cffi import FFI

try:
# raises CalledProcessError if pkg-config is not installed or the lib does not exists
subprocess.check_output(['pkg-config', '--exists', 'libsecp256k1']) # noqa S603
subprocess.check_output(['pkg-config', '--exists', 'libsecp256k1'], env=env) # noqa S603

includes = subprocess.check_output(['pkg-config', '--cflags-only-I', 'libsecp256k1']) # noqa S603
includes = subprocess.check_output(['pkg-config', '--cflags-only-I', 'libsecp256k1'], env=env) # noqa S603
includes = includes.strip().decode('utf-8')

return os.path.exists(os.path.join(includes[2:], 'secp256k1_ecdh.h'))
Expand Down

0 comments on commit 75f9a5c

Please sign in to comment.