Added --version flag to wmllint, wmlscope and wmlindent
Also made GUI.pyw report the version in the about dialog. Fixes #6346
This commit is contained in:
parent
b916fa69ca
commit
b0d3097a62
7 changed files with 42 additions and 8 deletions
|
@ -72,6 +72,7 @@
|
|||
* Removed support for writing BMP screenshots (PR #6206).
|
||||
* Password storage was fixed to work with multiple accounts (PR #6290)
|
||||
* wmllint now automatically removes {MAGENTA_IS_THE_TEAM_COLOR}.
|
||||
* wmllint, wmlscope and wmlindent now support the command line `--version` flag, which reports the current version of Wesnoth (issue #6346).
|
||||
|
||||
## Version 1.16.0+dev
|
||||
### Add-ons client
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
import sys,os,threading,subprocess,codecs
|
||||
|
||||
import queue
|
||||
|
||||
from wesnoth import version
|
||||
# tkinter modules
|
||||
from tkinter import *
|
||||
from tkinter.messagebox import *
|
||||
|
@ -26,9 +28,8 @@ import tkinter.font as font
|
|||
from tkinter.ttk import *
|
||||
|
||||
# we need to know in what series we are
|
||||
# so set it in a constant and change it for every new series
|
||||
# it must be a string
|
||||
WESNOTH_SERIES="1.17"
|
||||
# so set it in a constant string
|
||||
WESNOTH_SERIES="{}.{}".format(version.major, version.minor)
|
||||
|
||||
# get the location where the script is placed
|
||||
# we'll check later if this is a Wesnoth directory
|
||||
|
@ -1427,9 +1428,11 @@ Error code: {1}
|
|||
def on_about(self):
|
||||
showinfo("About Maintenance tools GUI","""© Elvish_Hunter, 2014-2016
|
||||
|
||||
Version: {}
|
||||
|
||||
Part of The Battle for Wesnoth project and released under the GNU GPL v2 license
|
||||
|
||||
Icons are taken from the Tango Desktop Project (http://tango.freedesktop.org), and are released in the Public Domain""")
|
||||
Icons are taken from the Tango Desktop Project (http://tango.freedesktop.org), and are released in the Public Domain""".format(version.as_string))
|
||||
|
||||
def on_quit(self):
|
||||
# check if the text widget contains something
|
||||
|
|
|
@ -5,7 +5,7 @@ are for checking, analysing and maintenance of WML-files.
|
|||
|
||||
The modules intended to be imported by other programs are
|
||||
documented in the parent directory's README.md. These are
|
||||
wmltools3.py, wmldata.py, wmlparser.py, wmlparser3.py, and
|
||||
version.py, wmltools3.py, wmldata.py, wmlparser.py, wmlparser3.py and
|
||||
wmliterator3.py.
|
||||
|
||||
`__init__.py`
|
||||
|
@ -14,6 +14,10 @@ wmliterator3.py.
|
|||
`campaignserver_client.py`
|
||||
textmode-client for uploading + downloding campaigns to the server.
|
||||
|
||||
`version.py`
|
||||
This module reports the current version of Wesnoth to any script which
|
||||
might need it.
|
||||
|
||||
`wescamp.py`
|
||||
This utility provides two tools
|
||||
* sync a campaign with the version on wescamp (using the packed campaign
|
||||
|
|
15
data/tools/wesnoth/version.py
Executable file
15
data/tools/wesnoth/version.py
Executable file
|
@ -0,0 +1,15 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
major = 1
|
||||
minor = 17
|
||||
release = 0
|
||||
dev_suffix = "-dev" # either use "+dev", "-dev", "" (empty string) or None
|
||||
|
||||
as_string = "{}.{}.{}{}".format(major,
|
||||
minor,
|
||||
release,
|
||||
dev_suffix if dev_suffix else "")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("WML Tools version module")
|
||||
print("Version:", as_string)
|
|
@ -63,6 +63,7 @@ indent already zero; these two conditions strongly suggest unbalanced WML.
|
|||
|
||||
import sys, os, argparse, filecmp, re, codecs, signal
|
||||
from wesnoth import wmltools3 as wmltools
|
||||
from wesnoth import version
|
||||
|
||||
closer_prefixes = ["{NEXT "]
|
||||
opener_prefixes = ["{FOREACH "]
|
||||
|
@ -310,10 +311,13 @@ def sigint_handler(signal, frame):
|
|||
if __name__ == '__main__':
|
||||
signal.signal(signal.SIGINT, sigint_handler)
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawTextHelpFormatter
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
prog="wmlindent"
|
||||
)
|
||||
parser.add_argument("-?", action="help",
|
||||
help="show this help message and exit") # original --help, -h and -? printed __doc__
|
||||
parser.add_argument("--version", action="version",
|
||||
version="%(prog)s " + version.as_string)
|
||||
parser.add_argument("-d", "--dryrun", action="store_true",
|
||||
help="""detects and reports files that would be changed without
|
||||
changing them.""")
|
||||
|
|
|
@ -194,6 +194,7 @@ import sys, os, re, argparse, string, copy, difflib, time, gzip, codecs
|
|||
from wesnoth.wmltools3 import *
|
||||
from wesnoth.wmliterator3 import *
|
||||
from collections import defaultdict
|
||||
from wesnoth import version
|
||||
|
||||
# Changes meant to be done on maps and .cfg lines.
|
||||
mapchanges = (
|
||||
|
@ -3202,7 +3203,8 @@ Also validates WML to check for errors.''',
|
|||
positive warnings with magic comments, read the introduction in the wmllint
|
||||
file itself.
|
||||
See also: https://wiki.wesnoth.org/Maintenance_tools.''',
|
||||
formatter_class = argparse.RawTextHelpFormatter
|
||||
formatter_class = argparse.RawTextHelpFormatter,
|
||||
prog="wmllint"
|
||||
)
|
||||
|
||||
mode = parser.add_mutually_exclusive_group()
|
||||
|
@ -3236,6 +3238,8 @@ scenarios, etc.""")
|
|||
help="""Any number of directories. Each directory is converted.
|
||||
If no directories are specified, acts on the current
|
||||
directory.""")
|
||||
parser.add_argument("--version", action="version",
|
||||
version="%(prog)s " + version.as_string)
|
||||
|
||||
namespace = parser.parse_args()
|
||||
clean = namespace.clean
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
|
||||
import sys, os, time, re, argparse, hashlib, glob, codecs
|
||||
from wesnoth.wmltools3 import *
|
||||
from wesnoth import version
|
||||
|
||||
def interpret(lines, css):
|
||||
"Interpret the ! convention for .cfg comments."
|
||||
|
@ -421,7 +422,7 @@ class CrossRefLister(CrossRef):
|
|||
fp.write(outstr)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser = argparse.ArgumentParser(prog="wmlscope")
|
||||
parser.add_argument("-c", "--crossreference", action="store_true",
|
||||
help="Report resolved macro references (implies -w 1)")
|
||||
parser.add_argument("-C", "--collisions", action="store_true",
|
||||
|
@ -455,6 +456,8 @@ if __name__ == "__main__":
|
|||
parser.add_argument("directories", action="store", nargs="*",
|
||||
help="""Any number of directiories to check. If no
|
||||
directories are given, all files under the current directory are checked.""")
|
||||
parser.add_argument("--version", action="version",
|
||||
version="%(prog)s " + version.as_string)
|
||||
namespace = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue