-
Notifications
You must be signed in to change notification settings - Fork 0
/
uniprcsimversion.py
64 lines (60 loc) · 2.3 KB
/
uniprcsimversion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
##################################
#
# uniprcsimversion.py
# Copyright (C) Louisiana State University, Health Sciences Center
# Written by 2011-2013 Ruben Tikidji-Hamburyan <[email protected]>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
# NON INFRINGEMENT. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
###################################
MAJOR=0
MINOR=0
PATCH=52
DATE="20150109"
def getversion():
return "%d.%02d.%04d"%(MAJOR,MINOR,PATCH)
def getlongversion():
#TODO: add here some information
return "uniPRCsim version %d.%02d.%04d (%s)\n\nCopyright: LSUHSC 2011 - 2015\n\nCredits:\n Ruben Tikidji-Hamburyan <[email protected]>\n Will Coleman <[email protected]>\n\n"%(MAJOR,MINOR,PATCH,DATE)
if __name__ == "__main__":
import time, re, os, sys
DATE = time.strftime("%Y%m%d",time.localtime())
fdr = open ("uniprcsimversion.py", "r")
fdw = open ("nuniprcsimversion.py", "w")
for line in fdr.readlines():
fdw.write( re.sub("^DATE=\"\\d*\"","DATE=\"%s\""%DATE, line ) )
fdr.close()
fdw.close()
os.rename("nuniprcsimversion.py","uniprcsimversion.py")
import uniprcsimversion
if os.system("zip -9 updates/uniPRCsim-update%s.z *.py"%getversion()):
sys.stderr.write("Cannot create zip file\n\n")
sys.exit(1)
if os.system("git commit -a"):
sys.stderr.write("Cannot commit current version\n\n")
sys.exit(1)
if os.system("git tag \\\"v%s\\\""%getversion()):
sys.stderr.write("Cannot tag current version\n\n")
sys.exit(1)
PATCH += 1
fdr = open ("uniprcsimversion.py", "r")
fdw = open ("nuniprcsimversion.py", "w")
for line in fdr.readlines():
fdw.write( re.sub("^PATCH=\\d*", "PATCH=%d"%PATCH,line ) )
fdr.close()
fdw.close()
os.rename("nuniprcsimversion.py","uniprcsimversion.py")