Index: tools/checkdeps/checkdeps.py |
=================================================================== |
--- tools/checkdeps/checkdeps.py (revision 9136) |
+++ tools/checkdeps/checkdeps.py (working copy) |
@@ -56,6 +56,7 @@ |
import optparse |
import re |
import sys |
+import copy |
# Variable name used in the DEPS file to specify module-level deps. |
DEPS_VAR_NAME = "deps" |
@@ -180,7 +181,7 @@ |
Returns: A new set of rules combining the existing_rules with the other |
arguments. |
""" |
- rules = existing_rules |
+ rules = copy.copy(existing_rules) |
# First apply the implicit "allow" rule for the current directory. |
if cur_dir.lower().startswith(BASE_DIRECTORY): |
@@ -255,13 +256,14 @@ |
local_scope = {} |
global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} |
deps_file = os.path.join(dir_name, "DEPS") |
- if not os.path.exists(deps_file): |
- if VERBOSE: |
- print " No deps file found in", dir_name |
- return (existing_rules, []) # Nothing to change from the input rules. |
- execfile(deps_file, global_scope, local_scope) |
+ if os.path.exists(deps_file): |
+ execfile(deps_file, global_scope, local_scope) |
+ elif VERBOSE: |
+ print " No deps file found in", dir_name |
+ # Even if a DEPS file does not exist we still invoke ApplyRules |
+ # to apply the implicit "allow" rule for the current directory |
deps = local_scope.get(DEPS_VAR_NAME, {}) |
include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) |
skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) |
@@ -348,8 +350,8 @@ |
return ret_val |
-def CheckDirectory(rules, dir_name): |
- (rules, skip_subdirs) = ApplyDirectoryRules(rules, dir_name) |
+def CheckDirectory(parent_rules, dir_name): |
+ (rules, skip_subdirs) = ApplyDirectoryRules(parent_rules, dir_name) |
if rules == None: |
return True |