From: Boris Zanin Date: Wed, 19 Jun 2019 13:39:57 +0000 (+0200) Subject: Python3 compatibility: whitespace validation fix X-Git-Tag: upstream/1.3.5~2036 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4257771131b791cb5cd18a56fbab0b2a2d72eae;p=platform%2Fupstream%2FVK-GL-CTS.git Python3 compatibility: whitespace validation fix Make encoding independend from environment by enforcing ascii. And ignore decoding errors (i.e. bytes with code greater 127) due to they are not essential for whitespace validation. Components: Framework VK-GL-CTS issue: 1665 Change-Id: I140ed7ff520c651d38d53ff1a99665242c71d54b --- diff --git a/scripts/src_util/check_whitespace.py b/scripts/src_util/check_whitespace.py index a2371d8..b37c128 100644 --- a/scripts/src_util/check_whitespace.py +++ b/scripts/src_util/check_whitespace.py @@ -25,7 +25,10 @@ from argparse import ArgumentParser from common import getChangedFiles, getAllProjectFiles, isTextFile def checkFileWhitespace (file): - f = open(file, 'rt') + if (sys.version_info < (3, 0)): + f = open(file, 'rt') + else: + f = open(file, 'rt', encoding="ascii", errors='replace') error = False for lineNum, line in enumerate(f): if line.endswith(" \n") or line.endswith("\t\n"):