pythonnative.bbclass, python3native.bbclass: export STAGING_INCDIR, STAGING_LIBDIR, PYTHON variables

We patch Python's distutils modules to access STAGING_INCDIR/LIBDIR, so when
they are not set, scripts that utilize distutils (e.g. python-config) fail.
Several recipes need to export those manually to prevent such failures,
so let's do that in the class instead.

PYTHON variable is exported because otherwise autotools' python.m4
macro will pick up its own internal default, which may not be the version
that we want.

glib recipe in particular was previously using Python 2.x during build due to python.m4
defaulting to it - now it's using Python 3.x, and so needs a small fix in
deletion of *.pyc files.

(From OE-Core rev: c1e0eb62f2d89b10b187016200018830b1c77945)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin 2016-06-22 15:06:35 +03:00 committed by Richard Purdie
parent 83b11dcd55
commit cf1af6b384
11 changed files with 17 additions and 29 deletions

View File

@ -24,11 +24,6 @@ DEPENDS_append_class-target = " gobject-introspection gobject-introspection-nati
DEPENDS_append_class-native = " gobject-introspection-native"
DEPENDS_append_class-nativesdk = " gobject-introspection-native"
# This is necessary for python scripts to succeed - distutils fails if these
# are not set
export STAGING_INCDIR
export STAGING_LIBDIR
# This is used by introspection tools to find .gir includes
export XDG_DATA_DIRS = "${STAGING_DATADIR}"

View File

@ -3,3 +3,11 @@ inherit python3-dir
PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"
EXTRANATIVEPATH += "${PYTHON_PN}-native"
DEPENDS += " ${PYTHON_PN}-native "
# python-config and other scripts are using distutils modules
# which we patch to access these variables
export STAGING_INCDIR
export STAGING_LIBDIR
# autoconf macros will use their internal default preference otherwise
export PYTHON

View File

@ -6,3 +6,11 @@ PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"
PYTHON_EXECUTABLE="${PYTHON}"
EXTRANATIVEPATH += "${PYTHON_PN}-native"
DEPENDS += " ${PYTHON_PN}-native "
# python-config and other scripts are using distutils modules
# which we patch to access these variables
export STAGING_INCDIR
export STAGING_LIBDIR
# autoconf macros will use their internal default preference otherwise
export PYTHON

View File

@ -77,6 +77,7 @@ do_install_append () {
fi
# Remove some unpackaged files
rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__
rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo

View File

@ -47,10 +47,6 @@ EXTRA_OECONF_class-native = "--without-legacy --without-docbook --with-c14n --wi
EXTRA_OECONF_class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF_linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
# required for python binding
export STAGING_LIBDIR
export STAGING_INCDIR
python populate_packages_prepend () {
# autonamer would call this libxml2-2, but we don't want that
if d.getVar('DEBIAN_NAMES', True):

View File

@ -18,10 +18,6 @@ PACKAGECONFIG ?= ""
PACKAGECONFIG[docs] = "--enable-html-docs,--disable-html-docs,python3-docutils-native"
PACKAGECONFIG[api-docs] = "--enable-api-docs,--disable-api-docs,python3-docutils-native python3-epydoc-native"
do_configure_prepend() {
export PYTHON=${PYTHON}
}
RDEPENDS_${PN} = "python3-io python3-logging python3-stringold python3-threading python3-xml"
FILES_${PN}-dev += "${libdir}/pkgconfig"

View File

@ -24,8 +24,6 @@ DEPENDS = "popt libpam glib-2.0 docbook-utils-native linuxdoc-tools-native pytho
inherit autotools gettext python3native python3-dir pkgconfig
export PYTHON
EXTRA_OEMAKE = "PYTHON_CPPFLAGS=-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
PACKAGES += "${PN}-python "

View File

@ -35,8 +35,6 @@ inherit autotools-brokensep
CLEANBROKEN = "1"
export STAGING_INCDIR
export STAGING_LIBDIR
export CPPFLAGS
PACKAGES_prepend = "whiptail "

View File

@ -21,13 +21,6 @@ SRC_URI[sha256sum] = "fa275aaccdbfc91ec0bc9a6fd0562051acdba731e7d584b64a277fec60
inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data
BBCLASSEXTEND = "native"
# necessary to let the call for python-config from configure.ac succeed
export STAGING_INCDIR
export STAGING_LIBDIR
# autoconf macros otherwise will default to Python 2
export PYTHON
# needed for writing out the qemu wrapper script
export STAGING_DIR_HOST
export B

View File

@ -40,8 +40,6 @@ inherit linux-kernel-base kernel-arch pythonnative
# needed for building the tools/perf Python bindings
inherit python-dir
export STAGING_INCDIR
export STAGING_LIBDIR
export PYTHON_SITEPACKAGES_DIR
#kernel 3.1+ supports WERROR to disable warnings as errors

View File

@ -17,9 +17,6 @@ SRC_URI[sha256sum] = "615549ce39b333f6b78baee0c0b4ef18bc726c6bf1cca123dfd89dd963
DEPENDS += "swig-native python3"
export PYTHON
export STAGING_INCDIR
export STAGING_LIBDIR
EXTRA_OECONF += "--with-python --with-python3"
EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}${PYTHON_ABI}' PYINC='${STAGING_INCDIR}/${PYLIBVER}'"