view 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
line wrap: on
line source

#! /usr/bin/python
# Copyright (c) 2009-2010 Chortos-2 <chortos@inbox.lv>

with open('test.py') as t:
	f = t.read()
i = f.find('# $Rev: ')
j = f.find('\n', i)
rev = f[i+8:j-1]
f = f[0:i] + f[j+1:]
f = f.replace('$$REV$$', rev)
with open('test-pub.py', 'wb') as t:
	t.write(f)