Skip to content

Commit 4ee7cc7

Browse files
committed
🚧 Rework aiohttp recipe for Python 3.14
Switches aiohttp to 3.13.5 and PyProjectRecipe, setting AIOHTTP_NO_EXTENSIONS=1 so the C extensions are skipped (their pregenerated Cython .c was incompatible with Python 3.14 internals: ma_version_tag, ob_digit, 5-arg _PyLong_AsByteArray). Adds the transitive C-extension deps as minimal PyProjectRecipe entries that each set <NAME>_NO_EXTENSIONS=1 to use the pure-Python fallback: multidict, yarl, frozenlist, propcache. Draft / TODO: - Not yet exercised at compile time or runtime; needs an end-to-end testapp build (e.g. arm64-v8a) and an on-device import + a ClientSession smoke request. - Unclear whether all four sub-recipes are actually required. aiohappyeyeballs and aiosignal are declared as python_depends (pure Python); the four sub-recipes here exist to inject the _NO_EXTENSIONS env vars at build-from-sdist time, but if pip can resolve them another way, some may be droppable.
1 parent 9344dc1 commit 4ee7cc7

5 files changed

Lines changed: 90 additions & 13 deletions

File tree

pythonforandroid/recipes/aiohttp/__init__.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
"""Build AIOHTTP"""
2-
from typing import List
3-
from pythonforandroid.recipe import CppCompiledComponentsPythonRecipe
1+
from typing import Any
42

3+
from pythonforandroid.archs import Arch
4+
from pythonforandroid.recipe import PyProjectRecipe
55

6-
class AIOHTTPRecipe(CppCompiledComponentsPythonRecipe): # type: ignore # pylint: disable=R0903
7-
version = "3.8.3"
8-
url = "https://pypi.python.org/packages/source/a/aiohttp/aiohttp-{version}.tar.gz"
9-
name = "aiohttp"
10-
depends: List[str] = ["setuptools"]
11-
call_hostpython_via_targetpython = False
12-
install_in_hostpython = True
136

14-
def get_recipe_env(self, arch):
15-
env = super().get_recipe_env(arch)
16-
env['LDFLAGS'] += ' -lc++_shared'
7+
class AIOHTTPRecipe(PyProjectRecipe):
8+
name = 'aiohttp'
9+
version = '3.13.5'
10+
url = 'https://files.pythonhosted.org/packages/source/a/aiohttp/aiohttp-{version}.tar.gz'
11+
depends = ['python3', 'setuptools', 'multidict', 'yarl', 'frozenlist', 'propcache']
12+
python_depends = ['aiohappyeyeballs', 'aiosignal']
13+
14+
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
15+
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
16+
env['AIOHTTP_NO_EXTENSIONS'] = '1'
1717
return env
1818

1919

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any
2+
3+
from pythonforandroid.archs import Arch
4+
from pythonforandroid.recipe import PyProjectRecipe
5+
6+
7+
class FrozenlistRecipe(PyProjectRecipe):
8+
name = 'frozenlist'
9+
version = '1.5.0'
10+
url = 'https://files.pythonhosted.org/packages/source/f/frozenlist/frozenlist-{version}.tar.gz'
11+
depends = ['python3', 'setuptools']
12+
13+
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
14+
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
15+
env['FROZENLIST_NO_EXTENSIONS'] = '1'
16+
return env
17+
18+
19+
recipe = FrozenlistRecipe()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any
2+
3+
from pythonforandroid.archs import Arch
4+
from pythonforandroid.recipe import PyProjectRecipe
5+
6+
7+
class MultidictRecipe(PyProjectRecipe):
8+
name = 'multidict'
9+
version = '6.1.0'
10+
url = 'https://files.pythonhosted.org/packages/source/m/multidict/multidict-{version}.tar.gz'
11+
depends = ['python3', 'setuptools']
12+
13+
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
14+
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
15+
env['MULTIDICT_NO_EXTENSIONS'] = '1'
16+
return env
17+
18+
19+
recipe = MultidictRecipe()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any
2+
3+
from pythonforandroid.archs import Arch
4+
from pythonforandroid.recipe import PyProjectRecipe
5+
6+
7+
class PropcacheRecipe(PyProjectRecipe):
8+
name = 'propcache'
9+
version = '0.2.1'
10+
url = 'https://files.pythonhosted.org/packages/source/p/propcache/propcache-{version}.tar.gz'
11+
depends = ['python3', 'setuptools']
12+
13+
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
14+
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
15+
env['PROPCACHE_NO_EXTENSIONS'] = '1'
16+
return env
17+
18+
19+
recipe = PropcacheRecipe()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from typing import Any
2+
3+
from pythonforandroid.archs import Arch
4+
from pythonforandroid.recipe import PyProjectRecipe
5+
6+
7+
class YarlRecipe(PyProjectRecipe):
8+
name = 'yarl'
9+
version = '1.18.3'
10+
url = 'https://files.pythonhosted.org/packages/source/y/yarl/yarl-{version}.tar.gz'
11+
depends = ['python3', 'setuptools', 'multidict', 'propcache']
12+
python_depends = ['idna']
13+
14+
def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]:
15+
env: dict[str, Any] = super().get_recipe_env(arch, **kwargs)
16+
env['YARL_NO_EXTENSIONS'] = '1'
17+
return env
18+
19+
20+
recipe = YarlRecipe()

0 commit comments

Comments
 (0)