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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/shared/ppapi/build.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: site_scons/gyp_extract.py
===================================================================
--- site_scons/gyp_extract.py (revision 0)
+++ site_scons/gyp_extract.py (revision 0)
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+# Copyright 2010 The Native Client Authors. All rights reserved.
Mark Seaborn 2011/03/23 18:51:32 2011?
+# Use of this source code is governed by a BSD-style license that can
+# be found in the LICENSE file.
+
+import re
+
+
+def LoadGypFile(gyp_filename):
+ """Load the contents of a gyp file.
+
+ Arguments:
+ filename: filename of a .gyp file.
+ Returns:
+ Raw dict from .gyp file.
+ """
+ return eval(open(gyp_filename).read(), {}, {})
+
+
+def GypTargetSources(gyp_data, target_name, pattern):
+ """Extract a sources from a target matching a given pattern.
+
+ Arguments:
+ gyp_data: dict previously load by LoadGypFile.
+ target_name: target to extract from.
+ pattern: re pattern that sources must match.
+ Returns:
+ A list of strings containing source filenames.
+ """
+ targets = [target for target in gyp_data['targets']
+ if target['target_name'] == target_name]
+ # Only one target should have this name.
+ assert len(targets) == 1
+ desired_target = targets[0]
+ # Extract source files that match.
+ re_compiled = re.compile(pattern)
+ return [source_file for source_file in desired_target['sources']
+ if re_compiled.match(source_file)]
Property changes on: site_scons/gyp_extract.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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