From e88a2ea8adb4a57c9cf5c44fe30c210c8608361b Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Fri, 10 May 2019 16:26:39 +0200 Subject: Reindent all Python sources to ts=4. Strip trailing spaces. --- tools/generate-plugin.py | 16 ++++++++-------- tools/preprocessor.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'tools') diff --git a/tools/generate-plugin.py b/tools/generate-plugin.py index 6b222f71..c3d30d7a 100755 --- a/tools/generate-plugin.py +++ b/tools/generate-plugin.py @@ -18,7 +18,7 @@ # # You should have received a copy of the GNU General Public License # along with pluma; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, +# Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA import re @@ -57,7 +57,7 @@ Options: --with-$feature Enable $feature --without-$feature Disable $feature --help / -h Show this message and exits - + Features: config-dlg Plugin configuration dialog menu Plugin menu entries @@ -69,7 +69,7 @@ TEMPLATE_DIR = os.path.join(os.path.dirname(sys.argv[0]), "plugin_template") # Parsing command line options try: - opts, args = getopt.getopt(sys.argv[1:], + opts, args = getopt.getopt(sys.argv[1:], 'l:h', ['language=', 'description=', @@ -102,7 +102,7 @@ for opt, arg in opts: elif opt[0:7] == '--with-': options['with-' + opt[7:]] = True - + elif opt[0:10] == '--without-': options['with-' + opt[10:]] = False @@ -150,10 +150,10 @@ if options['with-bottom-pane']: if options['with-menu']: directives['WITH_MENU'] = True - + if options['with-config-dlg']: directives['WITH_CONFIGURE_DIALOG'] = True - + # Generate the plugin base for infile, outfile in output_files.iteritems(): @@ -166,11 +166,11 @@ for infile, outfile in output_files.iteritems(): if not os.path.isfile(infile): print >>sys.stderr, 'Input file does not exist : %s.' % os.path.basename(infile) continue - + # Make sure the destination directory exists if not os.path.isdir(os.path.split(outfile)[0]): os.makedirs(os.path.split(outfile)[0]) - + # Variables relative to the generated file directives['DIRNAME'], directives['FILENAME'] = os.path.split(outfile) diff --git a/tools/preprocessor.py b/tools/preprocessor.py index f5409cad..cd8726d2 100644 --- a/tools/preprocessor.py +++ b/tools/preprocessor.py @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with pluma; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, +# Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA import sys @@ -49,7 +49,7 @@ def _subvar(match, macros): return '' else: return '' - + mods = match.group('mods') if mods is not None: for mod in mods[1:].split('.'): @@ -58,7 +58,7 @@ def _subvar(match, macros): elif mod == 'upper': val = val.upper() elif mod == 'camel': - val = ''.join(i.capitalize() + val = ''.join(i.capitalize() for i in val.split('_')) return val @@ -74,20 +74,20 @@ def process(infile = sys.stdin, outfile = sys.stdout, macros = {}): close_outfile = True else: close_outfile = False - + deepness = 0 writing_disabled = None - + for line in infile: # Skip comments if line[0:3].lower() == '##c': continue - # Check whether current line is a preprocessor directive + # Check whether current line is a preprocessor directive for statement in statements: match = statement.match(line) if match: break - + if match is not None: stmt = match.group('stmt') @@ -113,7 +113,7 @@ def process(infile = sys.stdin, outfile = sys.stdout, macros = {}): deepness += 1 if writing_disabled is None and \ match.group('key') in macros: - writing_disabled = deepness + writing_disabled = deepness elif stmt == "if": deepness += 1 @@ -148,7 +148,7 @@ def process(infile = sys.stdin, outfile = sys.stdout, macros = {}): # Do variable substitution in the remaining lines elif writing_disabled is None: - outfile.write(re.sub(variable, + outfile.write(re.sub(variable, lambda m: _subvar(m, macros), line)) -- cgit v1.2.1