Author: iwontbecreative
Date: Sat Mar 5 18:32:20 2011
New Revision: 48765
URL: http://svn.gna.org/viewcvs/wesnoth?rev=48765&view=rev
Log:
Remove one useless line. Remove many lines that were too long. Use
triple-quotes when it's clearer.
Modified:
trunk/data/tools/expand-terrain-macros.py
Modified: trunk/data/tools/expand-terrain-macros.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/expand-terrain-macros.py?rev=48765&r1=48764&r2=48765&view=diff
==============================================================================
--- trunk/data/tools/expand-terrain-macros.py (original)
+++ trunk/data/tools/expand-terrain-macros.py Sat Mar 5 18:32:20 2011
@@ -19,16 +19,18 @@
# Meta-Macro syntax:
# #meta-macro BASENAME [{NORMAL_PARAM, OPTIONAL_PARAM} [...]]
#
-# NORMAL_PARAM: Macro parameter that will be passed unmodified to the base
macro
-# OPTIONAL_PARAM: Macro parameter that will sometimes be passed to the base
macro
-# and sometimes be replaced with a default value
-# The script will create one macro for each possible
combination of
-# optional parameters
+# NORMAL_PARAM: Macro parameter that will be passed unmodified to the base
+# macro
+# OPTIONAL_PARAM: Macro parameter that will sometimes be passed to the base
+# macro and sometimes be replaced with a default value. The script will
+# create one macro for each possible combination of optional parameters
#
# Syntax: ABBREV=NAME=DEFAULT
# ABBREV: One letter that is appended to macros taking that argument
-# NAME: Name of the parameter that is used when it's passed to the
base macro
-# ABBREV: Default value that is used when the parameter is not passed
to the base macro
+# NAME: Name of the parameter that is used when it's passed to the
+# base macro
+# ABBREV: Default value that is used when the parameter is not passed
+# to the base macro
#
#
# !!! ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING !!!
@@ -37,18 +39,17 @@
import getopt
def printUsage():
- print
"01234567890123456789012345678901234567890123456789012345678901234567890123456789"
- print "Usage: expand-terrain-macros.py [OPTIONS] filename1 [filename2
[...]]"
- print ""
- print "Options:"
- print " -i Insert the expanded sections into the input file(s)
immediately after"
- print " their macro definitions."
- print " -a Append the expanded sections to the input file(s)"
- print " -r Replace the input file(s) with the resulting output.
Previously generated"
- print " expansions will be removed. Implies -i if nothing else is
specified."
- print ""
- print "If no options are specified, only the expanded sections will be
printed to"
- print "stdout"
+ print "Usage: expand-terrain-macros.py [OPTIONS] filename1\
+ [filename2 [...]]\n"
+ print """Options:
+ -i Insert the expanded sections into the input file(s) immediately after
+ their macro definitions.
+ -a Append the expanded sections to the input file(s)
+ -r Replace the input file(s) with the resulting output. Previously generated
+ expansions will be removed. Implies -i if nothing else is specified.
+
+If no options are specified, only the expanded sections will be printed to
+stdout"""
insert = False
append = False
@@ -87,12 +88,13 @@
f.close()
changed = False
- output=[]
- appended=[]
+ output = []
+ appended = []
autogenerated = False
for line in content:
- if line.strip() == "#The following code is autogenerated by
expand-terrain-macros.py":
+ if line.strip() == "#The following code is autogenerated\
+ by expand-terrain-macros.py":
autogenerated = True
if (insert or append) and not autogenerated:
@@ -104,8 +106,8 @@
if line.startswith('#meta-macro'):
elems = line[12:].strip().split()
basename = elems[0]
- params= []
- optional_params=[]
+ params = []
+ optional_params = []
for param in elems[1:]:
split_param = param.split('=')
@@ -119,16 +121,17 @@
base_macro_suffix = "_" + "".join(optional_params)
- result=[]
- result.append("#The following code is autogenerated by
expand-terrain-macros.py")
+ result = []
+ result.append("#The following code is autogenerated\
+ by expand-terrain-macros.py")
if append:
result.append("#generated from: " + line.strip())
result.append("#Please do not modify")
for i in range(2**len(optional_params) - 2, -1, -1):
- enabled_map = dict([(param, i & (1<<index) != 0) for index,
param in enumerate(optional_params)])
+ enabled_map = dict([(param, i & (1<<index) != 0) for index,
param in enumerate(optional_params)])
- suffix =""
+ suffix = ""
params_external = []
params_internal = []
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits