1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00

wa create workload: better error reporting

Give more informative errors if Android SDK installed but no
platform has been downloaded.
This commit is contained in:
Sergei Trofimov 2015-08-11 16:59:18 +01:00
parent 85eba9c37a
commit a6d374bcff

View File

@ -22,6 +22,7 @@ import textwrap
import argparse import argparse
import shutil import shutil
import getpass import getpass
import subprocess
from collections import OrderedDict from collections import OrderedDict
import yaml import yaml
@ -351,7 +352,12 @@ def create_uiauto_project(path, name, target='1'):
package_name, package_name,
target, target,
path) path)
try:
check_output(command, shell=True) check_output(command, shell=True)
except subprocess.CalledProcessError as e:
if 'is is not valid' in e.output:
message = 'No Android SDK target found; have you run "{} update sdk" and download a platform?'
raise CommandError(message.format(android_path))
build_script = os.path.join(path, 'build.sh') build_script = os.path.join(path, 'build.sh')
with open(build_script, 'w') as wfh: with open(build_script, 'w') as wfh:
@ -390,5 +396,5 @@ def render_template(name, params):
def touch(path): def touch(path):
with open(path, 'w') as wfh: # pylint: disable=unused-variable with open(path, 'w') as _:
pass pass