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

Side by Side Diff: build/android/adb_logcat_monitor.py

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 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 | « build/android/PRESUBMIT.py ('k') | build/android/adb_logcat_printer.py » ('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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Saves logcats from all connected devices. 7 """Saves logcats from all connected devices.
8 8
9 Usage: adb_logcat_monitor.py <base_dir> [<adb_binary_path>] 9 Usage: adb_logcat_monitor.py <base_dir> [<adb_binary_path>]
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 print 'adb_logcat_monitor: %s already exists? Cleaning' % base_dir 101 print 'adb_logcat_monitor: %s already exists? Cleaning' % base_dir
102 shutil.rmtree(base_dir, ignore_errors=True) 102 shutil.rmtree(base_dir, ignore_errors=True)
103 103
104 os.makedirs(base_dir) 104 os.makedirs(base_dir)
105 logging.basicConfig(filename=os.path.join(base_dir, 'eventlog'), 105 logging.basicConfig(filename=os.path.join(base_dir, 'eventlog'),
106 level=logging.INFO, 106 level=logging.INFO,
107 format='%(asctime)-2s %(levelname)-8s %(message)s') 107 format='%(asctime)-2s %(levelname)-8s %(message)s')
108 108
109 # Set up the alarm for calling 'adb devices'. This is to ensure 109 # Set up the alarm for calling 'adb devices'. This is to ensure
110 # our script doesn't get stuck waiting for a process response 110 # our script doesn't get stuck waiting for a process response
111 def TimeoutHandler(_, unused_frame): 111 def TimeoutHandler(_, _):
112 raise TimeoutException() 112 raise TimeoutException()
113 signal.signal(signal.SIGALRM, TimeoutHandler) 113 signal.signal(signal.SIGALRM, TimeoutHandler)
114 114
115 # Handle SIGTERMs to ensure clean shutdown 115 # Handle SIGTERMs to ensure clean shutdown
116 def SigtermHandler(_, unused_frame): 116 def SigtermHandler(_, _):
117 raise SigtermError() 117 raise SigtermError()
118 signal.signal(signal.SIGTERM, SigtermHandler) 118 signal.signal(signal.SIGTERM, SigtermHandler)
119 119
120 logging.info('Started with pid %d', os.getpid()) 120 logging.info('Started with pid %d', os.getpid())
121 pid_file_path = os.path.join(base_dir, 'LOGCAT_MONITOR_PID') 121 pid_file_path = os.path.join(base_dir, 'LOGCAT_MONITOR_PID')
122 122
123 try: 123 try:
124 with open(pid_file_path, 'w') as f: 124 with open(pid_file_path, 'w') as f:
125 f.write(str(os.getpid())) 125 f.write(str(os.getpid()))
126 while True: 126 while True:
(...skipping 20 matching lines...) Expand all
147 pass 147 pass
148 os.remove(pid_file_path) 148 os.remove(pid_file_path)
149 149
150 150
151 if __name__ == '__main__': 151 if __name__ == '__main__':
152 if 2 <= len(sys.argv) <= 3: 152 if 2 <= len(sys.argv) <= 3:
153 print 'adb_logcat_monitor: Initializing' 153 print 'adb_logcat_monitor: Initializing'
154 sys.exit(main(*sys.argv[1:3])) 154 sys.exit(main(*sys.argv[1:3]))
155 155
156 print 'Usage: %s <base_dir> [<adb_binary_path>]' % sys.argv[0] 156 print 'Usage: %s <base_dir> [<adb_binary_path>]' % sys.argv[0]
OLDNEW
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/adb_logcat_printer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698