Skip to contentSkip to conversation

python3: Expose PYTHON_BINABI in global config metadata

PATCH In review Khem Raj 3 participants 9 messages Sep 4, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 python3: Expose PYTHON_BINABI in global config metadata

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

---
 meta/conf/distro/include/tcmode-default.inc   | 3 +++
 meta/recipes-devtools/python/python3_3.7.4.bb | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
meta/conf/distro/include/tcmode-default.inc +3 -0
index 5c28386c4f..bcc5a14d4a 100644
@@ -30,6 +30,9 @@ GOVERSION ?= "1.12%"
 # llvm version being used, so always bump it with llvm recipe version bump
 LLVMVERSION ?= "8.0.1"
 
+# This should be bumped when python3 recipe's MIN_VER is bumped e.g. 3.7 -> 3.8
+PYTHON_BINABI = "3.7m"
+
 PREFERRED_VERSION_gcc ?= "${GCCVERSION}"
 PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
 PREFERRED_VERSION_gcc-cross-initial-${TARGET_ARCH} ?= "${GCCVERSION}"
meta/recipes-devtools/python/python3_3.7.4.bb +0 -1
index 80c9b2919e..b2014e2bcf 100644
@@ -47,7 +47,6 @@ UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
 CVE_PRODUCT = "python"
 
 PYTHON_MAJMIN = "3.7"
-PYTHON_BINABI = "${PYTHON_MAJMIN}m"
 
 S = "${WORKDIR}/Python-${PV}"
 
Signature · 1 line
2.23.0
author
#1 lore raw

PATCH 2/2 python3native: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR

---
 meta/classes/python3native.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/python3native.bbclass +3 -0
index a3acaf61bb..b056378f69 100644
@@ -9,6 +9,9 @@ DEPENDS_append = " python3-native "
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
+export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_BINABI}"
+export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_BINABI}"
+
 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
 
 # suppress host user's site-packages dirs.
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH 2/2] python3native: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR

Review

Quoted 3 lines · Khem Raj
(quoted diff) +2 -0
+export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_BINABI}"
+export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_BINABI}

You need to explain why this is needed. Where are these variables used?

Also, python3-dir.bbclass already has all the needed settings, so please use it.

Alex

author
#3 lore raw

Re: [PATCH 2/2] python3native: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR

Quoted 11 lines · Alexander Kanavin

Review

Quoted 3 lines · Khem Raj
(quoted diff) +2 -0
+export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_BINABI}"
+export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_BINABI}

You need to explain why this is needed. Where are these variables used?

Also, python3-dir.bbclass already has all the needed settings, so please use it.

sent v2

Quoted 1 line

Alex

#4 lore raw
In reply to Khem Raj

meta/conf/distro/include/tcmode-default.inc GOVERSION ?= "1.12%" · line 35

Quoted 8 lines · Khem Raj
 # llvm version being used, so always bump it with llvm recipe version bump
 LLVMVERSION ?= "8.0.1"
meta/conf/distro/include/tcmode-default.inc +3 -1
+# This should be bumped when python3 recipe's MIN_VER is bumped e.g. 3.7
-> 3.8
+PYTHON_BINABI = "3.7m"
+

This is already set in python3-dir.bbclass, so please use the values from there.

Alex

author
#5 lore raw
Quoted 6 lines · Alexander Kanavin
Quoted 4 lines · Khem Raj
 # llvm version being used, so always bump it with llvm recipe version bump
 LLVMVERSION ?= "8.0.1"
Quoted 7 lines

meta/conf/distro/include/tcmode-default.inc GOVERSION ?= "1.12%" · line 35

Quoted 3 lines
meta/conf/distro/include/tcmode-default.inc +3 -0
+# This should be bumped when python3 recipe's MIN_VER is bumped e.g. 3.7 -> 3.8
+PYTHON_BINABI = "3.7m"
+

This is already set in python3-dir.bbclass, so please use the values from there.

hmm thanks somehow I missed it. I guess defining then in terms of the values from python3-dir and python-dir should be good.

Quoted 1 line

Alex

author
#6 lore raw
In reply to Alexander Kanavin
Quoted 6 lines · Alexander Kanavin
Quoted 4 lines · Khem Raj
 # llvm version being used, so always bump it with llvm recipe version bump
 LLVMVERSION ?= "8.0.1"
Quoted 7 lines

meta/conf/distro/include/tcmode-default.inc GOVERSION ?= "1.12%" · line 35

Quoted 3 lines
meta/conf/distro/include/tcmode-default.inc +3 -0
+# This should be bumped when python3 recipe's MIN_VER is bumped e.g. 3.7 -> 3.8
+PYTHON_BINABI = "3.7m"
+

This is already set in python3-dir.bbclass, so please use the values from there.

we can ignore this patch

Quoted 1 line

Alex

#7 lore raw
In reply to Khem Raj
Quoted 11 lines · Khem Raj

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

Quoted 8 lines

This variable can be then used to export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR so that above find_packages can work correctly

---
 meta/conf/distro/include/tcmode-default.inc   | 3 +++
 meta/recipes-devtools/python/python3_3.7.4.bb | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

Putting this into the global namespace seems like a really bad idea. Can we not use a class like Alex mentions? I thought we already had one?

Cheers,

Richard

author
#8 lore raw
Quoted 22 lines · Richard Purdie
Quoted 11 lines · Khem Raj

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

Quoted 8 lines

This variable can be then used to export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR so that above find_packages can work correctly

---
 meta/conf/distro/include/tcmode-default.inc   | 3 +++
 meta/recipes-devtools/python/python3_3.7.4.bb | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 4 lines

Putting this into the global namespace seems like a really bad idea. Can we not use a class like Alex mentions? I thought we already had one?

yeah I think we have what is needed to form the needed vars via PYTHON_DIR I have sent a v2, this patch can be ignored

Quoted 4 lines

Cheers,

Richard