Teach wmllint how to catch truncated sound-file names.

This commit is contained in:
Eric S. Raymond 2009-09-04 04:22:17 +00:00
parent 67678fb1da
commit 617ed57222
4 changed files with 10 additions and 11 deletions

View file

@ -3,7 +3,7 @@
id=dwarven_mines
name= _ "To the Mines"
{INTRO_AND_SCENARIO_MUSIC "traveling_minstrels" "wanderer.ogg"}
{INTRO_AND_SCENARIO_MUSIC "traveling_minstrels.ogg" "wanderer.ogg"}
{EXTRA_SCENARIO_MUSIC "nunc_dimittis.ogg"}
{EXTRA_SCENARIO_MUSIC "loyalists.ogg"}

View file

@ -19,11 +19,6 @@ lint:
# Check for obsolete WML, broken references, consistency.
./wmllint --dryrun $(MAINLINE) $(UMC)
lint-low:
# Check for obsolete WML, broken references, consistency.
./wmllint --dryrun $(DATA)/core $(DATA)/campaigns/Legend_of_Wesmere
unresolved:
@echo "# Report on unresolved macro calls and resource references"
@./wmlscope --unresolved $(MAINLINE) $(UMC)

View file

@ -5,7 +5,10 @@ wmltools.py -- Python routines for working with a Battle For Wesnoth WML tree
import sys, os, re, sre_constants, hashlib, glob, gzip
resource_extensions = ("png", "jpg", "jpeg", "ogg", "wav", "map", "mask")
map_extensions = ("map", "mask")
image_extensions = ("png", "jpg", "jpeg")
sound_extensions = ("ogg", "wav")
resource_extensions = map_extensions + image_extensions + sound_extensions
image_reference = r"[A-Za-z0-9{}.][A-Za-z0-9_/+{}.-]*\.(png|jpg)(?=(~.*)?)"
def pop_to_top(whoami):
@ -84,7 +87,7 @@ class Forest:
subtree.sort(lambda x, y: cmp(x, y) - 2*int(x.endswith("_main.cfg")) + 2*int(y.endswith("_main.cfg")))
self.forest.append(subtree)
for i in range(len(self.forest)):
# Ignore versiuon-control subdirectories and Emacs tempfiles
# Ignore version-control subdirectories and Emacs tempfiles
self.forest[i] = filter(lambda x: ".svn" not in x and ".git" not in x and '.#' not in x, self.forest[i])
self.forest[i] = filter(lambda x: not os.path.isdir(x), self.forest[i])
if exclude:
@ -158,7 +161,7 @@ def formaltype(f):
ftype = "string"
elif f.endswith("IMAGE") or f == "PROFILE":
ftype = "image"
elif f in ("MUSIC",) or f.endswith("SOUND"):
elif f.endswith("MUSIC",) or f.endswith("SOUND"):
ftype = "sound"
elif f in ("FILTER",):
ftype = "filter"
@ -212,12 +215,12 @@ def argmatch(formals, actuals):
if len(formals) != len(actuals):
return False
for (f, a) in zip(formals, actuals):
ftype = formaltype(f)
atype = actualtype(a)
# Here's the compatibility logic. First, we catch the situations
# in which a more restricted actual type matches a more general
# formal one. Then we have a fallback rule checking for type
# equality or wildcarding.
ftype = formaltype(f)
atype = actualtype(a)
if ftype == "any":
pass
elif atype in ("filter", "empty") and ftype == "wml":

View file

@ -7,6 +7,7 @@
# This tool cross-references macro definitions with macro calls, and
# resource (sound or image) files with uses of the resources in WML.
# and generates various useful reports from such cross-references.
# It also checks actual macro arguments against types implied by the formals
#
# (Most of the work is done by a cross-referencer class that is also
# used elsewhere, e.g. by wmlmove.)