From e9d7dd160f5b96fe617fa786978a4e8a7c59bb6c Mon Sep 17 00:00:00 2001 From: Tim Vieira Date: Thu, 25 Jul 2013 14:42:32 -0400 Subject: [PATCH] Makefile maintains a VERSION file from which `./dyna --version` will obtain version information. --- Makefile | 11 ++++++++--- src/Dyna/Backend/Python/main.py | 7 +++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 552f643..0dc5467 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ # -*- indent-tabs-mode:t; -*- -all: deps build sphinxbuild +all: deps build sphinxbuild version + +version: + echo "Version: Dyna 0.4 pre-release" `git describe --all` > VERSION + echo "Build date:" `date` >> VERSION + echo "Commit: https://github.com/nwf/dyna/commit/"`git rev-parse HEAD` >> VERSION upstream: git submodule init @@ -10,8 +15,8 @@ upstream: # cabal install --user external/ekmett-parsers external/ekmett-trifecta deps: - alex --version >/dev/null || cabal install alex - happy --version >/dev/null || cabal install happy + alex --version 2>/dev/null >/dev/null || cabal install alex + happy --version 2>/dev/null >/dev/null || cabal install happy cabal install --user --enable-tests --only-dependencies . build: diff --git a/src/Dyna/Backend/Python/main.py b/src/Dyna/Backend/Python/main.py index 940a2cb..83bae42 100644 --- a/src/Dyna/Backend/Python/main.py +++ b/src/Dyna/Backend/Python/main.py @@ -29,10 +29,9 @@ def main(): if args.version: import subprocess try: - subprocess.Popen("cd %s ; grep '^Version' dyna.cabal" % dynahome, shell=True) - subprocess.Popen("cd %s ; git log -n 1 |grep '^Date' " % dynahome, shell=True) - subprocess.Popen("cd %s ; git log -n 1 |grep '^commit' " % dynahome, shell=True) - except OSError: + print (dynahome / 'VERSION').text() + + except IOError: print 'failed to obtain version info.' exit(0) -- 2.50.1