1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00
borg/setup_crypto.py

28 lines
827 B
Python
Raw Normal View History

# Support code for building a C extension with crypto code
import os
2019-08-25 21:57:05 +00:00
import sys
is_win32 = sys.platform.startswith('win32')
def crypto_ext_kwargs(pc, system_prefix):
if system_prefix:
print('Detected OpenSSL [via BORG_OPENSSL_PREFIX]')
2019-08-25 21:57:05 +00:00
if is_win32:
lib_dir = system_prefix
lib_name = 'libcrypto'
else:
lib_dir = os.path.join(system_prefix, 'lib')
lib_name = 'crypto'
return dict(include_dirs=[os.path.join(system_prefix, 'include')],
2019-08-25 21:57:05 +00:00
library_dirs=[lib_dir],
libraries=[lib_name])
2019-03-13 22:59:04 +00:00
if pc and pc.exists('libcrypto'):
print('Detected OpenSSL [via pkg-config]')
2019-03-13 22:59:04 +00:00
return pc.parse('libcrypto')
raise Exception('Could not find OpenSSL lib/headers, please set BORG_OPENSSL_PREFIX')