diff options
author | 2017-12-19 11:04:21 -0800 | |
---|---|---|
committer | 2017-12-19 11:06:32 -0800 | |
commit | 246ee5601c28e99385a2a722b57c1977d5ef1aa8 (patch) | |
tree | 2593cc4f4b6f167bca254b708545d4e580d75f43 /tools/android/incremental_install.py | |
parent | 56d5ba1ee89ac2dfb4eb5b2b8a076bb372258877 (diff) |
More updates to tools/android modules for compatibility with python 3.
RELNOTES: None.
PiperOrigin-RevId: 179577497
Diffstat (limited to 'tools/android/incremental_install.py')
-rw-r--r-- | tools/android/incremental_install.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/android/incremental_install.py b/tools/android/incremental_install.py index bad2e29c88..254db274fc 100644 --- a/tools/android/incremental_install.py +++ b/tools/android/incremental_install.py @@ -221,7 +221,7 @@ class Adb(object): """Push a given string to a given path on the device in parallel.""" local = self._CreateLocalFile() with open(local, "wb") as f: - f.write(contents) + f.write(contents.encode("utf-8")) return self.Push(local, remote) def Pull(self, remote): @@ -237,7 +237,7 @@ class Adb(object): try: self._Exec(["pull", remote, local]) with open(local, "rb") as f: - return f.read() + return f.read().decode("utf-8") except (AdbError, IOError): return None @@ -339,7 +339,7 @@ def ParseManifest(contents): def GetAppPackage(stub_datafile): """Returns the app package specified in a stub data file.""" with open(stub_datafile, "rb") as f: - return f.readlines()[1].strip() + return f.readlines()[1].decode("utf-8").strip() def UploadDexes(adb, execroot, app_dir, temp_dir, dexmanifest, full_install): @@ -605,7 +605,7 @@ def UploadNativeLibs(adb, native_lib_args, app_dir, full_install): f.result() install_manifest = [ - name + " " + checksum for name, checksum in install_checksums.iteritems()] + name + " " + checksum for name, checksum in install_checksums.items()] adb.PushString("\n".join(install_manifest), targetpath.join(app_dir, "native", "native_manifest")).result() @@ -693,7 +693,7 @@ def SplitIncrementalInstall(adb, app_package, execroot, split_main_apk, adb.InstallMultiple(targetpath.join(execroot, apk), app_package) install_manifest = [ - name + " " + checksum for name, checksum in install_checksums.iteritems()] + name + " " + checksum for name, checksum in install_checksums.items()] adb.PushString("\n".join(install_manifest), targetpath.join(app_dir, "split_manifest")).result() @@ -744,7 +744,7 @@ def IncrementalInstall(adb_path, VerifyInstallTimestamp(adb, app_package) with open(hostpath.join(execroot, dexmanifest), "rb") as f: - dexmanifest = f.read() + dexmanifest = f.read().decode("utf-8") UploadDexes(adb, execroot, app_dir, temp_dir, dexmanifest, bool(apk)) # TODO(ahumesky): UploadDexes waits for all the dexes to be uploaded, and # then UploadResources is called. We could instead enqueue everything @@ -776,16 +776,16 @@ def IncrementalInstall(adb_path, sys.exit("Error: Device unauthorized. Please check the confirmation " "dialog on your device.") except MultipleDevicesError as e: - sys.exit("Error: " + e.message + "\nTry specifying a device serial with " + sys.exit("Error: " + str(e) + "\nTry specifying a device serial with " "\"blaze mobile-install --adb_arg=-s --adb_arg=$ANDROID_SERIAL\"") except OldSdkException as e: sys.exit("Error: The device does not support the API level specified in " "the application's manifest. Check minSdkVersion in " "AndroidManifest.xml") except TimestampException as e: - sys.exit("Error:\n%s" % e.message) + sys.exit("Error:\n%s" % str(e)) except AdbError as e: - sys.exit("Error:\n%s" % e.message) + sys.exit("Error:\n%s" % str(e)) finally: shutil.rmtree(temp_dir, True) |