Description
Noted by @richardlau in #29897
Problem
In various places in GYP files and Python scripts, we use string or number comparisons to check if the version of compiling tools satisfies some minimum value. These are not safe and could give wrong results:
"10.1" >= "2.4"
returnsFalse
2.24 > 2.3
returnsFalse
Some examples in our code base
Lines 1233 to 1237 in 81bc7b3
node/deps/openssl/openssl.gypi
Line 1039 in 81bc7b3
Line 24 in 81bc7b3
Solution?
I haven't found a solution yet, because we need something that works in GYP conditions, meaning simple Python expressions that cannot import external libraries (correct me if I'm wrong).
We could use the builtin from distutils.version import StrictVersion
and StrictVersion("2.24") >= StrictVersion("2.3")
but I don't know if it's possible to make StrictVersion
available to GYP conditionals.
/cc @nodejs/gyp @nodejs/python