From c107dbd9cf3bc24e14da4b5a99c78d7fd1934534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiziano=20M=C3=BCller?= Date: Wed, 18 Sep 2019 16:15:31 +0200 Subject: [PATCH] prettify: run fprettify if file contains Fypp directives previously the complete prettification step was skipped --- tools/prettify/prettify.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tools/prettify/prettify.py b/tools/prettify/prettify.py index e8f8273f83..31bf63941f 100755 --- a/tools/prettify/prettify.py +++ b/tools/prettify/prettify.py @@ -176,8 +176,14 @@ def prettifyFile( logger = logging.getLogger("fprettify-logger") if is_fypp(infile): - logger.error("{}: fypp directives not supported.\n".format(filename)) - return infile + logger.warning( + "{}: fypp directives not fully supported, running only fprettify".format( + filename + ) + ) + replace = False + normalize_use = False + upcase_keywords = False # create a temporary file first as a copy of the input file inbuf = StringIO(infile.read()) @@ -207,11 +213,12 @@ def prettifyFile( log_exception( e, "fprettify could not parse file, file is not prettified" ) - outbuf.write(inbuf.read()) - - outbuf.seek(0) - inbuf.close() - inbuf = outbuf + outbuf.close() + inbuf.seek(0) + else: + outbuf.seek(0) + inbuf.close() + inbuf = outbuf if normalize_use: outbuf = StringIO() @@ -242,7 +249,7 @@ def prettifyFile( hash_prev = hash_new except: - logger.critical("error processing file '{}'\n".format(filename)) + logger.critical("error processing file '{}'".format(filename)) raise else: