Skip to content

Commit 4658ab1

Browse files
committed
Auto-generate the bindings from Frida's .gir
Replace the hand-written extension and core with a generator (frida/frida_bindgen) that reads Frida's .gir files and emits the _frida C extension plus the sync frida.* and async frida.aio.* facades. Covers construction, enumeration, attach/spawn with keyword-argument options, sessions, scripts, script RPC (blocking and awaitable), signals with flexible handler arity, exception mapping, lists, vardict/variant, bytes and string arrays, and top-level device helpers. Also emits a real .pyi for the extension. The little logic that cannot come from the .gir -- the GObject glue, the marshallers and the RPC layer -- lives in clearly scoped assets.
1 parent 0988dca commit 4658ab1

60 files changed

Lines changed: 6604 additions & 9542 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/linting.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3
8-
- uses: lgeiger/pyflakes-action@master
8+
- run: pip install pyflakes
9+
- run: pyflakes $(git ls-files '*.py' | grep -v '^frida/frida_bindgen/assets/')
910
mypy:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v3
1314
- uses: jpetrucciani/mypy-check@master
1415
with:
15-
mypy_flags: '--exclude examples --exclude setup'
16+
mypy_flags: '--exclude examples --exclude setup --exclude frida/frida_bindgen/assets'

‎.github/workflows/tests.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: tests
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v7
8+
with:
9+
submodules: recursive
10+
- uses: actions/setup-python@v6
11+
with:
12+
python-version: '3.x'
13+
- name: Install build dependencies
14+
run: pip install setuptools
15+
- name: Build the extension
16+
run: make
17+
- name: Run the test suite
18+
run: python3 -m unittest tests.test_bindgen -v

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*.pyc
2+
*.abi3.so
23
/*.egg-info/
4+
/.cache/
35
/build/
46
/deps/
57
/dist/

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "releng"]
22
path = releng
33
url = https://github.com/frida/releng.git
4+
[submodule "frida-bindgen"]
5+
path = frida-bindgen
6+
url = https://github.com/frida/frida-bindgen.git

‎MANIFEST.in‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
include meson.build
22
include frida/meson.build
3-
include frida/_frida/extension.c
4-
include frida/_frida/extension.version
5-
include frida/_frida/meson.build
3+
include frida/extension.version
4+
recursive-include frida/frida_bindgen *.py *.c *.h
5+
recursive-include frida-bindgen *.py
66
include subprojects/frida-core.wrap
77

88
include BSDmakefile

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ all $(MAKECMDGOALS):
88
$(MAKECMDGOALS)
99

1010
git-submodules:
11-
@if [ ! -f releng/meson/meson.py ]; then \
11+
@if [ ! -f releng/meson/meson.py ] || [ ! -f frida-bindgen/frida_bindgen_core/model.py ]; then \
1212
git submodule update --init --recursive --depth 1; \
1313
fi
1414
-include git-submodules

‎frida-bindgen‎

Submodule frida-bindgen added at df17879

‎frida/__init__.py‎

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)