summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 17:41:38 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 17:41:38 +0000
commita8cf61b1bd02bf47aca467f64f9ca91916252f75 (patch)
tree20303ecb76660fec2875a6cb01b95dee44e0649b /tools
parent97f39881651f029c96194d4c9d99b8aa0ad6f90e (diff)
downloadchromium_src-a8cf61b1bd02bf47aca467f64f9ca91916252f75.zip
chromium_src-a8cf61b1bd02bf47aca467f64f9ca91916252f75.tar.gz
chromium_src-a8cf61b1bd02bf47aca467f64f9ca91916252f75.tar.bz2
Fix the dependency checker tool. Rules for a directory did modify their directory parent rules. Using copy.copy() solves the problem.Additional fix when "allow-current-directory" rules was not applied if DEPS file is missing.
Updated few DEPS file with reasonable rules. To prevent tree closing other dependencies are added. These need to be either legitimated or dependency removed. Review URL: http://codereview.chromium.org/21025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/checkdeps/checkdeps.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py
index 5ef4de3..6124eeb 100755
--- a/tools/checkdeps/checkdeps.py
+++ b/tools/checkdeps/checkdeps.py
@@ -56,6 +56,7 @@ import os
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 @@ def ApplyRules(existing_rules, deps, includes, cur_dir):
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 @@ def ApplyDirectoryRules(existing_rules, dir_name):
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 @@ def CheckFile(rules, file_name):
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