gst-env: Allow setting environment without git
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 25 Mar 2020 12:43:10 +0000 (08:43 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 25 Mar 2020 12:43:10 +0000 (08:43 -0400)
This is needed to use gst-uninstalled mode over NFS when gst-build is a
worktree. When this is the case, the .git is a file that links to the original
git tree, but this tree is unlikely to be visible over NFS. Instead of forcing
NFS contorsion, simply ignore the error.

gst-env.py

index 37503c6..1f30a55 100755 (executable)
@@ -430,8 +430,11 @@ if __name__ == "__main__":
         exit(1)
 
     # The following incantation will retrieve the current branch name.
-    gst_version = git("rev-parse", "--symbolic-full-name", "--abbrev-ref", "HEAD",
-                      repository_path=options.srcdir).strip('\n')
+    try:
+      gst_version = git("rev-parse", "--symbolic-full-name", "--abbrev-ref", "HEAD",
+                        repository_path=options.srcdir).strip('\n')
+    except subprocess.CalledProcessError:
+      gst_version = "unknown"
 
     if options.wine:
         gst_version += '-' + os.path.basename(options.wine)