From 21d929cd9821e9ebb5f2b37ff4a15ffadfc66b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Mon, 6 Mar 2023 19:09:22 +0200 Subject: [PATCH 1/3] android_api to integer --- pythonforandroid/bootstraps/common/build/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 97fd48daf6..6995738329 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -497,7 +497,7 @@ def make_package(args): # Find the SDK directory and target API with open('project.properties', 'r') as fileh: target = fileh.read().strip() - android_api = target.split('-')[1] + android_api = int(target.split('-')[1]) try: int(android_api) except (ValueError, TypeError): From 534ff7af65dde4887bb2140384d4fb3c6ff47c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Sun, 12 Mar 2023 12:27:35 +0200 Subject: [PATCH 2/3] changes to android_api --- pythonforandroid/bootstraps/common/build/build.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 6995738329..fe77ac322b 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -497,15 +497,9 @@ def make_package(args): # Find the SDK directory and target API with open('project.properties', 'r') as fileh: target = fileh.read().strip() - android_api = int(target.split('-')[1]) - try: - int(android_api) - except (ValueError, TypeError): - raise ValueError( - "failed to extract the Android API level from " + - "build.properties. expected int, got: '" + - str(android_api) + "'" - ) + aapi = target.split('-')[1] + android_api = int(aapi) if aapi.isdigit() else -1 + with open('local.properties', 'r') as fileh: sdk_dir = fileh.read().strip() sdk_dir = sdk_dir[8:] From 10f07e7ea2db185708ae9e0adbcca3802ad8db94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lindstr=C3=B6m?= Date: Sun, 12 Mar 2023 13:54:27 +0200 Subject: [PATCH 3/3] changes to android_api --- pythonforandroid/bootstraps/common/build/build.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index fe77ac322b..3aaf51d009 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -497,8 +497,16 @@ def make_package(args): # Find the SDK directory and target API with open('project.properties', 'r') as fileh: target = fileh.read().strip() - aapi = target.split('-')[1] - android_api = int(aapi) if aapi.isdigit() else -1 + android_api = target.split('-')[1] + + if android_api.isdigit(): + android_api = int(android_api) + else: + raise ValueError( + "failed to extract the Android API level from " + + "build.properties. expected int, got: '" + + str(android_api) + "'" + ) with open('local.properties', 'r') as fileh: sdk_dir = fileh.read().strip()