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

Side by Side Diff: recipes.py

Issue 2664223002: Add unit tests for overrides in multi-repo workflow (Closed)
Patch Set: reverts Created 3 years, 10 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 | « recipe_engine/package.py ('k') | unittests/override_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 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Tool to interact with recipe repositories. 6 """Tool to interact with recipe repositories.
7 7
8 This tool operates on the nearest ancestor directory containing an 8 This tool operates on the nearest ancestor directory containing an
9 infra/config/recipes.cfg. 9 infra/config/recipes.cfg.
10 """ 10 """
11 11
12 import argparse 12 import argparse
13 import collections
14 import json 13 import json
15 import logging 14 import logging
16 import os 15 import os
17 import shutil 16 import shutil
18 import subprocess 17 import subprocess
19 import sys 18 import sys
20 import tempfile 19 import tempfile
21 20
22 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) 21 ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
23 sys.path.insert(0, ROOT_DIR) 22 sys.path.insert(0, ROOT_DIR)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 273
275 class ProjectOverrideAction(argparse.Action): 274 class ProjectOverrideAction(argparse.Action):
276 def __call__(self, parser, namespace, values, option_string=None): 275 def __call__(self, parser, namespace, values, option_string=None):
277 p = values.split('=', 2) 276 p = values.split('=', 2)
278 if len(p) != 2: 277 if len(p) != 2:
279 raise ValueError("Override must have the form: repo=path") 278 raise ValueError("Override must have the form: repo=path")
280 project_id, path = p 279 project_id, path = p
281 280
282 v = getattr(namespace, self.dest, None) 281 v = getattr(namespace, self.dest, None)
283 if v is None: 282 if v is None:
284 v = collections.OrderedDict() 283 v = {}
285 setattr(namespace, self.dest, v) 284 setattr(namespace, self.dest, v)
286 285
287 if v.get(project_id): 286 if v.get(project_id):
288 raise ValueError("An override is already defined for [%s] (%s)" % ( 287 raise ValueError("An override is already defined for [%s] (%s)" % (
289 project_id, v[project_id])) 288 project_id, v[project_id]))
290 path = os.path.abspath(os.path.expanduser(path)) 289 path = os.path.abspath(os.path.expanduser(path))
291 if not os.path.isdir(path): 290 if not os.path.isdir(path):
292 raise ValueError("Override path [%s] is not a directory" % (path,)) 291 raise ValueError("Override path [%s] is not a directory" % (path,))
293 v[project_id] = path 292 v[project_id] = path
294 293
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 709
711 if not isinstance(ret, int): 710 if not isinstance(ret, int):
712 if ret is None: 711 if ret is None:
713 ret = 0 712 ret = 0
714 else: 713 else:
715 print >> sys.stderr, ret 714 print >> sys.stderr, ret
716 ret = 1 715 ret = 1
717 sys.stdout.flush() 716 sys.stdout.flush()
718 sys.stderr.flush() 717 sys.stderr.flush()
719 os._exit(ret) 718 os._exit(ret)
OLDNEW
« no previous file with comments | « recipe_engine/package.py ('k') | unittests/override_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698