Avoid false positives on the string "mask" in cfg text.

This commit is contained in:
Eric S. Raymond 2007-11-07 15:06:26 +00:00
parent c901ff5f8e
commit 8e13bd3e95

View file

@ -1102,7 +1102,7 @@ def translator(filename, mapxforms, textxform):
# Ignore all-caps macro arguments.
if refname == refname.upper():
refname = None
if 'mask' in line and refname and not refname.endswith(".mask"):
if 'mask=' in line and refname and not refname.endswith(".mask"):
print >>sys.stderr, \
'"%s", line %d: fatal error, mask file without .mask extension (%s)' \
% (filename, lineno+1, refname)
@ -1304,13 +1304,11 @@ def translator(filename, mapxforms, textxform):
else:
return None
ignore = (".tgz", ".png", ".jpg", "-bak")
def interesting(fn):
"Is a file interesting for conversion purposes?"
return fn.endswith(".cfg") or fn.endswith(".map") \
or ("maps" in fn and fn[-4:] not in ignore) \
or is_map(fn)
if fn.endswith("~") or fn[-4:] in (".tgz", ".png", ".jpg", "-bak"):
return False
return fn.endswith(".cfg") or is_map(fn)
def allcfgfiles(dir):
"Get the names of all interesting files under dir."