Skip to content

Commit 06539e4

Browse files
committed
cleaned up the code. bump to 1.4.0
1 parent b17478b commit 06539e4

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

android/python_hackrf/__init__.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1+
# ruff: noqa: RUF012
12
import os
3+
from typing import Any
24

35
from pythonforandroid.archs import Arch
46
from pythonforandroid.recipe import (
5-
CythonRecipe,
7+
PyProjectRecipe,
68
Recipe,
79
)
810

911

10-
class PythonHackrfRecipe(CythonRecipe):
12+
class PythonHackrfRecipe(PyProjectRecipe):
1113
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']
1316
site_packages_name = 'python_hackrf'
1417
name = 'python_hackrf'
15-
version = '1.3.2'
18+
version = '1.4.0'
1619

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)
1922

2023
libhackrf_recipe = Recipe.get_recipe('libhackrf', arch)
21-
2224
libhackrf_h_dir = os.path.join(libhackrf_recipe.get_build_dir(arch), 'host', 'libhackrf', 'src')
2325

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'
2632

2733
return env
2834

0 commit comments

Comments
 (0)