diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-20 14:18:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-20 14:18:43 +0100 |
| commit | a33370622510fb3f312516ef602d57743d91bea0 (patch) | |
| tree | 5125ab7ef23f2aeb1081184c2c1a5a18b4613783 | |
| parent | ef87598f25bbb92702d235a7f4e53a31a2324556 (diff) | |
Tweak version stuff.
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | src/version.h (renamed from src/git_commit.h) | 1 | ||||
| -rw-r--r-- | src/wscript | 4 | ||||
| -rw-r--r-- | wscript | 13 |
4 files changed, 11 insertions, 9 deletions
@@ -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/version.h index 377fefbb..7fd9dc25 100644 --- a/src/git_commit.h +++ b/src/version.h @@ -1,6 +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) @@ -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) |
