From 906ebd6b8d1d3943c3c23541a8f5354f22395213 Mon Sep 17 00:00:00 2001 From: "ivan.wu" Date: Fri, 26 Jul 2024 09:06:41 +0800 Subject: [PATCH 01/10] feature: add recipes orjson and tiktoken. --- pythonforandroid/recipes/orjson/__init__.py | 10 ++++++++++ pythonforandroid/recipes/tiktoken/__init__.py | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 pythonforandroid/recipes/orjson/__init__.py create mode 100644 pythonforandroid/recipes/tiktoken/__init__.py diff --git a/pythonforandroid/recipes/orjson/__init__.py b/pythonforandroid/recipes/orjson/__init__.py new file mode 100644 index 0000000000..cec5d1515c --- /dev/null +++ b/pythonforandroid/recipes/orjson/__init__.py @@ -0,0 +1,10 @@ +from pythonforandroid.recipe import RustCompiledComponentsRecipe + + +class OrjsonRecipe(RustCompiledComponentsRecipe): + version = '3.10.6' + url = 'https://pypi.python.org/packages/source/o/orjson/orjson-{version}.tar.gz' + site_packages_name = 'orjson' + + +recipe = OrjsonRecipe() \ No newline at end of file diff --git a/pythonforandroid/recipes/tiktoken/__init__.py b/pythonforandroid/recipes/tiktoken/__init__.py new file mode 100644 index 0000000000..bdd9eb3cb0 --- /dev/null +++ b/pythonforandroid/recipes/tiktoken/__init__.py @@ -0,0 +1,10 @@ +from pythonforandroid.recipe import RustCompiledComponentsRecipe + + +class TiktokenRecipe(RustCompiledComponentsRecipe): + version = '0.7.0' + url = 'https://pypi.python.org/packages/source/t/tiktoken/tiktoken-{version}.tar.gz' + site_packages_name = "tiktoken" + + +recipe = TiktokenRecipe() \ No newline at end of file From b525c6475c98af0f23772aecad27fc9067370f33 Mon Sep 17 00:00:00 2001 From: "ivan.wu" Date: Fri, 26 Jul 2024 09:10:43 +0800 Subject: [PATCH 02/10] fix: use local file for aar. --- .../bootstraps/common/build/templates/build.tmpl.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle index 750a435d99..df7dcb5666 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -110,7 +110,7 @@ android { dependencies { {%- for aar in aars %} - implementation(name: '{{ aar }}', ext: 'aar') + implementation files('libs/{{ aar }}') {%- endfor -%} {%- for jar in jars %} implementation files('src/main/libs/{{ jar }}') From a2086e9c7e3e10a4492bd926ad2080bf13400df4 Mon Sep 17 00:00:00 2001 From: "ivan.wu" Date: Fri, 26 Jul 2024 17:35:23 +0800 Subject: [PATCH 03/10] fix: optimize package size. --- .../bootstraps/common/build/templates/build.tmpl.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle index df7dcb5666..e945b8327c 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -35,6 +35,9 @@ android { versionCode {{ args.numeric_version }} versionName '{{ args.version }}' manifestPlaceholders = {{ args.manifest_placeholders}} + ndk { + abiFilters 'arm64-v8a' + } } From bb6e2e34e22d31eda3c96e6de47cc5d74c12e5ef Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Mon, 29 Jul 2024 09:30:23 +0800 Subject: [PATCH 04/10] fix: add extension name for aar files. --- .../bootstraps/common/build/templates/build.tmpl.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle index e945b8327c..f4292f4d1d 100644 --- a/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle +++ b/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle @@ -113,7 +113,7 @@ android { dependencies { {%- for aar in aars %} - implementation files('libs/{{ aar }}') + implementation files('libs/{{ aar }}.aar') {%- endfor -%} {%- for jar in jars %} implementation files('src/main/libs/{{ jar }}') From aaea2be6aa570a2ff09db72486d9d99632710b7a Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Mon, 29 Jul 2024 18:53:15 +0800 Subject: [PATCH 05/10] fix: replace git command. --- pythonforandroid/recipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index c4131c53e6..2ce6702913 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -236,7 +236,7 @@ def report_hook(index, blksize, size): if self.version: shprint(sh.git, 'fetch', '--tags', '--depth', '1') shprint(sh.git, 'checkout', self.version) - branch = sh.git('branch', '--show-current') + branch = sh.git('rev-parse' '--abbrev-ref' 'HEAD') if branch: shprint(sh.git, 'pull') shprint(sh.git, 'pull', '--recurse-submodules') From 24ea6a7b4655d39b1327bb2059afaa8d20090bfe Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Mon, 29 Jul 2024 18:57:17 +0800 Subject: [PATCH 06/10] fix: fix git command. --- pythonforandroid/recipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index 2ce6702913..6efbc3f830 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -236,7 +236,7 @@ def report_hook(index, blksize, size): if self.version: shprint(sh.git, 'fetch', '--tags', '--depth', '1') shprint(sh.git, 'checkout', self.version) - branch = sh.git('rev-parse' '--abbrev-ref' 'HEAD') + branch = sh.git('rev-parse', '--abbrev-ref', 'HEAD') if branch: shprint(sh.git, 'pull') shprint(sh.git, 'pull', '--recurse-submodules') From 68ab3f019d3175299967c8066deddc979e8d3ff0 Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Mon, 29 Jul 2024 19:29:55 +0800 Subject: [PATCH 07/10] rollback: restore git command. --- pythonforandroid/recipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipe.py b/pythonforandroid/recipe.py index 6efbc3f830..c4131c53e6 100644 --- a/pythonforandroid/recipe.py +++ b/pythonforandroid/recipe.py @@ -236,7 +236,7 @@ def report_hook(index, blksize, size): if self.version: shprint(sh.git, 'fetch', '--tags', '--depth', '1') shprint(sh.git, 'checkout', self.version) - branch = sh.git('rev-parse', '--abbrev-ref', 'HEAD') + branch = sh.git('branch', '--show-current') if branch: shprint(sh.git, 'pull') shprint(sh.git, 'pull', '--recurse-submodules') From 8e975dde8d9ea225ffc7ccbd3fac8ae7745712a7 Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Tue, 6 Aug 2024 12:07:20 +0800 Subject: [PATCH 08/10] fix: fix TypeError: expected str, ..., not NoneType --- pythonforandroid/bootstraps/common/build/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pythonforandroid/bootstraps/common/build/build.py b/pythonforandroid/bootstraps/common/build/build.py index 51e0a5fa94..c6076d4cb3 100644 --- a/pythonforandroid/bootstraps/common/build/build.py +++ b/pythonforandroid/bootstraps/common/build/build.py @@ -167,6 +167,8 @@ def clean(tinfo): continue if fn.endswith('.py') and byte_compile_python: fn = compile_py_file(fn, optimize_python=optimize_python) + if fn is None: + continue files.append((fn, relpath(realpath(fn), sd))) files.sort() # deterministic From 43075c5c51dc99f8f96cc307b88f905c71d48f14 Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Thu, 15 Aug 2024 16:52:41 +0800 Subject: [PATCH 09/10] feat: add jiter recipe --- pythonforandroid/recipes/jiter/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 pythonforandroid/recipes/jiter/__init__.py diff --git a/pythonforandroid/recipes/jiter/__init__.py b/pythonforandroid/recipes/jiter/__init__.py new file mode 100644 index 0000000000..7b927ce1eb --- /dev/null +++ b/pythonforandroid/recipes/jiter/__init__.py @@ -0,0 +1,10 @@ +from pythonforandroid.recipe import RustCompiledComponentsRecipe + + +class JiterRecipe(RustCompiledComponentsRecipe): + version = '0.5.0' + url = 'https://pypi.python.org/packages/source/j/jiter/jiter-{version}.tar.gz' + site_packages_name = 'jiter' + + +recipe = JiterRecipe() From a8eadc219f249744127151ec3876221f9f2dc329 Mon Sep 17 00:00:00 2001 From: Ivan Wu Date: Wed, 6 Nov 2024 17:36:53 +0800 Subject: [PATCH 10/10] Build service library without new process --- .../service_library/build/templates/AndroidManifest.tmpl.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pythonforandroid/bootstraps/service_library/build/templates/AndroidManifest.tmpl.xml b/pythonforandroid/bootstraps/service_library/build/templates/AndroidManifest.tmpl.xml index 017a1588ec..8766a2efc9 100644 --- a/pythonforandroid/bootstraps/service_library/build/templates/AndroidManifest.tmpl.xml +++ b/pythonforandroid/bootstraps/service_library/build/templates/AndroidManifest.tmpl.xml @@ -9,7 +9,6 @@ {% for name in service_names %} {% endfor %}