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

Side by Side Diff: build/android/pylib/flag_changer.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/pylib/device/adb_wrapper_test.py ('k') | build/android/pylib/forwarder.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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import constants
6 import logging 5 import logging
7 import traceback
8 6
9 7
10 class FlagChanger(object): 8 class FlagChanger(object):
11 """Changes the flags Chrome runs with. 9 """Changes the flags Chrome runs with.
12 10
13 There are two different use cases for this file: 11 There are two different use cases for this file:
14 * Flags are permanently set by calling Set(). 12 * Flags are permanently set by calling Set().
15 * Flags can be temporarily set for a particular set of unit tests. These 13 * Flags can be temporarily set for a particular set of unit tests. These
16 tests should call Restore() to revert the flags to their original state 14 tests should call Restore() to revert the flags to their original state
17 once the tests have completed. 15 once the tests have completed.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( 104 assert len(file_contents) == 1 and file_contents[0] == cmd_line, (
107 'Failed to set the command line file at %s' % self._cmdline_file) 105 'Failed to set the command line file at %s' % self._cmdline_file)
108 else: 106 else:
109 if use_root: 107 if use_root:
110 self._adb.RunShellCommandWithSU('rm ' + self._cmdline_file) 108 self._adb.RunShellCommandWithSU('rm ' + self._cmdline_file)
111 else: 109 else:
112 self._adb.RunShellCommand('rm ' + self._cmdline_file) 110 self._adb.RunShellCommand('rm ' + self._cmdline_file)
113 assert not self._adb.FileExistsOnDevice(self._cmdline_file), ( 111 assert not self._adb.FileExistsOnDevice(self._cmdline_file), (
114 'Failed to remove the command line file at %s' % self._cmdline_file) 112 'Failed to remove the command line file at %s' % self._cmdline_file)
115 113
116 def _TokenizeFlags(self, line): 114 @staticmethod
115 def _TokenizeFlags(line):
117 """Changes the string containing the command line into a list of flags. 116 """Changes the string containing the command line into a list of flags.
118 117
119 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: 118 Follows similar logic to CommandLine.java::tokenizeQuotedArguments:
120 * Flags are split using whitespace, unless the whitespace is within a 119 * Flags are split using whitespace, unless the whitespace is within a
121 pair of quotation marks. 120 pair of quotation marks.
122 * Unlike the Java version, we keep the quotation marks around switch 121 * Unlike the Java version, we keep the quotation marks around switch
123 values since we need them to re-create the file when new flags are 122 values since we need them to re-create the file when new flags are
124 appended. 123 appended.
125 124
126 Args: 125 Args:
(...skipping 26 matching lines...) Expand all
153 152
154 # Tack on the last flag. 153 # Tack on the last flag.
155 if not current_flag: 154 if not current_flag:
156 if within_quotations: 155 if within_quotations:
157 logging.warn('Unterminated quoted argument: ' + line) 156 logging.warn('Unterminated quoted argument: ' + line)
158 else: 157 else:
159 tokenized_flags.append(current_flag) 158 tokenized_flags.append(current_flag)
160 159
161 # Return everything but the program name. 160 # Return everything but the program name.
162 return tokenized_flags[1:] 161 return tokenized_flags[1:]
OLDNEW
« no previous file with comments | « build/android/pylib/device/adb_wrapper_test.py ('k') | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698