Skip to content

Commit

Permalink
changed script to work with env variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
knappador committed Jun 18, 2014
1 parent 7e8387d commit 08b959e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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.'
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 08b959e

Please sign in to comment.