Only search for brew openssl on failure

This commit is contained in:
Kovid Goyal 2022-08-10 11:35:43 +05:30
parent e0e0582b53
commit 1aad4c7ec3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -131,6 +131,10 @@ def libcrypto_flags() -> Tuple[List[str], List[str]]:
# have an ancient broken system OpenSSL, so we need to check for one # have an ancient broken system OpenSSL, so we need to check for one
# installed by all the various macOS package managers. # installed by all the various macOS package managers.
extra_pc_dir = '' extra_pc_dir = ''
try:
cflags = pkg_config('libcrypto', '--cflags-only-I', fatal=False)
except subprocess.CalledProcessError:
if is_macos: if is_macos:
openssl_dirs = [] openssl_dirs = []
for x in chain(glob.glob('/opt/homebrew/opt/openssl@*/lib/pkgconfig'), glob.glob('/usr/local/opt/openssl@*/lib/pkgconfig')): for x in chain(glob.glob('/opt/homebrew/opt/openssl@*/lib/pkgconfig'), glob.glob('/usr/local/opt/openssl@*/lib/pkgconfig')):
@ -140,10 +144,6 @@ def libcrypto_flags() -> Tuple[List[str], List[str]]:
return x.split('@')[-1] return x.split('@')[-1]
openssl_dirs.sort(key=key) openssl_dirs.sort(key=key)
extra_pc_dir = os.pathsep.join(openssl_dirs) extra_pc_dir = os.pathsep.join(openssl_dirs)
try:
cflags = pkg_config('libcrypto', '--cflags-only-I', fatal=False)
except subprocess.CalledProcessError:
cflags = pkg_config('libcrypto', '--cflags-only-I', extra_pc_dir=extra_pc_dir) cflags = pkg_config('libcrypto', '--cflags-only-I', extra_pc_dir=extra_pc_dir)
return cflags, pkg_config('libcrypto', '--libs', extra_pc_dir=extra_pc_dir) return cflags, pkg_config('libcrypto', '--libs', extra_pc_dir=extra_pc_dir)