mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 11:04:14 +00:00

It's mostly about making the scripts run if python defaults to python3. Has been tested for each script.
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
#!/usr/bin/env python2
|
|
import os, sys, shutil
|
|
base_path = os.path.dirname(os.path.realpath(__file__))
|
|
usage = "usage: update_version current_version new_version \ne.g.: update_version 2.0.0 2.0.1"
|
|
files = ["org.wesnoth.dependencies.feature/feature.xml", "org.wesnoth.feature/category.xml", "org.wesnoth.feature/feature.xml",
|
|
"org.wesnoth.ui/META-INF/MANIFEST.MF","org.wesnoth/META-INF/MANIFEST.MF", "org.wesnoth/org.wesnoth.product"]
|
|
|
|
if len(sys.argv) < 3:
|
|
print usage
|
|
else:
|
|
print "Replacing version ", sys.argv[1], " with ", sys.argv[2], "..."
|
|
stext = sys.argv[1] + ".qualifier"
|
|
rtext = sys.argv[2] + ".qualifier"
|
|
for file in files:
|
|
sourcePath = os.path.join(os.path.join(base_path, ".."), file)
|
|
targetPath = os.path.join(os.path.join(base_path, ".."), file + ".tmp")
|
|
|
|
print "Processing: ", sourcePath
|
|
input = open(sourcePath)
|
|
output = open(targetPath, "wb")
|
|
for s in input.xreadlines():
|
|
output.write(s.replace(stext, rtext))
|
|
input.close()
|
|
output.close()
|
|
shutil.move (targetPath, sourcePath)
|