Remove remaining version check

This commit is contained in:
Eric S. Raymond 2008-02-01 15:49:44 +00:00
parent a238951ca7
commit b55fd6f648

View file

@ -1214,44 +1214,6 @@ def hack_syntax(filename, lines):
specials.append(value)
lastspecial = i
lines[i] = ""
# Upconvert old radius usage
if "1.3.7" in versions and "older" not in versions:
radius_pos = wmlfind("radius=", WmlIterator(lines, filename))
while radius_pos is not None:
scopeIter = radius_pos.iterScope()
startline = scopeIter.lineno + 1
wspace = radius_pos.text
wspace = wspace[:len(wspace)-len(wspace.lstrip())]
radius_danger = False
to_indent = []
no_indent = []
insideElem = 0
for i in scopeIter:
elem = i.element
if elem in ("[and]", "[or]", "[not]"):
radius_danger = True
no_indent.extend(txt+'\n' for txt in i.text.splitlines())
insideElem += 1
elif insideElem:
if elem in ("[/and]", "[/or]", "[/not]"):
insideElem -= 1
no_indent.extend(txt+'\n' for txt in i.text.splitlines())
elif elem in ("variable=", "side=", "count=", "adjacent="):
no_indent.extend(txt+'\n' for txt in i.text.splitlines())
else:
to_add = [txt+'\n' for txt in i.text.splitlines()]
to_add[0] = baseindent + to_add[0]
to_indent.extend(to_add)
if radius_danger:
lines = lines[:startline] + [wspace + "[and]\n"] + to_indent +[
wspace + "[/and]\n"] + no_indent + lines[scopeIter.lineno:]
radius_pos.lines = lines
modcount += 1
#backup to rescan
radius_pos.seek(startline-1)
#pass the inserted content
radius_pos.seek(startline+len(to_indent)+1)
radius_pos = wmlfind("radius=", radius_pos)
# Boucmanize death animations
if future:
in_death = None
@ -1687,6 +1649,7 @@ Usage: wmllint [options] [dir]
Options may be any of these:
-h, --help Emit this help message and quit.
-d, --dryrun List changes but don't perform them.
-n, --nolift Don't perform version-lifting
-v, --verbose -v lists changes.
-v -v names each file before it's processed.
-v -v -v shows verbose parse details.
@ -1709,6 +1672,7 @@ if __name__ == '__main__':
"revert",
"diffs",
"stripcr",
"nolift",
])
except getopt.GetoptError:
help()
@ -1720,6 +1684,7 @@ if __name__ == '__main__':
diffs = False
revert = False
stripcr = False
upconvert = True
for (switch, val) in options:
if switch in ('-h', '--help'):
help()
@ -1739,6 +1704,8 @@ if __name__ == '__main__':
revert = True
elif switch in ('-s', '--stripcr'):
stripcr = True
elif switch in ('-n', '--nolift'):
upconvert = False
if clean and revert:
sys.stderr.write("wmllint: can't do clean and revert together.\n")
sys.exit(1)
@ -1763,6 +1730,8 @@ if __name__ == '__main__':
def texttransform(filename, lineno, line):
"Resource-name transformation on text lines."
if not upconvert:
return line
transformed = line
# First, do resource-file moves
if "wmllint: noconvert" not in line:
@ -1850,20 +1819,17 @@ if __name__ == '__main__':
print msg
return transformed
if "1.3.1" in versions and "older" not in versions:
maptransforms = [maptransform2]
else:
if upconvert:
maptransforms = [maptransform1, maptransform2]
else:
maptransforms = []
if not arguments:
arguments = ["."]
for dir in arguments:
ofp = None
if "older" in versions:
lock_terrain_coding = None
else:
lock_terrain_coding = "newstyle"
lock_terrain_coding = None
for fn in allcfgfiles(dir):
if verbose >= 2:
print fn + ":"