summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-03-12 17:44:48 +0100
committerRobin Gareus <robin@gareus.org>2013-03-12 17:44:48 +0100
commit59c74e675c0b1ca7365c8ba868b6f764573fd69d (patch)
tree908b99ce71575c9e114fc90ff9dcf18b62a0e436 /wscript
parent20378206686a13eddd53ee5f1994e1c040b25573 (diff)
git revision extraction
Diffstat (limited to 'wscript')
-rw-r--r--wscript38
1 files changed, 5 insertions, 33 deletions
diff --git a/wscript b/wscript
index 57929acad4..cac04c5b17 100644
--- a/wscript
+++ b/wscript
@@ -66,11 +66,6 @@ else:
# Version stuff
-def fetch_svn_revision (path):
- cmd = "svnversion | cut -d: -f1"
- output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].decode (sys.getdefaultencoding())
- return output.rstrip(os.linesep)
-
def fetch_gcc_version (CC):
cmd = "LANG= %s --version" % CC
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
@@ -78,39 +73,16 @@ def fetch_gcc_version (CC):
version = o.split(' ')[2].split('.')
return version
-def fetch_git_revision (path):
- cmd = "LANG= git log --abbrev HEAD^..HEAD"
- output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
- o = output[0].decode('utf-8')
- rev = o.replace ("commit", "git")[0:10]
- cmd = "LANG= git log --abbrev -n1 --grep 'git-svn-id'"
+def fetch_git_revision ():
+ cmd = "LANG= git describe --tags HEAD"
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
- for line in output:
- try:
- if "git-svn-id" in line:
- line = line.split('@')[1].split(' ')
- rev = line[0]
- break
- except:
- pass
+ rev = output[0].decode('utf-8')
return rev
-def fetch_bzr_revision (path):
- cmd = subprocess.Popen("LANG= bzr log -l 1 " + path, stdout=subprocess.PIPE, shell=True)
- out = cmd.communicate()[0]
- svn = re.search('^svn revno: [0-9]*', out, re.MULTILINE)
- str = svn.group(0)
- chars = 'svnreio: '
- return string.lstrip(str, chars)
-
def create_stored_revision():
rev = ""
- if os.path.exists('.svn'):
- rev = fetch_svn_revision('.');
- elif os.path.exists('.git'):
- rev = fetch_git_revision('.');
- elif os.path.exists('.bzr'):
- rev = fetch_bzr_revision('.');
+ if os.path.exists('.git'):
+ rev = fetch_git_revision();
print("Revision: %s", rev)
elif os.path.exists('libs/ardour/svn_revision.cc'):
print("Using packaged svn revision")