summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2007-07-28 16:49:20 -0700
committerNathan Binkert <nate@binkert.org>2007-07-28 16:49:20 -0700
commitc27e23f2e8698b2eccf68eb13b87c3641caa4edb (patch)
tree7ae9a160c803318e3faa4fc461bee35b658810ea /util
parentcda354b07035f73a3b220f89014721300d36a815 (diff)
downloadgem5-c27e23f2e8698b2eccf68eb13b87c3641caa4edb.tar.xz
style: Check/Fix whitespace on SCons files
--HG-- extra : convert_revision : 46e6b2dd8e1984cbab0ea24c94760794734c0f95
Diffstat (limited to 'util')
-rw-r--r--util/style.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/util/style.py b/util/style.py
index 2512d6920..77c08307b 100644
--- a/util/style.py
+++ b/util/style.py
@@ -51,14 +51,28 @@ lang_types = { 'c' : "C",
's' : "asm",
'S' : "asm",
'isa' : "isa" }
-whitespace_types = ('C', 'C++', 'swig', 'python', 'asm', 'isa')
-format_types = ( 'C', 'C++' )
-
def file_type(filename):
extension = filename.split('.')
extension = len(extension) > 1 and extension[-1]
return lang_types.get(extension, None)
+whitespace_types = ('C', 'C++', 'swig', 'python', 'asm', 'isa')
+def whitespace_file(filename):
+ if file_type(filename) in whitespace_types:
+ return True
+
+ if filename.startswith("SCons"):
+ return True
+
+ return False
+
+format_types = ( 'C', 'C++' )
+def format_file(filename):
+ if file_type(filename) in format_types:
+ return True
+
+ return False
+
def checkwhite_line(line):
match = lead.search(line)
if match and match.group(1).find('\t') != -1:
@@ -71,7 +85,7 @@ def checkwhite_line(line):
return True
def checkwhite(filename):
- if file_type(filename) not in whitespace_types:
+ if not whitespace_file(filename)
return
try:
@@ -101,7 +115,7 @@ def fixwhite_line(line, tabsize):
return line.rstrip() + '\n'
def fixwhite(filename, tabsize, fixonly=None):
- if file_type(filename) not in whitespace_types:
+ if not whitespace_file(filename)
return
try:
@@ -159,7 +173,7 @@ class ValidationStats(object):
self.trailwhite or self.badcontrol or self.cret
def validate(filename, stats, verbose, exit_code):
- if file_type(filename) not in format_types:
+ if not format_file(filename):
return
def msg(lineno, line, message):