buildsystem: fix Python native modules that are using build host ABI (PEP3149)

This commit is contained in:
MilhouseVH 2019-10-24 22:51:28 +01:00
parent c5defa752d
commit a41d4f1e6b
2 changed files with 17 additions and 0 deletions

View File

@ -1063,6 +1063,20 @@ python_remove_source() {
fi fi
} }
# arg1: directory to process recursively
# strip incorrect build-host ABI from native Python3 modules (see PEP3149)
python_fix_abi() {
local pymodule pyname
for pymodule in $(find ${1} -type f -name '*.cpython-*.so' 2>/dev/null); do
pyname=${pymodule##*/}
pyname=${pyname%.so} # strip extension
pyname=${pyname%.*} # strip incorrect ABI
echo "python_fix_abi: Removing ABI from ${pymodule} -> ${pyname}.so"
mv ${pymodule} ${pymodule%/*}/${pyname}.so
done
}
### KERNEL HELPERS ### ### KERNEL HELPERS ###
kernel_path() { kernel_path() {
get_build_dir linux get_build_dir linux
@ -1264,6 +1278,7 @@ install_addon_files() {
install_addon_source "$1" install_addon_source "$1"
install_addon_images "$1" install_addon_images "$1"
create_addon_xml "$1" create_addon_xml "$1"
python_fix_abi "$1"
} }
install_driver_addon_files() { install_driver_addon_files() {

View File

@ -474,6 +474,8 @@ if [ "${TARGET}" = "target" -o "${TARGET}" = "init" ]; then
-exec rm -f {} \; 2>/dev/null || : -exec rm -f {} \; 2>/dev/null || :
find ${INSTALL} -type d -exec rmdir -p {} \; 2>/dev/null || : find ${INSTALL} -type d -exec rmdir -p {} \; 2>/dev/null || :
python_fix_abi "${INSTALL}"
if [ ! "${BUILD_WITH_DEBUG}" = "yes" ]; then if [ ! "${BUILD_WITH_DEBUG}" = "yes" ]; then
${STRIP} $(find ${INSTALL} \ ${STRIP} $(find ${INSTALL} \
-type f -name "*.so*" \ -type f -name "*.so*" \