diff options
Diffstat (limited to 'methods.py')
| -rw-r--r-- | methods.py | 24 | 
1 files changed, 18 insertions, 6 deletions
diff --git a/methods.py b/methods.py index b4a55cab79..571b134c8a 100644 --- a/methods.py +++ b/methods.py @@ -125,9 +125,21 @@ def update_version(module_version_string=""):      if os.path.isfile(os.path.join(gitfolder, "HEAD")):          head = open(os.path.join(gitfolder, "HEAD"), "r", encoding="utf8").readline().strip()          if head.startswith("ref: "): -            head = os.path.join(gitfolder, head[5:]) +            ref = head[5:] +            head = os.path.join(gitfolder, ref) +            packedrefs = os.path.join(gitfolder, "packed-refs")              if os.path.isfile(head):                  githash = open(head, "r").readline().strip() +            elif os.path.isfile(packedrefs): +                # Git may pack refs into a single file. This code searches .git/packed-refs file for the current ref's hash. +                # https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-pack-refs.html +                for line in open(packedrefs, "r").read().splitlines(): +                    if line.startswith("#"): +                        continue +                    (line_hash, line_ref) = line.split(" ") +                    if ref == line_ref: +                        githash = line_hash +                        break          else:              githash = head @@ -833,15 +845,15 @@ def Run(env, function, short_message, subprocess=True):  def detect_darwin_sdk_path(platform, env):      sdk_name = "" -    if platform == "osx": +    if platform == "macos":          sdk_name = "macosx"          var_name = "MACOS_SDK_PATH" -    elif platform == "iphone": +    elif platform == "ios":          sdk_name = "iphoneos" -        var_name = "IPHONESDK" -    elif platform == "iphonesimulator": +        var_name = "IOS_SDK_PATH" +    elif platform == "iossimulator":          sdk_name = "iphonesimulator" -        var_name = "IPHONESDK" +        var_name = "IOS_SDK_PATH"      else:          raise Exception("Invalid platform argument passed to detect_darwin_sdk_path")  |