From 08b959e10070194db487e2e3a8a5e4920e7909a6 Mon Sep 17 00:00:00 2001 From: Knapp Date: Wed, 18 Jun 2014 11:56:22 +0900 Subject: [PATCH] changed script to work with env variable. --- src/build.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/build.py b/src/build.py index 19cbcfa757..6a126eb386 100755 --- a/src/build.py +++ b/src/build.py @@ -266,9 +266,6 @@ def make_package(args): 'GAME or APP') sys.exit(-1) - # Get target android API - android_api = int(os.environ.get('ANDROIDAPI', '8')) - # Render the various templates into control files. render( 'AndroidManifest.tmpl.xml', @@ -278,7 +275,7 @@ def make_package(args): url_scheme=url_scheme, intent_filters=intent_filters, manifest_extra=manifest_extra, - android_api=android_api) + ) render( 'Configuration.tmpl.java', @@ -302,7 +299,7 @@ def make_package(args): # Update the project to a recent version. try: subprocess.call([ANDROID, 'update', 'project', '-p', '.', '-t', - 'android-{}'.format(android_api)]) + 'android-{}'.format(args['sdk_version'])]) except (OSError, IOError): print 'An error occured while calling', ANDROID, 'update' print 'Your PATH must include android tools.' @@ -360,6 +357,9 @@ def make_package(args): if __name__ == '__main__': import argparse + # get default SDK version from environment + android_api = os.environ.get('ANDROIDAPI', 8) + ap = argparse.ArgumentParser(description='''\ Package a Python application for Android. @@ -437,9 +437,9 @@ def make_package(args): default=join(curdir, 'whitelist.txt'), help=('Use a whitelist file to prevent blacklisting of ' 'file in the final APK')) - ap.add_argument('--sdk', dest='sdk_version', default='8', + ap.add_argument('--sdk', dest='sdk_version', default=android_api, help='Android SDK version to use. Default to 8') - ap.add_argument('--minsdk', dest='min_sdk_version', default='8', + ap.add_argument('--minsdk', dest='min_sdk_version', default=android_api, help='Minimum Android SDK version to use. Default to 8') ap.add_argument('--window', dest='window', action='store_true', help='Indicate if the application will be windowed')