Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: tools/checkdeps/checkdeps.py

Issue 21025: Fix the dependency checker tool. Rules for a directory did modify their direc... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/DEPS ('k') | webkit/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/base/DEPS ('k') | webkit/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698