summaryrefslogtreecommitdiff
path: root/buildscripts/mobile
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2019-02-19 10:50:57 -0500
committerMathew Robinson <chasinglogic@gmail.com>2019-04-08 14:08:49 -0400
commit8dd6d4755734ed37c1b98dfdefce3ca6bc65f1f6 (patch)
tree69e936c4953cbead2e3bae2690157c5fe75e709d /buildscripts/mobile
parentc600aa9d7423eca8151daf626e2799d9a6c7b31c (diff)
downloadmongo-8dd6d4755734ed37c1b98dfdefce3ca6bc65f1f6.tar.gz
SERVER-32295 Support Python 3
Diffstat (limited to 'buildscripts/mobile')
-rw-r--r--buildscripts/mobile/adb_monitor.py9
-rw-r--r--buildscripts/mobile/benchrun_embedded_setup_android.py28
2 files changed, 19 insertions, 18 deletions
diff --git a/buildscripts/mobile/adb_monitor.py b/buildscripts/mobile/adb_monitor.py
index d33a37e08d8..1f7c350f309 100644
--- a/buildscripts/mobile/adb_monitor.py
+++ b/buildscripts/mobile/adb_monitor.py
@@ -132,14 +132,14 @@ class Adb(object):
def systrace_stop(self, output_file=None):
"""Stop the systrace.py script."""
- self._cmd.send_to_process("bye")
+ self._cmd.send_to_process(b"bye")
with open(self._tempfile) as fh:
buff = fh.read()
os.remove(self._tempfile)
self.logger.debug("systrace_stop: %s", buff)
if "Wrote trace" not in buff:
self.logger.error("CPU file not saved: %s", buff)
- if os.path.isfile(output_file):
+ if output_file and os.path.isfile(output_file):
os.remove(output_file)
@@ -410,8 +410,9 @@ def main(): #pylint: disable=too-many-statements
output_files[options.cpu_file] = fileops.getmtime(options.cpu_file)
LOGGER.setLevel(options.log_level.upper())
- LOGGER.info("This program can be cleanly terminated by issuing the following command:"
- "\n\t\t'kill -INT %d'", os.getpid())
+ LOGGER.info(
+ "This program can be cleanly terminated by issuing the following command:"
+ "\n\t\t'kill -INT %d'", os.getpid())
adb = Adb(options.adb_binary)
LOGGER.info("Detected devices by adb:\n%s%s", adb.devices(), adb.device_available())
diff --git a/buildscripts/mobile/benchrun_embedded_setup_android.py b/buildscripts/mobile/benchrun_embedded_setup_android.py
index 92f18d334a1..94a08077f93 100644
--- a/buildscripts/mobile/benchrun_embedded_setup_android.py
+++ b/buildscripts/mobile/benchrun_embedded_setup_android.py
@@ -1,8 +1,6 @@
#!/usr/bin/env python
"""Setup an Android device to run the benchrun_embedded test suite."""
-from __future__ import print_function
-
import glob
import logging
import optparse
@@ -13,7 +11,7 @@ import sys
import tarfile
import tempfile
import time
-import urllib
+import urllib.request, urllib.parse, urllib.error
# pylint: disable=wrong-import-position
# Get relative imports to work when the package is not installed on the PYTHONPATH.
@@ -30,7 +28,7 @@ def download_and_untar(url, root_dir):
"""Download url and untar into root_dir."""
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".tgz").name
LOGGER.info("Downloading %s", url)
- urllib.urlretrieve(url, temp_file)
+ urllib.request.urlretrieve(url, temp_file)
with tarfile.open(temp_file, "r:gz") as tar:
tar.extractall(root_dir)
os.remove(temp_file)
@@ -130,10 +128,10 @@ def main():
help="The remote directory to store the embedded SDK files. Defaults to '%default'.",
default=posixpath.join(benchrun_root, "sdk"))
- device_options.add_option("--benchrunJsonRemoteDir", dest="json_remote_dir",
- help="The remote directory to store the benchrun JSON files."
- " Defaults to '%default'.", default=posixpath.join(
- benchrun_root, "testcases"))
+ device_options.add_option(
+ "--benchrunJsonRemoteDir", dest="json_remote_dir",
+ help="The remote directory to store the benchrun JSON files."
+ " Defaults to '%default'.", default=posixpath.join(benchrun_root, "testcases"))
sdk_url = "https://s3.amazonaws.com/mciuploads/mongodb-mongo-master/embedded-sdk-test/embedded-sdk-android-arm64-latest.tgz"
sdk_options.add_option(
@@ -142,9 +140,10 @@ def main():
" any required shared object (.so) libraries. Defaults to '%default'."),
default=sdk_url)
- sdk_options.add_option("--sdkLocalDir", dest="sdk_local_dir",
- help="The local directory of embedded SDK files to be copied."
- "If specified, overrides --sdkUrl.", default=None)
+ sdk_options.add_option(
+ "--sdkLocalDir", dest="sdk_local_dir",
+ help="The local directory of embedded SDK files to be copied."
+ "If specified, overrides --sdkUrl.", default=None)
sdk_options.add_option(
"--sdkSaveLocalDir", dest="sdk_save_local_dir",
@@ -159,9 +158,10 @@ def main():
" files to be used in the benchrun embedded test."
" Defaults to '%default'."), default=json_url)
- json_options.add_option("--benchrunJsonLocalDir", dest="json_local_dir",
- help="The local directory of benchrun JSON files to be copied."
- "If specified, overrides --benchrunJsonUrl.", default=None)
+ json_options.add_option(
+ "--benchrunJsonLocalDir", dest="json_local_dir",
+ help="The local directory of benchrun JSON files to be copied."
+ "If specified, overrides --benchrunJsonUrl.", default=None)
json_options.add_option(
"--benchrunJsonSaveLocalDir", dest="json_save_local_dir",