From 1236869ffc5a1c7a4c61758efd4048819dd7928e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 27 Sep 2019 00:29:44 +0200 Subject: [PATCH] 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 --- gyp/pylib/gyp/xcode_emulation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gyp/pylib/gyp/xcode_emulation.py b/gyp/pylib/gyp/xcode_emulation.py index de376edb07..70f41e6bb4 100644 --- a/gyp/pylib/gyp/xcode_emulation.py +++ b/gyp/pylib/gyp/xcode_emulation.py @@ -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)