update_revnum.py
32 lines
| 711 B
| text/x-python
|
PythonLexer
/ tools / update_revnum.py
ville
|
r988 | #!/usr/bin/env python | ||
Brian Granger
|
r2146 | """Change the revision number in release.py | ||
Fernando Perez
|
r2118 | |||
Brian Granger
|
r2146 | This edits in-place release.py to update the revision number from bzr info. | ||
Fernando Perez
|
r2118 | |||
Usage: | ||||
./update_revnum.py""" | ||||
ville
|
r988 | |||
import os | ||||
Fernando Perez
|
r2118 | import pprint | ||
import re | ||||
ville
|
r988 | |||
Fernando Perez
|
r2118 | from toollib import * | ||
ville
|
r988 | |||
Fernando Perez
|
r2118 | if __name__ == '__main__': | ||
ver = version_info() | ||||
Ville M. Vainio
|
r1072 | |||
Fernando Perez
|
r2118 | pprint.pprint(ver) | ||
ville
|
r988 | |||
Brian Granger
|
r2146 | rfile = open('../IPython/core/release.py','rb').read() | ||
Fernando Perez
|
r2118 | newcont = re.sub(r'revision\s*=.*', | ||
"revision = '%s'" % ver['revno'], | ||||
rfile) | ||||
Ville M. Vainio
|
r1072 | |||
Fernando Perez
|
r2118 | newcont = re.sub(r'^branch\s*=[^=].*', | ||
"branch = '%s'" % ver['branch-nick'], | ||||
newcont) | ||||
Ville M. Vainio
|
r1072 | |||
Brian Granger
|
r2146 | f = open('../IPython/core/release.py','wb') | ||
Fernando Perez
|
r2118 | f.write(newcont) | ||
f.close() | ||||