Skip to content

Commit 1f3dfcc

Browse files
pyrtsarefack
authored andcommitted
Fix XcodeVersion() parsing for Xcode 10.0
Changes the output from '0100' to '1000' and fixes the parsing of `CLTVersion()` output too in case `xcodebuild -version` prints an unexpected output.
1 parent 0e9c78a commit 1f3dfcc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pylib/gyp/xcode_emulation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,16 +1403,16 @@ def XcodeVersion():
14031403
except:
14041404
version = CLTVersion()
14051405
if version:
1406-
version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
1406+
version = re.search(r'^(\d{1,2}\.\d(\.\d+)?)', version).groups()[0]
14071407
else:
14081408
raise GypError("No Xcode or CLT version detected!")
14091409
# The CLT has no build information, so we return an empty string.
14101410
version_list = [version, '']
14111411
version = version_list[0]
14121412
build = version_list[-1]
1413-
# Be careful to convert "4.2" to "0420":
1414-
version = version.split()[-1].replace('.', '')
1415-
version = (version + '0' * (3 - len(version))).zfill(4)
1413+
# Be careful to convert "4.2" to "0420" and "10.0" to "1000":
1414+
version = format(''.join((version.split()[-1].split('.') + ['0', '0'])[:3]),
1415+
'>04s')
14161416
if build:
14171417
build = build.split()[-1]
14181418
XCODE_VERSION_CACHE = (version, build)

0 commit comments

Comments
 (0)