RetroArch/pkg/android/phoenix/version_increment.py

21 lines
626 B
Python
Raw Normal View History

#!/usr/bin/python
import time
from xml.dom.minidom import parse
dom1 = parse("AndroidManifest.xml")
oldVersion = dom1.documentElement.getAttribute("android:versionCode")
versionNumbers = oldVersion.split('.')
2016-03-19 18:18:06 +00:00
versionName = dom1.documentElement.getAttribute("android:versionName")
2016-03-20 16:46:26 +00:00
versionName = versionName + "_GIT"
2016-03-19 18:18:06 +00:00
versionNumbers[-1] = unicode(int(time.time()))
dom1.documentElement.setAttribute("android:versionCode", u'.'.join(versionNumbers))
2016-03-19 18:18:06 +00:00
dom1.documentElement.setAttribute("android:versionName", versionName)
with open("AndroidManifest.xml", 'wb') as f:
for line in dom1.toxml("utf-8"):
f.write(line)