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

Side by Side Diff: build/android/pylib/device/commands/install_commands.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 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/content_settings.py ('k') | build/android/pylib/device_settings.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 os 5 import os
6 import posixpath 6 import posixpath
7 7
8 from devil.android import device_errors
8 from pylib import constants 9 from pylib import constants
9 10
10 BIN_DIR = '%s/bin' % constants.TEST_EXECUTABLE_DIR 11 BIN_DIR = '%s/bin' % constants.TEST_EXECUTABLE_DIR
11 _FRAMEWORK_DIR = '%s/framework' % constants.TEST_EXECUTABLE_DIR 12 _FRAMEWORK_DIR = '%s/framework' % constants.TEST_EXECUTABLE_DIR
12 13
13 _COMMANDS = { 14 _COMMANDS = {
14 'unzip': 'org.chromium.android.commands.unzip.Unzip', 15 'unzip': 'org.chromium.android.commands.unzip.Unzip',
15 } 16 }
16 17
17 _SHELL_COMMAND_FORMAT = ( 18 _SHELL_COMMAND_FORMAT = (
18 """#!/system/bin/sh 19 """#!/system/bin/sh
19 base=%s 20 base=%s
20 export CLASSPATH=$base/framework/chromium_commands.jar 21 export CLASSPATH=$base/framework/chromium_commands.jar
21 exec app_process $base/bin %s $@ 22 exec app_process $base/bin %s $@
22 """) 23 """)
23 24
24 25
25 def Installed(device): 26 def Installed(device):
26 paths = [posixpath.join(BIN_DIR, c) for c in _COMMANDS] 27 paths = [posixpath.join(BIN_DIR, c) for c in _COMMANDS]
27 paths.append(posixpath.join(_FRAMEWORK_DIR, 'chromium_commands.jar')) 28 paths.append(posixpath.join(_FRAMEWORK_DIR, 'chromium_commands.jar'))
28 return device.PathExists(paths) 29 return device.PathExists(paths)
29 30
30 31
31 def InstallCommands(device): 32 def InstallCommands(device):
32 if device.IsUserBuild(): 33 if device.IsUserBuild():
33 raise Exception('chromium_commands currently requires a userdebug build.') 34 raise device_errors.CommandFailedError(
35 'chromium_commands currently requires a userdebug build.',
36 device_serial=device.GetDeviceSerial())
34 37
35 chromium_commands_jar_path = os.path.join( 38 chromium_commands_jar_path = os.path.join(
36 constants.GetOutDirectory(), constants.SDK_BUILD_JAVALIB_DIR, 39 constants.GetOutDirectory(), constants.SDK_BUILD_JAVALIB_DIR,
37 'chromium_commands.dex.jar') 40 'chromium_commands.dex.jar')
38 if not os.path.exists(chromium_commands_jar_path): 41 if not os.path.exists(chromium_commands_jar_path):
39 raise Exception('%s not found. Please build chromium_commands.' 42 raise device_errors.CommandFailedError(
40 % chromium_commands_jar_path) 43 '%s not found. Please build chromium_commands.'
44 % chromium_commands_jar_path)
41 45
42 device.RunShellCommand(['mkdir', BIN_DIR, _FRAMEWORK_DIR]) 46 device.RunShellCommand(['mkdir', BIN_DIR, _FRAMEWORK_DIR])
43 for command, main_class in _COMMANDS.iteritems(): 47 for command, main_class in _COMMANDS.iteritems():
44 shell_command = _SHELL_COMMAND_FORMAT % ( 48 shell_command = _SHELL_COMMAND_FORMAT % (
45 constants.TEST_EXECUTABLE_DIR, main_class) 49 constants.TEST_EXECUTABLE_DIR, main_class)
46 shell_file = '%s/%s' % (BIN_DIR, command) 50 shell_file = '%s/%s' % (BIN_DIR, command)
47 device.WriteFile(shell_file, shell_command) 51 device.WriteFile(shell_file, shell_command)
48 device.RunShellCommand( 52 device.RunShellCommand(
49 ['chmod', '755', shell_file], check_return=True) 53 ['chmod', '755', shell_file], check_return=True)
50 54
51 device.adb.Push( 55 device.adb.Push(
52 chromium_commands_jar_path, 56 chromium_commands_jar_path,
53 '%s/chromium_commands.jar' % _FRAMEWORK_DIR) 57 '%s/chromium_commands.jar' % _FRAMEWORK_DIR)
54 58
OLDNEW
« no previous file with comments | « build/android/pylib/content_settings.py ('k') | build/android/pylib/device_settings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698