summaryrefslogtreecommitdiff
path: root/src/update_pyparsing_timestamp.py
blob: 80ea3d457c4dd1f1d4323d763cc8cdeeea8542cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from pyparsing import quotedString
from datetime import datetime

nw = datetime.utcnow()
nowstring = '"%s"' % (nw.strftime("%d %b %Y %X")[:-3] + " UTC")
print (nowstring)

quoted_time = quotedString()
quoted_time.setParseAction(lambda: nowstring)

version_time = "__versionTime__ = " + quoted_time
with open('pyparsing.py') as oldpp:
    new_code = version_time.transformString(oldpp.read())

with open('pyparsing.py','w') as newpp:
    newpp.write(new_code)