annotate publish.py @ 10:c87ec78f1fae

Auto-update and revision number reporting added
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 12 Mar 2010 23:53:27 +0000
parents
children 231e3317477d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
1 #! /usr/bin/python
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
2 # Copyright (c) 2009-2010 Chortos-2 <chortos@inbox.lv>
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
3
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
4 with open('test.py') as t:
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
5 f = t.read()
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
6 i = f.find('# $Rev: ')
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
7 j = f.find('\n', i)
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
8 rev = f[i+8:j-1]
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
9 f = f[0:i] + f[j+1:]
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
10 f = f.replace('$$REV$$', rev)
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
11 with open('test-pub.py', 'wb') as t:
c87ec78f1fae Auto-update and revision number reporting added
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
12 t.write(f)