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

Side by Side Diff: pylib/gyp/common.py

Issue 24803004: Add an option to prune unwanted targets (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: prune based on a set of root targets instead of build_files Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import errno 7 import errno
8 import filecmp 8 import filecmp
9 import os.path 9 import os.path
10 import re 10 import re
(...skipping 26 matching lines...) Expand all
37 def ExceptionAppend(e, msg): 37 def ExceptionAppend(e, msg):
38 """Append a message to the given exception's message.""" 38 """Append a message to the given exception's message."""
39 if not e.args: 39 if not e.args:
40 e.args = (msg,) 40 e.args = (msg,)
41 elif len(e.args) == 1: 41 elif len(e.args) == 1:
42 e.args = (str(e.args[0]) + ' ' + msg,) 42 e.args = (str(e.args[0]) + ' ' + msg,)
43 else: 43 else:
44 e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:] 44 e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:]
45 45
46 46
47 def FindQualifiedTargets(target, qualified_list):
48 """
49 Given a list of qualified targets, return the qualified targets for the
50 specified |target|.
51 """
52 return [t for t in qualified_list if ParseQualifiedTarget(t)[1] == target]
53
54
47 def ParseQualifiedTarget(target): 55 def ParseQualifiedTarget(target):
48 # Splits a qualified target into a build file, target name and toolset. 56 # Splits a qualified target into a build file, target name and toolset.
49 57
50 # NOTE: rsplit is used to disambiguate the Windows drive letter separator. 58 # NOTE: rsplit is used to disambiguate the Windows drive letter separator.
51 target_split = target.rsplit(':', 1) 59 target_split = target.rsplit(':', 1)
52 if len(target_split) == 2: 60 if len(target_split) == 2:
53 [build_file, target] = target_split 61 [build_file, target] = target_split
54 else: 62 else:
55 build_file = None 63 build_file = None
56 64
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 return 497 return
490 visited.add(node) 498 visited.add(node)
491 visiting.add(node) 499 visiting.add(node)
492 for neighbor in get_edges(node): 500 for neighbor in get_edges(node):
493 Visit(neighbor) 501 Visit(neighbor)
494 visiting.remove(node) 502 visiting.remove(node)
495 ordered_nodes.insert(0, node) 503 ordered_nodes.insert(0, node)
496 for node in sorted(graph): 504 for node in sorted(graph):
497 Visit(node) 505 Visit(node)
498 return ordered_nodes 506 return ordered_nodes
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698