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

Side by Side Diff: build/android/gyp/apk_install.py

Issue 197693002: [Android] Lint build/android/gyp/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 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 """Installs an APK. 7 """Installs an APK.
8 8
9 """ 9 """
10 10
11 import optparse 11 import optparse
12 import os 12 import os
13 import re 13 import re
14 import subprocess
15 import sys 14 import sys
16 15
16 # pylint: disable=F0401
17 from util import build_device 17 from util import build_device
18 from util import build_utils 18 from util import build_utils
19 from util import md5_check 19 from util import md5_check
20 # pylint: enable=F0401
20 21
21 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') 22 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..')
22 sys.path.append(BUILD_ANDROID_DIR) 23 sys.path.append(BUILD_ANDROID_DIR)
23 24
24 from pylib import constants 25 from pylib import constants
25 from pylib.utils import apk_helper 26 from pylib.utils import apk_helper
26 27
27 def GetNewMetadata(device, apk_package): 28 def GetNewMetadata(device, apk_package):
28 """Gets the metadata on the device for the apk_package apk.""" 29 """Gets the metadata on the device for the apk_package apk."""
29 output = device.RunShellCommand('ls -l /data/app/') 30 output = device.RunShellCommand('ls -l /data/app/')
(...skipping 18 matching lines...) Expand all
48 def RecordInstallMetadata(device, apk_package, metadata_path): 49 def RecordInstallMetadata(device, apk_package, metadata_path):
49 """Records the metadata from the device for apk_package.""" 50 """Records the metadata from the device for apk_package."""
50 metadata = GetNewMetadata(device, apk_package) 51 metadata = GetNewMetadata(device, apk_package)
51 if not metadata: 52 if not metadata:
52 raise Exception('APK install failed unexpectedly.') 53 raise Exception('APK install failed unexpectedly.')
53 54
54 with open(metadata_path, 'w') as outfile: 55 with open(metadata_path, 'w') as outfile:
55 outfile.write(metadata) 56 outfile.write(metadata)
56 57
57 58
58 def main(argv): 59 def main():
59 parser = optparse.OptionParser() 60 parser = optparse.OptionParser()
60 parser.add_option('--apk-path', 61 parser.add_option('--apk-path',
61 help='Path to .apk to install.') 62 help='Path to .apk to install.')
62 parser.add_option('--install-record', 63 parser.add_option('--install-record',
63 help='Path to install record (touched only when APK is installed).') 64 help='Path to install record (touched only when APK is installed).')
64 parser.add_option('--build-device-configuration', 65 parser.add_option('--build-device-configuration',
65 help='Path to build device configuration.') 66 help='Path to build device configuration.')
66 parser.add_option('--stamp', 67 parser.add_option('--stamp',
67 help='Path to touch on success.') 68 help='Path to touch on success.')
68 parser.add_option('--configuration-name', 69 parser.add_option('--configuration-name',
(...skipping 27 matching lines...) Expand all
96 Install, 97 Install,
97 record_path=record_path, 98 record_path=record_path,
98 input_paths=[options.apk_path], 99 input_paths=[options.apk_path],
99 force=force_install) 100 force=force_install)
100 101
101 if options.stamp: 102 if options.stamp:
102 build_utils.Touch(options.stamp) 103 build_utils.Touch(options.stamp)
103 104
104 105
105 if __name__ == '__main__': 106 if __name__ == '__main__':
106 sys.exit(main(sys.argv)) 107 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698