mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 20:59:29 +00:00
Ported umc_dev/build/update_version to Python 3
This commit is contained in:
parent
6d60cc550e
commit
af64a10d50
@ -53,7 +53,8 @@
|
||||
* Fix infinite recursion in SUF with [hides] and [filter_vision]. (Issue#1389)
|
||||
### Miscellaneous and bug fixes
|
||||
* Fixed :droid's arguments not all being optional (Issue#4308)
|
||||
* Ported the "expand-terrain-macros", "wmlflip" and "wmlparser" tools to Python 3
|
||||
* Ported the "expand-terrain-macros", "wmlflip", "wmlparser" and "umc-dev/build/update_version"
|
||||
tools to Python 3
|
||||
* It's now possible to chat with oneself in SP campaigns. Chat is shown in replays. (Issue#1111)
|
||||
* Removed unused "scoutDefault", "journeylifter", "wescamp_import" and "wmlvalidator" Python tools
|
||||
* Fixed wmlscope not correctly performing expansion of square braces in filenames in some conditions
|
||||
|
28
utils/umc_dev/build/update_version
Normal file → Executable file
28
utils/umc_dev/build/update_version
Normal file → Executable file
@ -1,25 +1,27 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
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"]
|
||||
usage = """usage: update_version current_version new_version
|
||||
e.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
|
||||
print(usage)
|
||||
else:
|
||||
print "Replacing version ", sys.argv[1], " with ", sys.argv[2], "..."
|
||||
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()
|
||||
print("Processing: ", sourcePath)
|
||||
with open(sourcePath) as infile, open(targetPath, "w") as outfile:
|
||||
for line in infile:
|
||||
outfile.write(line.replace(stext, rtext))
|
||||
shutil.move (targetPath, sourcePath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user