[oe-commits] [openembedded-core] 05/14: python3native, pythonnative: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR

git at git.openembedded.org git at git.openembedded.org
Fri Sep 6 14:09:42 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 83393383be16a9080a8e084c165549786f6310b8
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed Sep 4 17:22:11 2019 -0700

    python3native, pythonnative: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR
    
    packages can use
    
    find_package(PythonInterp REQUIRED)
    find_package(PythonLibs REQUIRED)
    
    while we control PYTHON pointing to native py3 the libs and include
    directories will then point to build host version, which can result in
    unexpected combination and if we are lucky we get errors if its quite
    different e.g. py2 libs/includes and py3 executable
    
    This variable can be then used to export PYTHON_LIBRARY and
    PYTHON_INCLUDE_DIR so that above find_packages can work correctly
    
    see [1] for how it happens in cmake
    
    LLDB uses it see [2]
    
    [1] https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake
    [2] https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/python3native.bbclass | 8 ++++++++
 meta/classes/pythonnative.bbclass  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index a3acaf6..d98fb4c 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -9,6 +9,14 @@ DEPENDS_append = " python3-native "
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
+# Packages can use
+# find_package(PythonInterp REQUIRED)
+# find_package(PythonLibs REQUIRED)
+# which ends up using libs/includes from build host
+# Therefore pre-empt that effort
+export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
+export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
+
 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
 
 # suppress host user's site-packages dirs.
diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass
index ae6600c..0e9019d 100644
--- a/meta/classes/pythonnative.bbclass
+++ b/meta/classes/pythonnative.bbclass
@@ -12,6 +12,14 @@ DEPENDS_append = " python-native "
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
+# Packages can use
+# find_package(PythonInterp REQUIRED)
+# find_package(PythonLibs REQUIRED)
+# which ends up using libs/includes from build host
+# Therefore pre-empt that effort
+export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
+export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
+
 # suppress host user's site-packages dirs.
 export PYTHONNOUSERSITE = "1"
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list