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

Side by Side Diff: site_scons/gyp_extract.py

Issue 6715019: Switching ppapi on nacl side to import chrome side .gyp[i] directly. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 9 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
« no previous file with comments | « no previous file | src/shared/ppapi/build.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright 2010 The Native Client Authors. All rights reserved.
Mark Seaborn 2011/03/23 18:51:32 2011?
3 # Use of this source code is governed by a BSD-style license that can
4 # be found in the LICENSE file.
5
6 import re
7
8
9 def LoadGypFile(gyp_filename):
10 """Load the contents of a gyp file.
11
12 Arguments:
13 filename: filename of a .gyp file.
14 Returns:
15 Raw dict from .gyp file.
16 """
17 return eval(open(gyp_filename).read(), {}, {})
18
19
20 def GypTargetSources(gyp_data, target_name, pattern):
21 """Extract a sources from a target matching a given pattern.
22
23 Arguments:
24 gyp_data: dict previously load by LoadGypFile.
25 target_name: target to extract from.
26 pattern: re pattern that sources must match.
27 Returns:
28 A list of strings containing source filenames.
29 """
30 targets = [target for target in gyp_data['targets']
31 if target['target_name'] == target_name]
32 # Only one target should have this name.
33 assert len(targets) == 1
34 desired_target = targets[0]
35 # Extract source files that match.
36 re_compiled = re.compile(pattern)
37 return [source_file for source_file in desired_target['sources']
38 if re_compiled.match(source_file)]
OLDNEW
« no previous file with comments | « no previous file | src/shared/ppapi/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698