Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python wheel build of the python binding #1184

Merged
merged 3 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ current_platform.mk

bindings/build/*
bindings/cffirmware_wrap.c
dist/

docs/.jekyll-metadata
docs/.jekyll-cache
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,16 @@ ifeq ($(KBUILD_SRC),)
MOD_INC = src/modules/interface
MOD_SRC = src/modules/src

bindings_python cffirmware.py: bindings/setup.py $(MOD_SRC)/*.c
bindings_python build/cffirmware.py: bindings/setup.py $(MOD_SRC)/*.c
swig -python -I$(MOD_INC) -Isrc/hal/interface -Isrc/utils/interface -o build/cffirmware_wrap.c bindings/cffirmware.i
$(PYTHON) bindings/setup.py build_ext --inplace
mv build/cffirmware.py cffirmware.py

test_python: cffirmware.py
$(PYTHON) -m pytest test_python
test_python: build/cffirmware.py
PYTHONPATH=build $(PYTHON) -m pytest test_python

python_wheel: build/cffirmware.py
$(PYTHON) bindings/setup.py bdist_wheel
endif

.PHONY: all clean build compile unit prep erase flash check_submodules trace openocd gdb halt reset flash_dfu flash_dfu_manual flash_verify cload size print_version clean_version bindings_python
.PHONY: all clean build compile unit prep erase flash check_submodules trace openocd gdb halt reset flash_dfu flash_dfu_manual flash_verify cload size print_version clean_version bindings_python test_python python_wheel

4 changes: 3 additions & 1 deletion bindings/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ def initialize_options(self):
name="cffirmware",
version="1.0",
cmdclass={"build": BuildCommand},
ext_modules=[cffirmware]
ext_modules=[cffirmware],
py_modules=["cffirmware"],
package_dir={"": "build"},
)
6 changes: 6 additions & 0 deletions tools/python_binding/python_wheel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/env bash
set -e

make cf2_defconfig
make include/generated/autoconf.h
make python_wheel