Skip to content

Commit 54c5b38

Browse files
committed
Improved handling of --android-api and --ndk-api
1 parent 47a8daf commit 54c5b38

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

pythonforandroid/build.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ def prepare_build_environment(self,
280280
ndk_dir = None
281281
if user_ndk_dir:
282282
ndk_dir = user_ndk_dir
283-
if ndk_dir is not None:
284-
info('Getting NDK dir from from user argument')
283+
info('Getting NDK dir from from user argument')
285284
if ndk_dir is None: # The old P4A-specific dir
286285
ndk_dir = environ.get('ANDROIDNDK', None)
287286
if ndk_dir is not None:
@@ -357,8 +356,7 @@ def prepare_build_environment(self,
357356
ndk_api = None
358357
if user_ndk_api:
359358
ndk_api = user_ndk_api
360-
if ndk_api is not None:
361-
info('Getting NDK API version (i.e. minimum supported API) from user argument')
359+
info('Getting NDK API version (i.e. minimum supported API) from user argument')
362360
if ndk_api is None:
363361
ndk_api = environ.get('NDKAPI', None)
364362
if ndk_api is not None:

pythonforandroid/toolchain.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from __future__ import print_function
1010
from pythonforandroid import __version__
11+
from pythonforandroid.build import DEFAULT_NDK_API, DEFAULT_ANDROID_API
1112

1213

1314
def check_python_dependencies():
@@ -252,16 +253,22 @@ def __init__(self):
252253
'--ndk-dir', '--ndk_dir', dest='ndk_dir', default='',
253254
help='The filepath where the Android NDK is installed')
254255
generic_parser.add_argument(
255-
'--android-api', '--android_api', dest='android_api', default=0,
256-
type=int, help='The Android API level to build against.')
256+
'--android-api',
257+
'--android_api',
258+
dest='android_api',
259+
default=0,
260+
type=int,
261+
help=('The Android API level to build against defaults to {} if '
262+
'not specified.').format(DEFAULT_ANDROID_API))
257263
generic_parser.add_argument(
258264
'--ndk-version', '--ndk_version', dest='ndk_version', default='',
259265
help=('The version of the Android NDK. This is optional: '
260266
'we try to work it out automatically from the ndk_dir.'))
261267
generic_parser.add_argument(
262268
'--ndk-api', type=int, default=0,
263269
help=('The Android API level to compile against. This should be your '
264-
'*minimal supported* API, not normally the same as your --android-api.'))
270+
'*minimal supported* API, not normally the same as your --android-api. '
271+
'Defaults to min(ANDROID_API, {}) if not specified.').format(DEFAULT_NDK_API))
265272
generic_parser.add_argument(
266273
'--symlink-java-src', '--symlink_java_src',
267274
action='store_true',

0 commit comments

Comments
 (0)