[wmlunits] Try to make it robust enough again to survive user-made WML.
This commit is contained in:
parent
a42f90daaa
commit
c51f7b701f
2 changed files with 15 additions and 3 deletions
|
@ -57,6 +57,9 @@ def blacklist_if_faulty(wml, d):
|
|||
return False
|
||||
|
||||
def check_runaway():
|
||||
|
||||
campaigns = {}
|
||||
|
||||
udir = get_userdir() + "/data/add-ons"
|
||||
g.p = wmlparser2.Parser(options.wesnoth, options.config_dir,
|
||||
options.data_dir, no_preprocess = False)
|
||||
|
@ -108,6 +111,9 @@ def check_runaway():
|
|||
print("***")
|
||||
print("")
|
||||
ok = False
|
||||
|
||||
if ok:
|
||||
campaigns[name] = g.p.get_all(tag = "campaign")
|
||||
|
||||
move(udir, options.runaway, name)
|
||||
|
||||
|
@ -117,14 +123,19 @@ def check_runaway():
|
|||
|
||||
print("\n%d/%d addons passed runaway test. Trying to parse them." % (
|
||||
len(passed), len(total)))
|
||||
|
||||
|
||||
parsed = []
|
||||
for name in passed:
|
||||
print("__________\nParsing " + name)
|
||||
move(options.runaway, udir, name)
|
||||
|
||||
|
||||
ok = True
|
||||
errors = parse_test("{multiplayer}{~add-ons}", "MULTIPLAYER")
|
||||
campaign = campaigns[name]
|
||||
if campaign and campaign[0].get_text_val("define", None):
|
||||
errors = parse_test("{~add-ons}",
|
||||
campaign[0].get_text_val("define", ""))
|
||||
else:
|
||||
errors = parse_test("{multiplayer}{~add-ons}", "MULTIPLAYER")
|
||||
if errors:
|
||||
print(errors)
|
||||
ok = False
|
||||
|
|
|
@ -40,6 +40,7 @@ class Translation:
|
|||
self.langcode = langcode
|
||||
class Dummy:
|
||||
def ugettext(self, x):
|
||||
if not x: return ""
|
||||
caret = x.find("^")
|
||||
if caret < 0: return x
|
||||
return x[caret + 1:]
|
||||
|
|
Loading…
Add table
Reference in a new issue