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

Side by Side Diff: build/toolchain/mac/linker_driver.py

Issue 2396723003: fix pylint warning: build/toolchain/mac/linker_driver.py (Closed)
Patch Set: use os.path.basename instead of os.path.split Created 4 years, 2 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 | no next file » | 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 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 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 import os 7 import os
8 import os.path 8 import os.path
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 located. 123 located.
124 full_args: list of string, Full argument list for the linker driver. 124 full_args: list of string, Full argument list for the linker driver.
125 125
126 Returns: 126 Returns:
127 list of string, Build step outputs. 127 list of string, Build step outputs.
128 """ 128 """
129 if not len(dsym_path_prefix): 129 if not len(dsym_path_prefix):
130 raise ValueError('Unspecified dSYM output file') 130 raise ValueError('Unspecified dSYM output file')
131 131
132 linker_out = _FindLinkerOutput(full_args) 132 linker_out = _FindLinkerOutput(full_args)
133 (head, tail) = os.path.split(linker_out) 133 base = os.path.basename(linker_out)
134 dsym_out = os.path.join(dsym_path_prefix, tail + '.dSYM') 134 dsym_out = os.path.join(dsym_path_prefix, base + '.dSYM')
135 135
136 # Remove old dSYMs before invoking dsymutil. 136 # Remove old dSYMs before invoking dsymutil.
137 _RemovePath(dsym_out) 137 _RemovePath(dsym_out)
138 subprocess.check_call(['xcrun', 'dsymutil', '-o', dsym_out, linker_out]) 138 subprocess.check_call(['xcrun', 'dsymutil', '-o', dsym_out, linker_out])
139 return [dsym_out] 139 return [dsym_out]
140 140
141 141
142 def RunSaveUnstripped(unstripped_path_prefix, full_args): 142 def RunSaveUnstripped(unstripped_path_prefix, full_args):
143 """Linker driver action for -Wcrl,unstripped,<unstripped_path_prefix>. Copies 143 """Linker driver action for -Wcrl,unstripped,<unstripped_path_prefix>. Copies
144 the linker output to |unstripped_path_prefix| before stripping. 144 the linker output to |unstripped_path_prefix| before stripping.
145 145
146 Args: 146 Args:
147 unstripped_path_prefix: string, The path at which the unstripped output 147 unstripped_path_prefix: string, The path at which the unstripped output
148 should be located. 148 should be located.
149 full_args: list of string, Full argument list for the linker driver. 149 full_args: list of string, Full argument list for the linker driver.
150 150
151 Returns: 151 Returns:
152 list of string, Build step outputs. 152 list of string, Build step outputs.
153 """ 153 """
154 if not len(unstripped_path_prefix): 154 if not len(unstripped_path_prefix):
155 raise ValueError('Unspecified unstripped output file') 155 raise ValueError('Unspecified unstripped output file')
156 156
157 linker_out = _FindLinkerOutput(full_args) 157 linker_out = _FindLinkerOutput(full_args)
158 (head, tail) = os.path.split(linker_out) 158 base = os.path.basename(linker_out)
159 unstripped_out = os.path.join(unstripped_path_prefix, tail + '.unstripped') 159 unstripped_out = os.path.join(unstripped_path_prefix, base + '.unstripped')
160 160
161 shutil.copyfile(linker_out, unstripped_out) 161 shutil.copyfile(linker_out, unstripped_out)
162 return [unstripped_out] 162 return [unstripped_out]
163 163
164 164
165 def RunStrip(strip_args_string, full_args): 165 def RunStrip(strip_args_string, full_args):
166 """Linker driver action for -Wcrl,strip,<strip_arguments>. 166 """Linker driver action for -Wcrl,strip,<strip_arguments>.
167 167
168 Args: 168 Args:
169 strip_args_string: string, Comma-separated arguments for `strip`. 169 strip_args_string: string, Comma-separated arguments for `strip`.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 _LINKER_DRIVER_ACTIONS = [ 214 _LINKER_DRIVER_ACTIONS = [
215 ('dsym,', RunDsymUtil), 215 ('dsym,', RunDsymUtil),
216 ('unstripped,', RunSaveUnstripped), 216 ('unstripped,', RunSaveUnstripped),
217 ('strip,', RunStrip), 217 ('strip,', RunStrip),
218 ] 218 ]
219 219
220 220
221 if __name__ == '__main__': 221 if __name__ == '__main__':
222 Main(sys.argv) 222 Main(sys.argv)
223 sys.exit(0) 223 sys.exit(0)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698