facebook/xctool — pull request #407 by UkuLoskit (2014-08-25 22:42:44+00:00)
Title: fix parsing iphone simulator sdk versions for xcode 6.6

In the new beta version 6 of XCode 6 the
**$DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs** directory now includes a folder named *iPhoneSimulator.sdk*. The directory does not appear to be present in Xcode 5, nor in any other Xcode 6 beta versions. This change causes the current xctool code to fail with an **AttributeError** on **NoneType** object. This is due to the fact that the *glob* expression matches this new directory (even though it does not include a version specifier) and the regular expression group lookup for the version specifier is done without checking for a match.

The changes I have made:

1. since *glob* does not provide a way to specify 'at least one' quantifier (+), I have used *os.listdir()* instead, this simplifies the code such that *basename* calls are no longer needed.
2. added the match check to the list comprehension to only look up the group for matching directories
3. the final change concerns sorting. if filenames are sorted as strings, version *10.0* appears before version *9.0*. I have sorted them as floats instead.