1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-28 23:52:55 +08:00

Add --embed for Python 3.8

This commit is contained in:
Thomas Perl 2019-06-08 10:29:31 +02:00
parent 4ee441b426
commit 2ecbef24db
2 changed files with 37 additions and 2 deletions

35
python-config-wrapper Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# python3-config wrapper script to support Python 3.8
# Works around https://bugs.python.org/issue36721
set -e
usage() {
echo "Usage: $0 [python3-config] (--libs|--includes)"
exit 1
}
if [ $# -ne 2 ]; then
usage
fi
PYTHON_CONFIG="$1"
shift
WHICH_FLAG="$1"
shift
case "$WHICH_FLAG" in
--libs)
# Python 3.8 needs --embed, but previous versions do not have it:
# https://github.com/python/cpython/pull/13500
"$PYTHON_CONFIG" --ldflags --libs --embed 2>/dev/null ||
"$PYTHON_CONFIG" --ldflags --libs
;;
--includes)
"$PYTHON_CONFIG" --includes
;;
*)
usage
;;
esac

View File

@ -4,5 +4,5 @@ isEmpty(PYTHON_CONFIG) {
message(PYTHON_CONFIG = $$PYTHON_CONFIG)
QMAKE_LIBS += $$system($$PYTHON_CONFIG --ldflags --libs)
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
QMAKE_LIBS += $$system($$PWD/python-config-wrapper $$PYTHON_CONFIG --libs)
QMAKE_CXXFLAGS += $$system($$PWD/python-config-wrapper $$PYTHON_CONFIG --includes)