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

Side by Side Diff: tools_webrtc/autoroller/roll_deps.py

Issue 2989603002: Fix autoroller in accordance to upstream change (Closed)
Patch Set: Add unittest Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools_webrtc/autoroller/unittests/roll_deps_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 """Script to automatically roll dependencies in the WebRTC DEPS file.""" 10 """Script to automatically roll dependencies in the WebRTC DEPS file."""
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ROLL_BRANCH_NAME = 'roll_chromium_revision' 43 ROLL_BRANCH_NAME = 'roll_chromium_revision'
44 44
45 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 45 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
46 CHECKOUT_SRC_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir, 46 CHECKOUT_SRC_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir,
47 os.pardir)) 47 os.pardir))
48 CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(CHECKOUT_SRC_DIR, os.pardir)) 48 CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(CHECKOUT_SRC_DIR, os.pardir))
49 49
50 sys.path.append(os.path.join(CHECKOUT_SRC_DIR, 'build')) 50 sys.path.append(os.path.join(CHECKOUT_SRC_DIR, 'build'))
51 import find_depot_tools 51 import find_depot_tools
52 find_depot_tools.add_depot_tools_to_path() 52 find_depot_tools.add_depot_tools_to_path()
53 from gclient import GClientKeywords
54 53
55 CLANG_UPDATE_SCRIPT_URL_PATH = 'tools/clang/scripts/update.py' 54 CLANG_UPDATE_SCRIPT_URL_PATH = 'tools/clang/scripts/update.py'
56 CLANG_UPDATE_SCRIPT_LOCAL_PATH = os.path.join(CHECKOUT_SRC_DIR, 'tools', 55 CLANG_UPDATE_SCRIPT_LOCAL_PATH = os.path.join(CHECKOUT_SRC_DIR, 'tools',
57 'clang', 'scripts', 'update.py') 56 'clang', 'scripts', 'update.py')
58 57
59 DepsEntry = collections.namedtuple('DepsEntry', 'path url revision') 58 DepsEntry = collections.namedtuple('DepsEntry', 'path url revision')
60 ChangedDep = collections.namedtuple('ChangedDep', 59 ChangedDep = collections.namedtuple('ChangedDep',
61 'path url current_rev new_rev') 60 'path url current_rev new_rev')
62 61
63 class RollError(Exception): 62 class RollError(Exception):
64 pass 63 pass
65 64
66 65
66 def VarLookup(local_scope):
67 return lambda var_name: local_scope['vars'][var_name]
68
69
67 def ParseDepsDict(deps_content): 70 def ParseDepsDict(deps_content):
68 local_scope = {} 71 local_scope = {}
69 var = GClientKeywords.VarImpl({}, local_scope)
70 global_scope = { 72 global_scope = {
71 'Var': var.Lookup, 73 'Var': VarLookup(local_scope),
72 'deps_os': {}, 74 'deps_os': {},
73 } 75 }
74 exec(deps_content, global_scope, local_scope) 76 exec(deps_content, global_scope, local_scope)
75 return local_scope 77 return local_scope
76 78
77 79
78 def ParseLocalDepsFile(filename): 80 def ParseLocalDepsFile(filename):
79 with open(filename, 'rb') as f: 81 with open(filename, 'rb') as f:
80 deps_content = f.read() 82 deps_content = f.read()
81 return ParseDepsDict(deps_content) 83 return ParseDepsDict(deps_content)
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 logging.info("No DEPS changes detected, skipping CL creation.") 483 logging.info("No DEPS changes detected, skipping CL creation.")
482 else: 484 else:
483 _LocalCommit(commit_msg, opts.dry_run) 485 _LocalCommit(commit_msg, opts.dry_run)
484 _UploadCL(opts.dry_run, opts.rietveld_email) 486 _UploadCL(opts.dry_run, opts.rietveld_email)
485 _SendToCQ(opts.dry_run, opts.skip_cq) 487 _SendToCQ(opts.dry_run, opts.skip_cq)
486 return 0 488 return 0
487 489
488 490
489 if __name__ == '__main__': 491 if __name__ == '__main__':
490 sys.exit(main()) 492 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools_webrtc/autoroller/unittests/roll_deps_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698