Guard the code that tries to move and rename map files with a platform check,
so we don't try to do things under Windows that will choke it.
This commit is contained in:
parent
1ea876fa28
commit
8f9d9f735d
1 changed files with 13 additions and 7 deletions
|
@ -26,7 +26,7 @@
|
|||
# have a single subdirectory that mixes old-style and new-style
|
||||
# terrain coding it might get confused.
|
||||
#
|
||||
# Note: You can shut wmmlint up about custom terrains by havung a comment
|
||||
# Note: You can shut wmllint up about custom terrains by having a comment
|
||||
# on the same line that includes the string "wmllint: ignore".
|
||||
|
||||
import sys, os, re, getopt, string, copy, difflib, time
|
||||
|
@ -571,7 +571,7 @@ def translator(filename, mapxforms, textxform):
|
|||
refre = re.compile(r"\{@?([^A-Z].*)\}").search(line)
|
||||
if refre:
|
||||
mapfile = refre.group(1)
|
||||
if not mapfile.endswith(".map") and modified_maps.get(mapfile)==False:
|
||||
if not mapfile.endswith(".map") and modified_maps.get(mapfile)==False and not windows:
|
||||
newline = newline.replace(mapfile, mapfile + ".map")
|
||||
newdata.append(newline + terminator)
|
||||
if newline != line:
|
||||
|
@ -706,6 +706,11 @@ if __name__ == '__main__':
|
|||
elif switch in ('-r', '--revert'):
|
||||
revert = True
|
||||
|
||||
# Check to see if we're on Windows. If so, shellouts to mv and rm
|
||||
# and the svn command-line client won't work, so we suppress the
|
||||
# normal behavior of renaming old-style mapfiles.
|
||||
windows = sys.platform.startswith("win")
|
||||
|
||||
if clean and revert:
|
||||
sys.stderr.write("wmllint: can't do clean and revert together.\n")
|
||||
sys.exit(1)
|
||||
|
@ -885,10 +890,11 @@ if __name__ == '__main__':
|
|||
(exc_type, exc_value, exc_traceback) = sys.exc_info()
|
||||
raise exc_type, exc_value, exc_traceback
|
||||
# Time for map file renames
|
||||
if not fn.endswith(".map") and modified_maps.get(fn) == False:
|
||||
mover = vcmove(fn, fn + ".map")
|
||||
print mover
|
||||
if not dryrun:
|
||||
os.system(mover)
|
||||
if not windows:
|
||||
if not fn.endswith(".map") and modified_maps.get(fn) == False:
|
||||
mover = vcmove(fn, fn + ".map")
|
||||
print mover
|
||||
if not dryrun:
|
||||
os.system(mover)
|
||||
|
||||
# wmllint ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue