diff options
Diffstat (limited to 'wscript')
| -rw-r--r-- | wscript | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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) |
