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

Side by Side Diff: native_client_sdk/src/build_tools/dsc_info.py

Issue 61763014: Add build target for nacl_io from the NaCl SDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Add new targets back into all.gyp, readd main function in dsc_info.py Created 7 years, 1 month 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Extracts information from a library.dsc file."""
7
8 import optparse
9 import os
10 import sys
11
12 import parse_dsc
13
14 def Error(msg):
15 print >> sys.stderr, 'dsc_info: %s' % msg
16 sys.exit(1)
17
18
19 def FindTarget(tree, target_name):
20 targets = tree['TARGETS']
21 for target in targets:
22 if target['NAME'] == target_name:
23 return target
24 Error('Target %s not found' % target_name)
25
26
27 def GetSources(lib_dir, tree, target_name):
28 result = []
29 target = FindTarget(tree, target_name)
30 for filename in target['SOURCES']:
31 result.append('/'.join([lib_dir, filename]))
32 return result
33
34
35 def DoMain(argv):
36 "Entry point for gyp's pymod_do_main command."
37 parser = optparse.OptionParser(usage='%prog: [OPTIONS] TARGET')
38 # Give a clearer error message when this is used as a module.
39 parser.prog = 'dsc_info'
40 parser.add_option('-s', '--sources',
41 help='Print a list of source files for the target',
42 action='store_true', default=False)
43 parser.add_option('-l', '--libdir',
44 help='Directory where the library.dsc file is located',
45 metavar='DIR')
46 options, args = parser.parse_args(argv)
47 if len(args) != 1:
48 parser.error('Expecting exactly one argument.')
49 target = args[0]
50 libdir = options.libdir or ''
51 tree = parse_dsc.LoadProject(os.path.join(libdir, 'library.dsc'))
52 if options.sources:
53 return '\n'.join(GetSources(libdir, tree, target))
54 parser.error('No action specified')
55
56
57 def main(argv):
58 print DoMain(argv[1:])
59
60
61 if __name__ == '__main__':
62 try:
63 sys.exit(main(sys.argv))
64 except KeyboardInterrupt:
65 Error('interrupted')
OLDNEW
« no previous file with comments | « native_client_sdk/native_client_sdk_untrusted.gyp ('k') | native_client_sdk/src/libraries/nacl_io/library.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698