aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-08-05 11:35:13 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-05 11:35:13 -0400
commit3f35ac772b0428e77c93968fdfc6f4add1c9f15d (patch)
treeb620aedb94da92326f4c79da21d7fa97f79e3ac7 /scripts
parent475749351dcf7a89ad921f120a6daac80310edde (diff)
downloadtor-3f35ac772b0428e77c93968fdfc6f4add1c9f15d.tar.gz
tor-3f35ac772b0428e77c93968fdfc6f4add1c9f15d.zip
checkIncludes: introduce rules-file caching.
We'll want this so that we can have each file evaluated independently, rather than a directory at a time.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maint/checkIncludes.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/maint/checkIncludes.py b/scripts/maint/checkIncludes.py
index a6672b0977..a67397bfaa 100755
--- a/scripts/maint/checkIncludes.py
+++ b/scripts/maint/checkIncludes.py
@@ -123,8 +123,12 @@ class Rules(object):
return allowed
+include_rules_cache = {}
+
def load_include_rules(fname):
""" Read a rules file from 'fname', and return it as a Rules object. """
+ if fname in include_rules_cache:
+ return include_rules_cache[fname]
result = Rules(os.path.split(fname)[0])
with open_file(fname) as f:
for line in f:
@@ -132,6 +136,7 @@ def load_include_rules(fname):
if line.startswith("#") or not line:
continue
result.addPattern(line)
+ include_rules_cache[fname] = result
return result
if __name__ == '__main__':