| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 
|  | 2 # Use of this source code is governed by a BSD-style license that can be | 
|  | 3 # found in the LICENSE file. | 
|  | 4 | 
|  | 5 import os | 
|  | 6 import re | 
|  | 7 import subprocess | 
|  | 8 import sys | 
|  | 9 | 
|  | 10 # This script executes libool and filters out logspam lines like: | 
|  | 11 #    '/path/to/libtool: file: foo.o has no symbols' | 
|  | 12 | 
|  | 13 def Main(cmd_list): | 
|  | 14   libtool_re = re.compile(r'^.*libtool: (?:for architecture: \S* )?' | 
|  | 15                           r'file: .* has no symbols$') | 
|  | 16   libtool_re5 = re.compile( | 
|  | 17       r'^.*libtool: warning for library: ' + | 
|  | 18       r'.* the table of contents is empty ' + | 
|  | 19       r'\(no object file members in the library define global symbols\)$') | 
|  | 20   env = os.environ.copy() | 
|  | 21   # Ref: | 
|  | 22   # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c | 
|  | 23   # The problem with this flag is that it resets the file mtime on the file to | 
|  | 24   # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. | 
|  | 25   env['ZERO_AR_DATE'] = '1' | 
|  | 26   libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) | 
|  | 27   _, err = libtoolout.communicate() | 
|  | 28   for line in err.splitlines(): | 
|  | 29     if not libtool_re.match(line) and not libtool_re5.match(line): | 
|  | 30       print >>sys.stderr, line | 
|  | 31   # Unconditionally touch the output .a file on the command line if present | 
|  | 32   # and the command succeeded. A bit hacky. | 
|  | 33   if not libtoolout.returncode: | 
|  | 34     for i in range(len(cmd_list) - 1): | 
|  | 35       if cmd_list[i] == '-o' and cmd_list[i+1].endswith('.a'): | 
|  | 36         os.utime(cmd_list[i+1], None) | 
|  | 37         break | 
|  | 38   return libtoolout.returncode | 
|  | 39 | 
|  | 40 | 
|  | 41 if __name__ == '__main__': | 
|  | 42   sys.exit(Main(sys.argv[1:])) | 
| OLD | NEW | 
|---|