summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJoel Hestness <jthestness@gmail.com>2014-06-09 22:01:18 -0500
committerJoel Hestness <jthestness@gmail.com>2014-06-09 22:01:18 -0500
commit4a98b0cd5985fabf7b4138f0ef1e19023d3e028c (patch)
treebe9f5fce278fa66ada2fd85c30365cdab74291c0 /util
parent4f8ac94549b46764df5c2dc5854a78268cb94d08 (diff)
downloadgem5-4a98b0cd5985fabf7b4138f0ef1e19023d3e028c.tar.xz
Util: Do not style check symlinks
The style checker used to traverse symlinks if they pointed to files, which can result in style checker failure if the pointed-to file doesn't exist. This style check is actually unnecessary, since symlinks either point to other files that are already style checked, or files outside gem5, which shouldn't be checked. Skip symlinks.
Diffstat (limited to 'util')
-rw-r--r--util/style.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/util/style.py b/util/style.py
index f1f64689f..08c127765 100644
--- a/util/style.py
+++ b/util/style.py
@@ -149,6 +149,13 @@ class Verifier(object):
return f
def skip(self, filename):
+ # We never want to handle symlinks, so always skip them: If the location
+ # pointed to is a directory, skip it. If the location is a file inside
+ # the gem5 directory, it will be checked as a file, so symlink can be
+ # skipped. If the location is a file outside gem5, we don't want to
+ # check it anyway.
+ if os.path.islink(filename):
+ return True
return lang_type(filename) not in self.languages
def check(self, filename, regions=all_regions):
@@ -384,6 +391,13 @@ def do_check_style(hgui, repo, *files, **args):
files = frozenset(files)
def skip(name):
+ # We never want to handle symlinks, so always skip them: If the location
+ # pointed to is a directory, skip it. If the location is a file inside
+ # the gem5 directory, it will be checked as a file, so symlink can be
+ # skipped. If the location is a file outside gem5, we don't want to
+ # check it anyway.
+ if os.path.islink(name):
+ return True
return files and name in files
def prompt(name, func, regions=all_regions):