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

Unified Diff: build/gyp_glob.py

Issue 8817001: Make a gyp file for the pnacl_irt_shim. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Move one gyp file to chrome Created 9 years 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 | « build/all.gyp ('k') | build/untrusted.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_glob.py
===================================================================
--- build/gyp_glob.py (revision 0)
+++ build/gyp_glob.py (revision 0)
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This script gets a list of files from the given directory that
+matches a particular glob pattern.
+
+Normal shell globbing does not work with Visual Studio, even if it
+works in Makefiles. Thus we use this python wrapper to handle globbing
+in GYP and get a real list of files instead of a symbolic filename
+that has a "*" in it.
+
+Perhaps this can be built into gyp instead.
+"""
+
+import glob
+import os
+import sys
+
+def Main(argv):
+ if len(argv) < 3:
+ sys.stderr.write('Usage: %s <path> <glob_pattern>\n' % argv[0])
+ return 1
+ path = argv[1]
+ glob_str = os.path.join(path, argv[2])
+ files = glob.glob(glob_str)
+ if sys.platform.startswith('win'):
+ # Add a \ so that gyp will have escaped slashes.
+ matching = [ f.replace('\\', '\\\\') for f in files ]
+ else:
+ # Linux seems to need the abspath, while visual studio is okay with
+ # a relative path.
+ matching = [ os.path.abspath(f) for f in files ]
+
+ sys.stdout.write(' '.join(matching) + '\n')
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main(sys.argv))
Property changes on: build/gyp_glob.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « build/all.gyp ('k') | build/untrusted.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698