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: build/linux/rewrite_dirs.py

Issue 652067: Cross compiling: don't rewrite dirs if they're already prefixed.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Rewrites paths in -I, -L and other option to be relative to a sysroot.""" 6 """Rewrites paths in -I, -L and other option to be relative to a sysroot."""
7 7
8 import sys 8 import sys
9 import os 9 import os
10 10
11 REWRITE_PREFIX = ['-I', 11 REWRITE_PREFIX = ['-I',
12 '-idirafter', 12 '-idirafter',
13 '-imacros', 13 '-imacros',
14 '-imultilib', 14 '-imultilib',
15 '-include', 15 '-include',
16 '-iprefix', 16 '-iprefix',
17 '-iquote', 17 '-iquote',
18 '-isystem', 18 '-isystem',
19 '-L'] 19 '-L']
20 20
21 def RewritePath(path, sysroot): 21 def RewritePath(path, sysroot):
22 """Rewrites a path by prefixing it with the sysroot if it is absolute.""" 22 """Rewrites a path by prefixing it with the sysroot if it is absolute."""
23 if os.path.isabs(path): 23 if os.path.isabs(path) and not path.startswith(sysroot):
24 path = path.lstrip('/') 24 path = path.lstrip('/')
25 return os.path.join(sysroot, path) 25 return os.path.join(sysroot, path)
26 else: 26 else:
27 return path 27 return path
28 28
29 def RewriteLine(line, sysroot): 29 def RewriteLine(line, sysroot):
30 """Rewrites all the paths in recognized options.""" 30 """Rewrites all the paths in recognized options."""
31 args = line.split() 31 args = line.split()
32 count = len(args) 32 count = len(args)
33 i = 0 33 i = 0
(...skipping 21 matching lines...) Expand all
55 sys.stderr.write('usage: %s /path/to/sysroot\n' % argv[0]) 55 sys.stderr.write('usage: %s /path/to/sysroot\n' % argv[0])
56 return 1 56 return 1
57 57
58 for line in sys.stdin.readlines(): 58 for line in sys.stdin.readlines():
59 line = RewriteLine(line.strip(), sysroot) 59 line = RewriteLine(line.strip(), sysroot)
60 print line 60 print line
61 return 0 61 return 0
62 62
63 if __name__ == '__main__': 63 if __name__ == '__main__':
64 sys.exit(main(sys.argv)) 64 sys.exit(main(sys.argv))
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