Try to do the right thing if we aren't in a git checkout.
authorCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 14:53:27 +0000 (15:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 21 Jul 2012 14:53:27 +0000 (15:53 +0100)
wscript

diff --git a/wscript b/wscript
index e177d91ffdbbc1235e3f8b31562be79c4b6b191b..d8113ccd7eefbe8628b866940dc9902b2a5d3a04 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,4 +1,5 @@
 import subprocess
+import os
 
 APPNAME = 'libdcp'
 VERSION = '0.04pre'
@@ -43,10 +44,13 @@ def dist(ctx):
     ctx.excl = 'TODO core *~ .git build .waf* .lock* doc/*~ src/*~ test/ref/*~'
 
 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'