10000 Moved ndk_api parsing earlier in program initialisation by inclement · Pull Request #1472 · kivy/python-for-android · GitHub
[go: up one dir, main page]

Skip to content

Moved ndk_api parsing earlier in program initialisation #1472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions pythonforandroid/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,7 @@ def prepare_build_environment(self,
'set it with `--ndk-version=...`.')
self.ndk_ver = ndk_ver

ndk_api = None
if user_ndk_api:
ndk_api = user_ndk_api
info('Getting NDK API version (i.e. minimum supported API) from user argument')
elif 'NDKAPI' in environ:
ndk_api = environ.get('NDKAPI', None)
info('Found Android API target in $NDKAPI')
else:
ndk_api = min(self.android_api, DEFAULT_NDK_API)
warning('NDK API target was not set manually, using '
'the default of {} = min(android-api={}, default ndk-api={})'.format(
ndk_api, self.android_api, DEFAULT_NDK_API))
ndk_api = int(ndk_api)
self.ndk_api = ndk_api
self.ndk_api = user_ndk_api
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we possibly keep NDKAPI env var support in? I think this is really important for all options that are more dependent on the installed build env (NDK/SDK/... downloaded) rather than the project itself - because otherwise, these can't be preconfigured to proper defaults in e.g. a docker build env


if self.ndk_api > self.android_api:
error('Target NDK API is {}, higher than the target Android API {}.'.format(
Expand Down
11 changes: 11 additions & 0 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ def split_argument_list(l):
return re.split(r'[ ,]+', l)


def select_ndk_api(user_ndk_api, user_android_api):
ndk_api = min(DEFAULT_NDK_API, user_android_api)
if user_ndk_api == 0:
warning(('No valid --ndk-api received, using the default of {} = '
'min(android-api={}, default ndk-api={})').format(
user_ndk_api, user_android_api, DEFAULT_NDK_API))
return min(21, user_android_api)


class NoAbbrevParser(argparse.ArgumentParser):
"""We want to disable argument abbreviation so as not to interfere
with passing through arguments to build.py, but in python2 argparse
Expand Down Expand Up @@ -528,7 +537,9 @@ def add_parser(subparsers, *args, **kwargs):
self.ndk_dir = args.ndk_dir
self.android_api = args.android_api
self.ndk_version = args.ndk_version
args.ndk_api = select_ndk_api(args.ndk_api, args.android_api)
self.ndk_api = args.ndk_api

self.ctx.symlink_java_src = args.symlink_java_src
self.ctx.java_build_tool = args.java_build_tool

Expand Down
0