gyp: modify XcodeVersion() to convert "4.2" to "0420" and "10.0" to "1000"

Ref: https://github.com/nodejs/node-addon-api/issues/445#issuecomment-535361389
PR-URL: https://github.com/nodejs/node-gyp/pull/1895
Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
Christian Clauss 2019-09-27 00:29:44 +02:00 committed by Rod Vagg
parent 67dec1496a
commit 8e9ec3b024
No known key found for this signature in database
GPG key ID: C273792F7D83545D

View file

@ -1286,9 +1286,9 @@ def XcodeVersion():
version_list = [version, '']
version = version_list[0]
build = version_list[-1]
# Be careful to convert "4.2" to "0420":
version = version.split()[-1].replace('.', '')
version = (version + '0' * (3 - len(version))).zfill(4)
# Be careful to convert "4.2" to "0420" and "10.0" to "1000":
version = format(''.join((version.split()[-1].split('.') + ['0', '0'])[:3]),
'>04s')
if build:
build = build.split()[-1]
XCODE_VERSION_CACHE = (version, build)