From a33370622510fb3f312516ef602d57743d91bea0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 20 Jul 2012 14:18:43 +0100 Subject: Tweak version stuff. --- .gitignore | 2 +- src/git_commit.h | 6 ------ src/version.h | 7 +++++++ src/wscript | 4 ++-- wscript | 13 +++++++------ 5 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 src/git_commit.h create mode 100644 src/version.h diff --git a/.gitignore b/.gitignore index f9e62ff5..e32ab30c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ build .lock* doc/html doc/latex -src/git_commit.cc +src/version.cc diff --git a/src/git_commit.h b/src/git_commit.h deleted file mode 100644 index 377fefbb..00000000 --- a/src/git_commit.h +++ /dev/null @@ -1,6 +0,0 @@ - -namespace libdcp { - -extern char const * git_commit; - -} diff --git a/src/version.h b/src/version.h new file mode 100644 index 00000000..7fd9dc25 --- /dev/null +++ b/src/version.h @@ -0,0 +1,7 @@ + +namespace libdcp { + +extern char const * version; +extern char const * git_commit; + +} diff --git a/src/wscript b/src/wscript index 85ac80da..58390837 100644 --- a/src/wscript +++ b/src/wscript @@ -12,7 +12,7 @@ def build(bld): picture_asset.cc util.cc metadata.cc - git_commit.cc + version.cc test_mode.cc """ @@ -22,7 +22,7 @@ def build(bld): types.h exceptions.h test_mode.h - git_commit.h + version.h """ bld.install_files('${PREFIX}/include/libdcp', headers) diff --git a/wscript b/wscript index b70a8e2d..b380dd8d 100644 --- a/wscript +++ b/wscript @@ -27,7 +27,7 @@ def configure(conf): conf.recurse('asdcplib') def build(bld): - create_stored_commit() + create_version_cc(VERSION) bld(source = 'libdcp.pc.in', version = VERSION, @@ -42,19 +42,20 @@ def build(bld): def dist(ctx): ctx.excl = 'TODO core *~ .git build .waf* .lock* doc/*~ src/*~ test/ref/*~' -def create_stored_commit(): +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] try: - text = '#include "git_commit.h"\n' + text = '#include "version.h"\n' text += 'char const * libdcp::git_commit = \"%s\";\n' % commit - print('Writing git commit info to src/git_commit.cc') - o = open('src/git_commit.cc', 'w') + text += 'char const * libdcp::version = \"%s\";\n' % version + print('Writing version information to src/version.cc') + o = open('src/version.cc', 'w') o.write(text) o.close() except IOError: - print('Could not open src/git_commit.cc for writing\n') + print('Could not open src/version.cc for writing\n') sys.exit(-1) -- cgit v1.2.3