From: Georg Kotheimer Date: Thu, 31 May 2018 09:24:18 +0000 (+0200) Subject: style: normalize filename in SortedIncludes.fix() X-Git-Tag: v19.0.0.0~490 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e1b5bd3bc21a324694e9a892ee6d5219ee7505f;p=gem5.git style: normalize filename in SortedIncludes.fix() The filename affects the sorting result. Therefore check(), which normalizes the filename, detects an invalid sorting of includes, but fix() fails to fix the corresponding includes. Change-Id: I7d5a941c9ebea853004922d19e3b84f8ded2afa6 Signed-off-by: Georg Kotheimer Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/10742 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- diff --git a/util/style/verifiers.py b/util/style/verifiers.py index 33b127a79..3cc513429 100644 --- a/util/style/verifiers.py +++ b/util/style/verifiers.py @@ -378,11 +378,12 @@ class SortedIncludes(Verifier): @safefix def fix(self, filename, regions=all_regions): f = self.open(filename, 'r+') + norm_fname = self.normalize_filename(filename) old = f.readlines() lines = [ l.rstrip('\n') for l in old ] language = lang_type(filename, lines[0]) - sort_lines = list(self.sort_includes(lines, filename, language)) + sort_lines = list(self.sort_includes(lines, norm_fname, language)) new = ''.join(line + '\n' for line in sort_lines) f.seek(0)