summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-16 23:51:19 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-16 23:51:19 +0100
commit65470d9a8ee57b19271f65324d7a8ab0c00960f2 (patch)
tree5e73d722ecb43c146f49f4abf19c1f27655f612b /wscript
parentd761439a7a8a3d6f78232a426bf1e54dff55f229 (diff)
Try to preserve git revision in waf dist-ed packages.
Diffstat (limited to 'wscript')
-rw-r--r--wscript28
1 files changed, 22 insertions, 6 deletions
diff --git a/wscript b/wscript
index 7c196e954..822a3b869 100644
--- a/wscript
+++ b/wscript
@@ -217,20 +217,36 @@ def build(bld):
bld.add_post_fun(post)
+def git_revision():
+ if not os.path.exists('.git'):
+ return None
+
+ 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')
+ return o.replace ("commit ", "")[0:10]
+
def dist(ctx):
+ r = git_revision()
+ if r is not None:
+ f = open('.git_revision', 'w')
+ print >>f,r
+ f.close()
+
ctx.excl = """
TODO core *~ src/wx/*~ src/lib/*~ builds/*~ doc/manual/*~ src/tools/*~ *.pyc .waf* build .git
deps alignment hacks sync *.tar.bz2 *.exe .lock* *build-windows doc/manual/pdf doc/manual/html
GRSYMS GRTAGS GSYMS GTAGS
"""
+
def create_version_cc(version, cxx_flags):
- 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 = git_revision()
+ if commit is None and os.path.exists('.git_revision'):
+ f = open('.git_revision')
+ commit = f.readline().strip()
+
+ if commit is None:
commit = 'release'
try: