Try to do the right thing when building in a non-git-checkout.
authorCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 14:55:02 +0000 (15:55 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 14:55:02 +0000 (15:55 +0100)
wscript

diff --git a/wscript b/wscript
index 92266116bbfd83b5cac9f69c038af936adc7aba5..e45dd647d9df0ca718d0f1949f5aa24a9354ea9f 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,4 +1,5 @@
 import subprocess
+import os
 
 APPNAME = 'dvdomatic'
 VERSION = '0.30pre'
@@ -89,10 +90,13 @@ def dist(ctx):
     ctx.excl = 'TODO core *~ src/gtk/*~ src/lib/*~ .waf* build .git'
 
 def create_version_cc(version):
-    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')
-    commit = o.replace ("commit ", "")[0:10]
+    if os.path.exists('.git'):
+        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')
+        commit = o.replace ("commit ", "")[0:10]
+    else:
+        commit = 'release'
 
     try:
         text =  '#include "version.h"\n'