init: --no-prompt to skip sdk_path prompt

For running the tests and in other scripted setups, the user prompt is an
annoying. Using --no-prompt means the script can test for failure.
This commit is contained in:
Hans-Christoph Steiner 2014-04-23 19:22:26 -04:00
parent 66df02d5f8
commit ef7c9d89d2
2 changed files with 4 additions and 2 deletions

View File

@ -105,6 +105,8 @@ def main():
help="Alias of the repo signing key in the keystore")
parser.add_option("--android-home", default=None,
help="Path to the Android SDK (sometimes set in ANDROID_HOME)")
parser.add_option("--no-prompt", action="store_true", default=False,
help="Do not prompt for Android SDK path, just fail")
(options, args) = parser.parse_args()
# find root install prefix
@ -127,7 +129,7 @@ def main():
elif not common.test_sdk_exists(test_config):
# if neither --android-home nor the default sdk_path exist, prompt the user
default_sdk_path = '/opt/android-sdk'
while True:
while not options.no_prompt:
s = raw_input('Enter the path to the Android SDK (' + default_sdk_path + ') here:\n> ')
if re.match('^\s*$', s) != None:
test_config['sdk_path'] = default_sdk_path

View File

@ -104,7 +104,7 @@ STORED_ANDROID_HOME=$ANDROID_HOME
unset ANDROID_HOME
echo "ANDROID_HOME: $ANDROID_HOME"
cd $REPOROOT
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME --no-prompt
test -e $KEYSTORE
copy_apks_into_repo $REPOROOT
$fdroid update -c