Mercurial > atc
changeset 52:b1856c4c46a3
version generating script
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 01 Jun 2007 03:47:47 -0400 |
parents | aa52a1aa1034 |
children | 9c679ea4d8b6 |
files | .hgignore Makefile atcgame/mainmenu.py scripts/gen-ver-string.sh |
diffstat | 4 files changed, 31 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Jun 01 03:28:12 2007 -0400 +++ b/.hgignore Fri Jun 01 03:47:47 2007 -0400 @@ -1,3 +1,3 @@ \.pyc$ \.py~$ - +__version__\.py$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Fri Jun 01 03:47:47 2007 -0400 @@ -0,0 +1,4 @@ +.PHONY: all + +all: + @./scripts/gen-ver-string.sh
--- a/atcgame/mainmenu.py Fri Jun 01 03:28:12 2007 -0400 +++ b/atcgame/mainmenu.py Fri Jun 01 03:47:47 2007 -0400 @@ -13,8 +13,6 @@ # * GNU General Public License for more details. # */ -version = "0.10-pre2" - try: import os import sys @@ -25,6 +23,8 @@ import utils import colors + + import __version__ except ImportError, err: print "Couldn't load module %s" % (err) sys.exit() @@ -38,7 +38,7 @@ # Init pygame.init() screen = pygame.display.set_mode(size) - pygame.display.set_caption('Air Traffic Controller (' + version + ')') + pygame.display.set_caption('Air Traffic Controller (' + __version__.version + ')') # background music try:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/gen-ver-string.sh Fri Jun 01 03:47:47 2007 -0400 @@ -0,0 +1,23 @@ +#!/bin/sh + + +l=`hg tags|head -n +2|tail -1|sed -e 's/\([^ ]\+\)[ ]\+[0-9]\+:\([0-9a-f]\{8\}\).*/\1 \2/'` + +tagname=`echo $l | cut -d' ' -f1` +taghash=`echo $l | cut -d' ' -f2` + +idhash=`hg id | cut -d' ' -f1` + +[ "$idhash" != "$taghash" ] && tagname="$tagname-$idhash" + +cat > tmp.$$ << DONE +#This file is automatically generated + +version="$tagname" +DONE + +echo " VERSION = $tagname" + +diff tmp.$$ atcgame/__version__.py > /dev/null +[ $? -ne 0 ] && mv tmp.$$ atcgame/__version__.py +rm -f tmp.$$