diff options
author | teor <teor@torproject.org> | 2019-11-26 17:50:56 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-11-26 17:52:18 +1000 |
commit | fadd292bf05e6fedf61e25f43079920c9ea3c117 (patch) | |
tree | 484a2a4c17016b28296728301358e53efb81d302 /scripts/maint/practracker/includes.py | |
parent | 3669a2f827ce5fcfbaad693565069bbcab4e6276 (diff) | |
download | tor-fadd292bf05e6fedf61e25f43079920c9ea3c117.tar.gz tor-fadd292bf05e6fedf61e25f43079920c9ea3c117.zip |
practracker/includes.py: Don't read editor temp files
(Or any files that start with "." or "#".)
Obviously correct changes to already-reviewed code.
Diffstat (limited to 'scripts/maint/practracker/includes.py')
-rwxr-xr-x | scripts/maint/practracker/includes.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/maint/practracker/includes.py b/scripts/maint/practracker/includes.py index 1d43bd58e8..f2d91b63a1 100755 --- a/scripts/maint/practracker/includes.py +++ b/scripts/maint/practracker/includes.py @@ -36,7 +36,11 @@ def warn(msg): def fname_is_c(fname): """ Return true iff 'fname' is the name of a file that we should search for possibly disallowed #include directives. """ - return fname.endswith(".h") or fname.endswith(".c") + if fname.endswith(".h") or fname.endswith(".c"): + bname = os.path.basename(fname) + return not (bname.startswith(".") or bname.startswith("#")) + else: + return False INCLUDE_PATTERN = re.compile(r'\s*#\s*include\s+"([^"]*)"') RULES_FNAME = ".may_include" |