Chromium Code Reviews| 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 2012 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. |
|
jvoung (off chromium)
2012/08/27 21:53:58
If you are asking BradN about the nacl-chrome spli
|
| +""" |
| + |
| +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 |
| Added: svn:executable |
| + * |