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

Side by Side Diff: ios/build/packaging/link_dependencies.py

Issue 1670613002: Silence libtool warning when building libcrnet_standalone.a. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | ios/crnet/crnet_pack.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Links the deps of a binary into a static library. 7 """Links the deps of a binary into a static library.
8 8
9 Run with a working directory, the name of a binary target, and the name of the 9 Run with a working directory, the name of a binary target, and the name of the
10 static library that should be produced. For example: 10 static library that should be produced. For example:
11 11
12 $ link_dependencies.py out/Release-iphoneos \ 12 $ link_dependencies.py out/Release-iphoneos \
13 crnet_consumer.app/crnet_consumer \ 13 crnet_consumer.app/crnet_consumer \
14 out/Release-iphoneos/crnet_standalone.a 14 out/Release-iphoneos/crnet_standalone.a
15 """ 15 """
16 16
17 import argparse 17 import argparse
18 import os 18 import os
19 import re
19 import subprocess 20 import subprocess
21 import sys
20 22
21 23
22 class SubprocessError(Exception): 24 class SubprocessError(Exception):
23 pass 25 pass
24 26
25 27
26 def extract_inputs(query_result, prefix=''): 28 def extract_inputs(query_result, prefix=''):
27 """Extracts inputs from ninja query output. 29 """Extracts inputs from ninja query output.
28 30
29 Given 'ninja -t query' output for a target, extracts all the inputs of that 31 Given 'ninja -t query' output for a target, extracts all the inputs of that
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return deps 121 return deps
120 122
121 123
122 def link(output, inputs): 124 def link(output, inputs):
123 """Links output from inputs using libtool. 125 """Links output from inputs using libtool.
124 126
125 Args: 127 Args:
126 output: file system path to desired output library 128 output: file system path to desired output library
127 inputs: list of file system paths to input libraries 129 inputs: list of file system paths to input libraries
128 """ 130 """
129 p = subprocess.Popen(['libtool', '-o', output] + inputs) 131 libtool_re = re.compile(r'^.*libtool: (?:for architecture: \S* )?'
130 p.communicate() 132 r'file: .* has no symbols$')
133 p = subprocess.Popen(
134 ['libtool', '-o', output] + inputs, stderr=subprocess.PIPE)
135 _, err = p.communicate()
136 for line in err.splitlines():
137 if not libtool_re.match(line) and not libtool_re5.match(line):
droger 2016/02/05 09:08:50 Where is libtool_re5 defined? Do we need to import
sdefresne 2016/02/05 09:58:56 Ooops. Removed.
138 print >>sys.stderr, line
droger 2016/02/05 09:08:50 Missing whitespace after >>
sdefresne 2016/02/05 09:58:56 No, this is the syntax to write to a file using pr
131 if p.returncode != 0: 139 if p.returncode != 0:
132 message = "subprocess libtool returned {0}".format(p.returncode) 140 message = "subprocess libtool returned {0}".format(p.returncode)
133 raise SubprocessError(message) 141 raise SubprocessError(message)
134 142
135 143
136 def main(): 144 def main():
137 parser = argparse.ArgumentParser( 145 parser = argparse.ArgumentParser(
138 description='Link dependencies of a ninja target into a static library') 146 description='Link dependencies of a ninja target into a static library')
139 parser.add_argument('workdir', nargs=1, help='ninja working directory') 147 parser.add_argument('workdir', nargs=1, help='ninja working directory')
140 parser.add_argument('target', nargs=1, help='target to query for deps') 148 parser.add_argument('target', nargs=1, help='target to query for deps')
141 parser.add_argument('output', nargs=1, help='path to output static library') 149 parser.add_argument('output', nargs=1, help='path to output static library')
142 args = parser.parse_args() 150 args = parser.parse_args()
143 151
144 inputs = query_ninja(args.target[0], args.workdir[0]) 152 inputs = query_ninja(args.target[0], args.workdir[0])
145 link(args.output[0], list(library_deps(inputs, args.workdir[0]))) 153 link(args.output[0], list(library_deps(inputs, args.workdir[0])))
146 154
147 155
148 if __name__ == '__main__': 156 if __name__ == '__main__':
149 main() 157 main()
OLDNEW
« no previous file with comments | « no previous file | ios/crnet/crnet_pack.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698