File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1534,18 +1534,20 @@ def CLTVersion():
15341534 FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI"
15351535 MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables"
15361536
1537- regex = re .compile ("version: (?P<version>.+)" )
1537+ regex = re .compile (r "version: (?P<version>.+)" )
15381538 for key in [MAVERICKS_PKG_ID , STANDALONE_PKG_ID , FROM_XCODE_PKG_ID ]:
15391539 try :
15401540 output = GetStdout (["/usr/sbin/pkgutil" , "--pkg-info" , key ])
1541- return re .search (regex , output ).groupdict ()["version" ]
1541+ if m := re .search (regex , output ):
1542+ return m .groupdict ()["version" ]
15421543 except (GypError , OSError ):
15431544 continue
15441545
15451546 regex = re .compile (r"Command Line Tools for Xcode\s+(?P<version>\S+)" )
15461547 try :
15471548 output = GetStdout (["/usr/sbin/softwareupdate" , "--history" ])
1548- return re .search (regex , output ).groupdict ()["version" ]
1549+ if m := re .search (regex , output ):
1550+ return m .groupdict ()["version" ]
15491551 except (GypError , OSError ):
15501552 return None
15511553
You can’t perform that action at this time.
0 commit comments