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

build for python3 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
50 changes: 50 additions & 0 deletions scripts/build_python3_demos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

function WHITE_TEXT {
printf "\033[1;37m"
}
function NORMAL_TEXT {
printf "\033[0m"
}
function GREEN_TEXT {
printf "\033[1;32m"
}
function RED_TEXT {
printf "\033[1;31m"
}

WHITE_TEXT
echo "########################################################################################"
echo "# Building Get Blocks Python (SWIG) Demo... #"
echo "########################################################################################"
NORMAL_TEXT

uname -a

TARGET_BUILD_FOLDER=../build

mkdir $TARGET_BUILD_FOLDER
mkdir $TARGET_BUILD_FOLDER/python_demos

cd ../src/host/libpixyusb2_examples/python_demos

swig -c++ -python pixy.i
python3 setup.py build_ext --inplace -D__LINUX__

# For python3 only, the name of shared lib contains arch name, we need to rename it
mv _pixy.*.so _pixy.so

if [ -f ../../../../build/python_demos/_pixy.so ]; then
rm ../../../../build/python_demos/_pixy.so
fi

cp * ../../../../build/python_demos

if [ -f ../../../../build/python_demos/_pixy.so ]; then
GREEN_TEXT
printf "SUCCESS "
else
RED_TEXT
printf "FAILURE "
fi
echo ""