diff --git a/pythonforandroid/recommendations.py b/pythonforandroid/recommendations.py index a4a0531558..163e4ae6d5 100644 --- a/pythonforandroid/recommendations.py +++ b/pythonforandroid/recommendations.py @@ -11,37 +11,39 @@ MIN_NDK_VERSION = 19 MAX_NDK_VERSION = 20 +# DO NOT CHANGE LINE FORMAT: buildozer parses the existence of a RECOMMENDED_NDK_VERSION RECOMMENDED_NDK_VERSION = "19b" + NDK_DOWNLOAD_URL = "https://developer.android.com/ndk/downloads/" # Important log messages NEW_NDK_MESSAGE = 'Newer NDKs may not be fully supported by p4a.' UNKNOWN_NDK_MESSAGE = ( - 'Could not determine NDK version, no source.properties in the NDK dir' + 'Could not determine NDK version, no source.properties in the NDK dir.' ) PARSE_ERROR_NDK_MESSAGE = ( - 'Could not parse $NDK_DIR/source.properties, not checking NDK version' + 'Could not parse $NDK_DIR/source.properties, not checking NDK version.' ) READ_ERROR_NDK_MESSAGE = ( - 'Unable to read the NDK version from the given directory {ndk_dir}' + 'Unable to read the NDK version from the given directory {ndk_dir}.' ) ENSURE_RIGHT_NDK_MESSAGE = ( 'Make sure your NDK version is greater than {min_supported}. If you get ' - 'build errors, download the recommended NDK {rec_version} from {ndk_url}' + 'build errors, download the recommended NDK {rec_version} from {ndk_url}.' ) NDK_LOWER_THAN_SUPPORTED_MESSAGE = ( 'The minimum supported NDK version is {min_supported}. ' - 'You can download it from {ndk_url}' + 'You can download it from {ndk_url}.' ) UNSUPPORTED_NDK_API_FOR_ARMEABI_MESSAGE = ( 'Asked to build for armeabi architecture with API ' - '{req_ndk_api}, but API {max_ndk_api} or greater does not support armeabi' + '{req_ndk_api}, but API {max_ndk_api} or greater does not support armeabi.' ) CURRENT_NDK_VERSION_MESSAGE = ( 'Found NDK version {ndk_version}' ) RECOMMENDED_NDK_VERSION_MESSAGE = ( - 'Maximum recommended NDK version is {recommended_ndk_version}' + 'Maximum recommended NDK version is {recommended_ndk_version}, but newer versions may work.' ) @@ -187,7 +189,7 @@ def check_ndk_api(ndk_api, android_api): MIN_PYTHON_MAJOR_VERSION = 3 -MIN_PYTHON_MINOR_VERSION = 4 +MIN_PYTHON_MINOR_VERSION = 6 MIN_PYTHON_VERSION = LooseVersion('{major}.{minor}'.format(major=MIN_PYTHON_MAJOR_VERSION, minor=MIN_PYTHON_MINOR_VERSION)) PY2_ERROR_TEXT = ( @@ -218,3 +220,15 @@ def check_python_version(): ): raise BuildInterruptingException(PY_VERSION_ERROR_TEXT) + + +def print_recommendations(): + """ + Print the main recommended dependency versions as simple key-value pairs. + """ + print('Min supported NDK version: {}'.format(MIN_NDK_VERSION)) + print('Recommended NDK version: {}'.format(RECOMMENDED_NDK_VERSION)) + print('Min target API: {}'.format(MIN_TARGET_API)) + print('Recommended target API: {}'.format(RECOMMENDED_TARGET_API)) + print('Min NDK API: {}'.format(MIN_NDK_API)) + print('Recommended NDK API: {}'.format(RECOMMENDED_NDK_API)) diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index cb15ca0392..d7ca829286 100644 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -11,7 +11,7 @@ from pythonforandroid import __version__ from pythonforandroid.pythonpackage import get_dep_names_of_package from pythonforandroid.recommendations import ( - RECOMMENDED_NDK_API, RECOMMENDED_TARGET_API) + RECOMMENDED_NDK_API, RECOMMENDED_TARGET_API, print_recommendations) from pythonforandroid.util import BuildInterruptingException from pythonforandroid.entrypoints import main @@ -1159,6 +1159,9 @@ def _adb(self, commands): sys.stdout.write(line) sys.stdout.flush() + def recommendations(self, args): + print_recommendations() + def build_status(self, _args): """Print the status of the specified build. """ print('{Style.BRIGHT}Bootstraps whose core components are probably ' diff --git a/tests/test_recommendations.py b/tests/test_recommendations.py index 649fb3b1f9..3e9db9fe9e 100644 --- a/tests/test_recommendations.py +++ b/tests/test_recommendations.py @@ -9,6 +9,7 @@ check_target_api, read_ndk_version, check_python_version, + print_recommendations, MAX_NDK_VERSION, RECOMMENDED_NDK_VERSION, RECOMMENDED_TARGET_API, @@ -237,3 +238,12 @@ def test_check_python_version(self): fake_version_info.major = MIN_PYTHON_MAJOR_VERSION fake_version_info.minor = MIN_PYTHON_MINOR_VERSION check_python_version() + + def test_print_recommendations(self): + """ + Simple test that the function actually runs. + """ + # The main failure mode is if the function tries to print a variable + # that doesn't actually exist, so simply running to check all the + # prints work is the most important test. + print_recommendations()