def get_parser_install():
parser = argparse.ArgumentParser()
parser.add_argument("--path", dest="dest",
help="Root path to use for emulator tooling")
parser.add_argument("--reinstall", action="store_true",
help="Force reinstall even if the emulator already exists")
parser.add_argument("--prompt", action="store_true",
help="Enable confirmation prompts")
parser.add_argument("--no-prompt", dest="prompt", action="store_false",
help="Skip confirmation prompts") return parser
def get_parser_start():
parser = get_parser_install()
parser.add_argument("--device-serial",
help="Device serial number for Android emulator, if not emulator-5554") return parser
os_name = platform.system().lower() if os_name notin urls:
logger.error(f"Don't know how to install old emulator for {os_name}, using latest version") # For now try with the latest version if this fails return
logger.info(f"Downgrading emulator to {version}")
url = urls[os_name]
with open(package_path) as f:
tree = ElementTree.parse(f)
node = tree.find("localPackage").find("revision") assert len(node) == 3
parts = version.split(".") for version_part, node in zip(parts, node):
node.text = version_part with open(package_path, "wb") as f:
tree.write(f, encoding="utf8")
if os_name == "macosx": return"darwin" if os_name == "windows": return"win" return"linux"
def download_and_extract(url, path): ifnot os.path.exists(path):
os.makedirs(path)
temp_path = os.path.join(path, url.rsplit("/", 1)[1]) try: with open(temp_path, "wb") as f: with requests.get(url, stream=True) as resp:
shutil.copyfileobj(resp.raw, f)
# Python's zipfile module doesn't seem to work here
subprocess.check_call(["unzip", temp_path], cwd=path) finally: if os.path.exists(temp_path):
os.unlink(temp_path)
def install_sdk(logger, paths): if os.path.isdir(paths["sdk_tools"]):
logger.info("Using SDK installed at %s" % paths["sdk_tools"]) returnFalse
def __enter__(self):
self.environ = os.environ.copy() for key, value in self.set_environ.items(): if value isNone: if key in os.environ: del os.environ[key] else:
os.environ[key] = value
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.