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