summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-18 16:26:30 +0000
committerErik Johnston <erik@matrix.org>2015-02-18 16:52:04 +0000
commitaa577df06405c1574084389bcd189baedc3a7397 (patch)
tree1b86a6069f25f47965257bdaab5031aea10002ea /synapse/app
parentGenerate a version string that includes git details if run from git checkout (diff)
downloadsynapse-aa577df06405c1574084389bcd189baedc3a7397.tar.xz
When computing git version run git commands in same dir as source files
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 166a0169ab..6acb3b2f4e 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -211,10 +211,12 @@ class SynapseHomeServer(HomeServer):
 
 def get_version_string():
     null = open(os.devnull, 'w')
+    cwd = os.path.dirname(os.path.abspath(__file__))
     try:
         git_branch = subprocess.check_output(
             ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
             stderr=null,
+            cwd=cwd,
         ).strip()
         git_branch = "b=" + git_branch
     except subprocess.CalledProcessError:
@@ -224,6 +226,7 @@ def get_version_string():
         git_tag = subprocess.check_output(
             ['git', 'describe', '--exact-match'],
             stderr=null,
+            cwd=cwd,
         ).strip()
         git_tag = "t=" + git_tag
     except subprocess.CalledProcessError:
@@ -233,6 +236,7 @@ def get_version_string():
         git_commit = subprocess.check_output(
             ['git', 'rev-parse', '--short', 'HEAD'],
             stderr=null,
+            cwd=cwd,
         ).strip()
     except subprocess.CalledProcessError:
         git_commit = ""
@@ -242,6 +246,7 @@ def get_version_string():
         is_dirty = subprocess.check_output(
             ['git', 'describe', '--dirty=' + dirty_string],
             stderr=null,
+            cwd=cwd,
         ).strip().endswith(dirty_string)
 
         git_dirty = "dirty" if is_dirty else ""