Skip to content

Commit ed9ffe1

Browse files
committed
Added missing recommendations command and cleaned up code
1 parent e4ed946 commit ed9ffe1

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

pythonforandroid/recommendations.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,39 @@
1111
MIN_NDK_VERSION = 19
1212
MAX_NDK_VERSION = 20
1313

14+
# DO NOT CHANGE LINE FORMAT: buildozer parses the existence of a RECOMMENDED_NDK_VERSION
1415
RECOMMENDED_NDK_VERSION = "19b"
16+
1517
NDK_DOWNLOAD_URL = "https://developer.android.com/ndk/downloads/"
1618

1719
# Important log messages
1820
NEW_NDK_MESSAGE = 'Newer NDKs may not be fully supported by p4a.'
1921
UNKNOWN_NDK_MESSAGE = (
20-
'Could not determine NDK version, no source.properties in the NDK dir'
22+
'Could not determine NDK version, no source.properties in the NDK dir.'
2123
)
2224
PARSE_ERROR_NDK_MESSAGE = (
23-
'Could not parse $NDK_DIR/source.properties, not checking NDK version'
25+
'Could not parse $NDK_DIR/source.properties, not checking NDK version.'
2426
)
2527
READ_ERROR_NDK_MESSAGE = (
26-
'Unable to read the NDK version from the given directory {ndk_dir}'
28+
'Unable to read the NDK version from the given directory {ndk_dir}.'
2729
)
2830
ENSURE_RIGHT_NDK_MESSAGE = (
2931
'Make sure your NDK version is greater than {min_supported}. If you get '
30-
'build errors, download the recommended NDK {rec_version} from {ndk_url}'
32+
'build errors, download the recommended NDK {rec_version} from {ndk_url}.'
3133
)
3234
NDK_LOWER_THAN_SUPPORTED_MESSAGE = (
3335
'The minimum supported NDK version is {min_supported}. '
34-
'You can download it from {ndk_url}'
36+
'You can download it from {ndk_url}.'
3537
)
3638
UNSUPPORTED_NDK_API_FOR_ARMEABI_MESSAGE = (
3739
'Asked to build for armeabi architecture with API '
38-
'{req_ndk_api}, but API {max_ndk_api} or greater does not support armeabi'
40+
'{req_ndk_api}, but API {max_ndk_api} or greater does not support armeabi.'
3941
)
4042
CURRENT_NDK_VERSION_MESSAGE = (
4143
'Found NDK version {ndk_version}'
4244
)
4345
RECOMMENDED_NDK_VERSION_MESSAGE = (
44-
'Maximum recommended NDK version is {recommended_ndk_version}'
46+
'Maximum recommended NDK version is {recommended_ndk_version}, but newer versions may work.'
4547
)
4648

4749

@@ -218,3 +220,14 @@ def check_python_version():
218220
):
219221

220222
raise BuildInterruptingException(PY_VERSION_ERROR_TEXT)
223+
224+
def print_recommendations():
225+
"""
226+
Print the main recommended dependency versions as simple key-value pairs.
227+
"""
228+
print(f'Min supported NDK version: {MIN_NDK_VERSION}')
229+
print(f'Recommended NDK version: {RECOMMENDED_NDK_VERSION}')
230+
print(f'Min target API: {MIN_TARGET_API}')
231+
print(f'Recommended target API: {RECOMMENDED_TARGET_API}')
232+
print(f'Min NDK API: {MIN_NDK_API}')
233+
print(f'Recommended NDK API: {RECOMMENDED_NDK_API}')

pythonforandroid/toolchain.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pythonforandroid import __version__
1212
from pythonforandroid.pythonpackage import get_dep_names_of_package
1313
from pythonforandroid.recommendations import (
14-
RECOMMENDED_NDK_API, RECOMMENDED_TARGET_API)
14+
RECOMMENDED_NDK_API, RECOMMENDED_TARGET_API, print_recommendations)
1515
from pythonforandroid.util import BuildInterruptingException
1616
from pythonforandroid.entrypoints import main
1717

@@ -1159,6 +1159,9 @@ def _adb(self, commands):
11591159
sys.stdout.write(line)
11601160
sys.stdout.flush()
11611161

1162+
def recommendations(self, args):
1163+
print_recommendations()
1164+
11621165
def build_status(self, _args):
11631166
"""Print the status of the specified build. """
11641167
print('{Style.BRIGHT}Bootstraps whose core components are probably '

0 commit comments

Comments
 (0)