Skip to content

Commit

Permalink
Merge pull request #1184 from bitcraze/ataffanel/fix-python-wheel
Browse files Browse the repository at this point in the history
Fix python wheel build of the python binding
  • Loading branch information
krichardsson authored Feb 20, 2023
2 parents ee32547 + a0e96e3 commit a46e488
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
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

0 comments on commit a46e488

Please sign in to comment.