Skip to content

Commit 6c205ab

Browse files
committed
build: always use strings for compiler version in gyp files
If GYP finds a string variable that can be converted to an integer, it will do it when the variable is expanded. Use "0.0" instead of "0" to force strings and be able to use comparison operations such as `gas_version >= "2.26"` in Python 3. PR-URL: #29897 Reviewed-By: Christian Clauss <[email protected]> Reviewed-By: Sam Roberts <[email protected]>
1 parent 66b9532 commit 6c205ab

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

configure.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def get_version_helper(cc, regexp):
703703
if match:
704704
return match.group(2)
705705
else:
706-
return '0'
706+
return '0.0'
707707

708708
def get_nasm_version(asm):
709709
try:
@@ -714,15 +714,15 @@ def get_nasm_version(asm):
714714
warn('''No acceptable ASM compiler found!
715715
Please make sure you have installed NASM from https://www.nasm.us
716716
and refer BUILDING.md.''')
717-
return '0'
717+
return '0.0'
718718

719719
match = re.match(r"NASM version ([2-9]\.[0-9][0-9]+)",
720720
to_utf8(proc.communicate()[0]))
721721

722722
if match:
723723
return match.group(1)
724724
else:
725-
return '0'
725+
return '0.0'
726726

727727
def get_llvm_version(cc):
728728
return get_version_helper(
@@ -755,7 +755,7 @@ def get_gas_version(cc):
755755
return match.group(1)
756756
else:
757757
warn('Could not recognize `gas`: ' + gas_ret)
758-
return '0'
758+
return '0.0'
759759

760760
# Note: Apple clang self-reports as clang 4.2.0 and gcc 4.2.1. It passes
761761
# the version check more by accident than anything else but a more rigorous
@@ -766,7 +766,7 @@ def check_compiler(o):
766766
if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
767767
nasm_version = get_nasm_version('nasm')
768768
o['variables']['nasm_version'] = nasm_version
769-
if nasm_version == 0:
769+
if nasm_version == '0.0':
770770
o['variables']['openssl_no_asm'] = 1
771771
return
772772

@@ -785,7 +785,7 @@ def check_compiler(o):
785785
# to a version that is not completely ancient.
786786
warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC)
787787

788-
o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0
788+
o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0'
789789

790790
# Need xcode_version or gas_version when openssl asm files are compiled.
791791
if options.without_ssl or options.openssl_no_asm or options.shared_openssl:

deps/openssl/openssl.gyp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
'variables': {
3-
'gas_version%': 0,
4-
'llvm_version%': 0,
5-
'nasm_version%': 0,
3+
'gas_version%': '0.0',
4+
'llvm_version%': '0.0',
5+
'nasm_version%': '0.0',
66
},
77
'targets': [
88
{

deps/openssl/openssl_common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
'TERMIOS',
6565
],
6666
'conditions': [
67-
[ 'llvm_version==0', {
67+
[ 'llvm_version=="0.0"', {
6868
'cflags': ['-Wno-old-style-declaration',],
6969
}],
7070
],

node.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
'-Wl,-bnoerrmsg',
291291
],
292292
}],
293-
['(OS=="linux" or OS=="mac") and llvm_version!=0', {
293+
['OS in ("linux", "mac") and llvm_version != "0.0"', {
294294
'libraries': ['-latomic'],
295295
}],
296296
],

0 commit comments

Comments
 (0)