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

Unified Diff: gclient.py

Issue 368713002: Add fallback to DEPS from a missing deps file. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: update test Created 6 years, 6 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 | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 8d67b5a9eb1a3c4cc5d88ce297e9b32bd7390065..50ebf9f3e2653afffd72782ac4d00cde7970f7db 100755
--- a/gclient.py
+++ b/gclient.py
@@ -535,14 +535,26 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
deps_content = None
use_strict = False
- filepath = os.path.join(self.root.root_dir, self.name, self.deps_file)
- if not os.path.isfile(filepath):
+
+ # First try to locate the configured deps file. If it's missing, fallback
+ # to DEPS.
+ deps_files = [self.deps_file]
+ if 'DEPS' not in deps_files:
+ deps_files.append('DEPS')
+ for deps_file in deps_files:
+ filepath = os.path.join(self.root.root_dir, self.name, deps_file)
+ if os.path.isfile(filepath):
+ logging.info(
+ 'ParseDepsFile(%s): %s file found at %s', self.name, deps_file,
+ filepath)
+ break
logging.info(
- 'ParseDepsFile(%s): No %s file found at %s' % (
- self.name, self.deps_file, filepath))
- else:
+ 'ParseDepsFile(%s): No %s file found at %s', self.name, deps_file,
+ filepath)
+
+ if os.path.isfile(filepath):
deps_content = gclient_utils.FileRead(filepath)
- logging.debug('ParseDepsFile(%s) read:\n%s' % (self.name, deps_content))
+ logging.debug('ParseDepsFile(%s) read:\n%s', self.name, deps_content)
use_strict = 'use strict' in deps_content.splitlines()[0]
local_scope = {}
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698