source: trunk/anuga_core/source/anuga/get_version.py @ 9480

Last change on this file since 9480 was 9234, checked in by steve, 10 years ago

updating version.py

File size: 1.1 KB
Line 
1"""Obtain the latest revision number and date from Subversion.
2
3Using the tool SubWCRev.exe on the download page on the SVN website or in the TortoiseSVN Folder under bin.
4
5To create run
6
7#SubWCRev.exe path\to\working\copy version.in version.h
8SubWCRev.exe . ver.txt ver.py
9
10FIXME: Works only under Win32
11
12Ex:
13version = 1798
14status = 'Modified'
15date = '2005/09/07 13:22:59'
16
17"""
18
19
20
21template = 'version.txt'
22version = 'version.py'
23
24#Write out template
25txt = """version = $WCREV$
26status = '$WCMODS?Modified:Not modified$'
27date = '$WCDATE$'
28"""
29
30fid = open(template, 'w')
31fid.write(txt)
32fid.close()
33
34#Run conversion
35import os
36cmd = 'SubWCRev.exe . %s %s' %(template, version)
37#print cmd
38err = os.system(cmd)
39if err != 0:
40    msg = 'Command %s could not execute.'
41    msg += 'Make sure the program SubWCRev.exe is available on your path'
42    raise Exception(msg)
43
44
45
46#Obtain version
47cmd = 'from %s import version, status, date' %version[:-3]
48#print cmd
49exec(cmd)
50
51print 'Version: %d' %version
52print 'Date: %s' %date
53print 'Status: %s' %status
54
55
Note: See TracBrowser for help on using the repository browser.