Skip to content

Commit 735ec1b

Browse files
bnoordhuistargos
authored andcommitted
build: fix version checks in gyp files
Make `distutils.version.StrictVersion` available as a helper to gyp expressions so they can do proper version checks and update the gyp files accordingly. Caveat emptor: `StrictVersion` does *not* like empty strings so this commit adds truthiness guards. The helper could deal with those but I felt it better to make it explicit. Fixes: #29927 PR-URL: #29931 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 8d03013 commit 735ec1b

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

deps/openssl/openssl.gyp

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
}, 'target_arch=="arm64" and OS=="win"', {
2222
# VC-WIN64-ARM inherits from VC-noCE-common that has no asms.
2323
'includes': ['./openssl_no_asm.gypi'],
24-
}, 'gas_version >= "2.26" or nasm_version >= "2.11.8"', {
24+
}, 'gas_version and v(gas_version) >= v("2.26") or '
25+
'nasm_version and v(nasm_version) >= v("2.11.8")', {
2526
# Require AVX512IFMA supported. See
2627
# https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
2728
# Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.

deps/openssl/openssl.gypi

+3-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,9 @@
10361036
#
10371037
'conditions': [
10381038
['(OS=="win" and MSVS_VERSION>="2012") or '
1039-
'llvm_version>="3.3" or xcode_version>="5.0" or gas_version>="2.23"', {
1039+
'llvm_version and v(llvm_version) >= v("3.3") or '
1040+
'gas_version and v(gas_version) >= v("2.23") or '
1041+
'xcode_version and v(xcode_version) >= v("5.0")', {
10401042
'openssl_sources_x64_win_masm': [
10411043
'<@(openssl_sources_asm_latest_x64_win_masm)',
10421044
'<@(openssl_sources_common_x64_win_masm)',

tools/gyp/pylib/gyp/input.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import threading
2020
import time
2121
import traceback
22+
from distutils.version import StrictVersion
2223
from gyp.common import GypError
2324
from gyp.common import OrderedSet
2425

@@ -1088,7 +1089,8 @@ def EvalSingleCondition(
10881089
else:
10891090
ast_code = compile(cond_expr_expanded, '<string>', 'eval')
10901091
cached_conditions_asts[cond_expr_expanded] = ast_code
1091-
if eval(ast_code, {'__builtins__': None}, variables):
1092+
env = {'__builtins__': None, 'v': StrictVersion}
1093+
if eval(ast_code, env, variables):
10921094
return true_dict
10931095
return false_dict
10941096
except SyntaxError as e:

0 commit comments

Comments
 (0)