|
| 1 | +# ruff: noqa: RUF012 |
1 | 2 | import os |
| 3 | +from typing import Any |
2 | 4 |
|
3 | 5 | from pythonforandroid.archs import Arch |
4 | 6 | from pythonforandroid.recipe import ( |
5 | | - CythonRecipe, |
| 7 | + PyProjectRecipe, |
6 | 8 | Recipe, |
7 | 9 | ) |
8 | 10 |
|
9 | 11 |
|
10 | | -class PythonHackrfRecipe(CythonRecipe): |
| 12 | +class PythonHackrfRecipe(PyProjectRecipe): |
11 | 13 | url = 'https://github.com/GvozdevLeonid/python_hackrf/releases/download/v.{version}/python_hackrf-{version}.tar.gz' |
12 | | - depends = ('python3', 'setuptools', 'numpy', 'pyjnius', 'libhackrf') |
| 14 | + depends = ['python3', 'setuptools', 'numpy', 'pyjnius', 'libhackrf'] |
| 15 | + hostpython_prerequisites = ['Cython>=3.1.0,<3.2'] |
13 | 16 | site_packages_name = 'python_hackrf' |
14 | 17 | name = 'python_hackrf' |
15 | | - version = '1.3.2' |
| 18 | + version = '1.4.0' |
16 | 19 |
|
17 | | - def get_recipe_env(self, arch: Arch) -> dict: |
18 | | - env = super().get_recipe_env(arch) |
| 20 | + def get_recipe_env(self, arch: Arch, **kwargs) -> dict[str, Any]: |
| 21 | + env: dict[str, Any] = super().get_recipe_env(arch, **kwargs) |
19 | 22 |
|
20 | 23 | libhackrf_recipe = Recipe.get_recipe('libhackrf', arch) |
21 | | - |
22 | 24 | libhackrf_h_dir = os.path.join(libhackrf_recipe.get_build_dir(arch), 'host', 'libhackrf', 'src') |
23 | 25 |
|
24 | | - env['LDFLAGS'] += f' -L{self.ctx.get_libs_dir(arch.arch)}' |
25 | | - env['CFLAGS'] += f' -I{libhackrf_h_dir}' |
| 26 | + env['LDFLAGS'] = env['LDFLAGS'] + f' -L{self.ctx.get_libs_dir(arch.arch)} -lhackrf' |
| 27 | + env['CFLAGS'] = env['CFLAGS'] + f' -I{libhackrf_h_dir}' |
| 28 | + |
| 29 | + env['PYTHON_BLADERF_LIBBLADERF_H_PATH'] = libhackrf_h_dir |
| 30 | + env['LDSHARED'] = env['CC'] + ' -shared' |
| 31 | + env['LIBLINK'] = 'NOTNONE' |
26 | 32 |
|
27 | 33 | return env |
28 | 34 |
|
|
0 commit comments