distutils3: add egg files to path
cover distutils3: add egg files to path
Packages that use egg files or directories for installation may not be found when imported at the python3 interpreter. egg files/directories path must be included in a pth file to be appropriately included in python path.
These changes handle the egg files from the distutils3 class to avoid the need to perform it individually at each recipe.
[YOCTO #8673]
The following changes since commit 63f899a950daf1018999455bafa7a2be8b22f164:
bitbake: toaster: bin/toaster whitelist TOASTER_DIR (2017-01-17 13:18:47 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib lamego/bug8673
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lamego/bug8673
Jose Lamego (3):
distutils3.bbclass: add egg files/directories to python path
python3-pip: Remove pth file creation at recipe level
python3-setuptools: Remove pth file creation at recipe level
meta/classes/distutils3.bbclass | 10 ++++++++++ meta/recipes-devtools/python/python3-pip_9.0.1.bb | 3 --- meta/recipes-devtools/python/python3-setuptools_31.0.0.bb | 3 --- 3 files changed, 10 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 distutils3.bbclass: add egg files/directories to python path
Packages that use .egg files or directories for installation may not be found when imported at the python3 interpreter. .egg files/directories path must be included in a .pth file to be appropriately included in python path.
This change looks for .egg files/directories in sitepackages and adds its path to a .pth file during package installation. It ensures that any new package that uses .egg files/recipes will be appropriately added to path by performing the check from the distutils3 class.
[YOCTO #8673]
--- meta/classes/distutils3.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/classes/distutils3.bbclass +10 -0
@@ -68,6 +68,16 @@ distutils3_do_install() { mv -f ${D}${datadir}/share/* ${D}${datadir}/ rmdir ${D}${datadir}/share fi + + # detect if .egg files/directories were created and add their + # path to a .pth file + SHORT_PN=$(echo "${PN}" | sed 's/${PYTHON_PN}-//g') + if test -e ${D}${PYTHON_SITEPACKAGES_DIR}/${SHORT_PN}*.egg; then + EGG_NAME=$(basename $(find ${D}${PYTHON_SITEPACKAGES_DIR}/ \ +-name ${SHORT_PN}\*.egg)) + echo "./${EGG_NAME}" > ${D}${PYTHON_SITEPACKAGES_DIR}/\ +${SHORT_PN}.pth + fi } distutils3_do_install[vardepsexclude] = "MACHINE"
Signature · 1 line
1.8.3.1
Re: [PATCH 1/3] distutils3.bbclass: add egg files/directories to python path
Ping.
Quoted 40 lines · Jose Lamego
Packages that use .egg files or directories for installation may not be found when imported at the python3 interpreter. .egg files/directories path must be included in a .pth file to be appropriately included in python path.
This change looks for .egg files/directories in sitepackages and adds its path to a .pth file during package installation. It ensures that any new package that uses .egg files/recipes will be appropriately added to path by performing the check from the distutils3 class.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/classes/distutils3.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)meta/classes/distutils3.bbclass +10
-0@@ -68,6 +68,16 @@ distutils3_do_install() { mv -f ${D}${datadir}/share/* ${D}${datadir}/ rmdir ${D}${datadir}/share fi + + # detect if .egg files/directories were created and add their + # path to a .pth file + SHORT_PN=$(echo "${PN}" | sed 's/${PYTHON_PN}-//g') + if test -e ${D}${PYTHON_SITEPACKAGES_DIR}/${SHORT_PN}*.egg; then + EGG_NAME=$(basename $(find ${D}${PYTHON_SITEPACKAGES_DIR}/ \ +-name ${SHORT_PN}\*.egg)) + echo "./${EGG_NAME}" > ${D}${PYTHON_SITEPACKAGES_DIR}/\ +${SHORT_PN}.pth + fi } distutils3_do_install[vardepsexclude] = "MACHINE"
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
Re: [PATCH 1/3] distutils3.bbclass: add egg files/directories to python path
Ping
Quoted 46 lines · Jose Lamego
Ping.
Quoted 40 lines · Jose Lamego
Packages that use .egg files or directories for installation may not be found when imported at the python3 interpreter. .egg files/directories path must be included in a .pth file to be appropriately included in python path.
This change looks for .egg files/directories in sitepackages and adds its path to a .pth file during package installation. It ensures that any new package that uses .egg files/recipes will be appropriately added to path by performing the check from the distutils3 class.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/classes/distutils3.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)meta/classes/distutils3.bbclass +10
-0@@ -68,6 +68,16 @@ distutils3_do_install() { mv -f ${D}${datadir}/share/* ${D}${datadir}/ rmdir ${D}${datadir}/share fi + + # detect if .egg files/directories were created and add their + # path to a .pth file + SHORT_PN=$(echo "${PN}" | sed 's/${PYTHON_PN}-//g') + if test -e ${D}${PYTHON_SITEPACKAGES_DIR}/${SHORT_PN}*.egg; then + EGG_NAME=$(basename $(find ${D}${PYTHON_SITEPACKAGES_DIR}/ \ +-name ${SHORT_PN}\*.egg)) + echo "./${EGG_NAME}" > ${D}${PYTHON_SITEPACKAGES_DIR}/\ +${SHORT_PN}.pth + fi } distutils3_do_install[vardepsexclude] = "MACHINE"
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
PATCH 2/3 python3-pip: Remove pth file creation at recipe level
In reply to Jose LamegoHandling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
--- meta/recipes-devtools/python/python3-pip_9.0.1.bb | 3 --- 1 file changed, 3 deletions(-)
meta/recipes-devtools/python/python3-pip_9.0.1.bb +0 -3
@@ -31,9 +31,6 @@ do_install_append() { # Install as pip3 and leave pip2 as default rm ${D}/${bindir}/pip - - # Installed eggs need to be passed directly to the interpreter via a pth file - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}-${PV}.pth } RDEPENDS_${PN} = "\
Signature · 1 line
1.8.3.1
Re: [PATCH 2/3] python3-pip: Remove pth file creation at recipe level
Ping.
Quoted 26 lines · Jose Lamego
Handling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/recipes-devtools/python/python3-pip_9.0.1.bb | 3 --- 1 file changed, 3 deletions(-)meta/recipes-devtools/python/python3-pip_9.0.1.bb +0
-3@@ -31,9 +31,6 @@ do_install_append() { # Install as pip3 and leave pip2 as default rm ${D}/${bindir}/pip - - # Installed eggs need to be passed directly to the interpreter via a pth file - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}-${PV}.pth } RDEPENDS_${PN} = "\
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
Re: [PATCH 2/3] python3-pip: Remove pth file creation at recipe level
Ping.
Quoted 32 lines · Jose Lamego
Ping.
Quoted 26 lines · Jose Lamego
Handling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/recipes-devtools/python/python3-pip_9.0.1.bb | 3 --- 1 file changed, 3 deletions(-)meta/recipes-devtools/python/python3-pip_9.0.1.bb +0
-3@@ -31,9 +31,6 @@ do_install_append() { # Install as pip3 and leave pip2 as default rm ${D}/${bindir}/pip - - # Installed eggs need to be passed directly to the interpreter via a pth file - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}-${PV}.pth } RDEPENDS_${PN} = "\
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
PATCH 3/3 python3-setuptools: Remove pth file creation at recipe level
In reply to Jose LamegoHandling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
--- meta/recipes-devtools/python/python3-setuptools_31.0.0.bb | 3 --- 1 file changed, 3 deletions(-)
meta/recipes-devtools/python/python3-setuptools_31.0.0.bb +0 -3
@@ -7,11 +7,8 @@ inherit distutils3 DISTUTILS_INSTALL_ARGS += "--install-lib=${D}${PYTHON_SITEPACKAGES_DIR}" -# The installer puts the wrong path in the setuptools.pth file. Correct it. do_install_append() { - rm ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth mv ${D}${bindir}/easy_install ${D}${bindir}/easy3_install - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } RDEPENDS_${PN} = "\
Signature · 1 line
1.8.3.1
Re: [PATCH 3/3] python3-setuptools: Remove pth file creation at recipe level
Ping.
Quoted 28 lines · Jose Lamego
Handling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/recipes-devtools/python/python3-setuptools_31.0.0.bb | 3 --- 1 file changed, 3 deletions(-)meta/recipes-devtools/python/python3-setuptools_31.0.0.bb +0
-3@@ -7,11 +7,8 @@ inherit distutils3 DISTUTILS_INSTALL_ARGS += "--install-lib=${D}${PYTHON_SITEPACKAGES_DIR}" -# The installer puts the wrong path in the setuptools.pth file. Correct it. do_install_append() { - rm ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth mv ${D}${bindir}/easy_install ${D}${bindir}/easy3_install - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } RDEPENDS_${PN} = "\
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
Re: [PATCH 3/3] python3-setuptools: Remove pth file creation at recipe level
Ping.
Quoted 34 lines · Jose Lamego
Ping.
Quoted 28 lines · Jose Lamego
Handling of installed eggs is now performed at the distutils3 bbclass.
This change removes the pth file creation at recipe level.
[YOCTO #8673]
Signed-off-by Jose Lamego <[email protected]>--- meta/recipes-devtools/python/python3-setuptools_31.0.0.bb | 3 --- 1 file changed, 3 deletions(-)meta/recipes-devtools/python/python3-setuptools_31.0.0.bb +0
-3@@ -7,11 +7,8 @@ inherit distutils3 DISTUTILS_INSTALL_ARGS += "--install-lib=${D}${PYTHON_SITEPACKAGES_DIR}" -# The installer puts the wrong path in the setuptools.pth file. Correct it. do_install_append() { - rm ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth mv ${D}${bindir}/easy_install ${D}${bindir}/easy3_install - echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth } RDEPENDS_${PN} = "\
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
Quoted 5 lines · Jose Lamego
Packages that use egg files or directories for installation may not be found when imported at the python3 interpreter. egg files/directories path must be included in a pth file to be appropriately included in python path.
Do we understand why pip and distutils are installing as eggs, instead of the traditional format? I thought we
passed --single-version-externally-managed to setuptools to handle this but I can't see this anywhere (Khem removed it from distutils back in 2013). For reference, python3-mako just installs the metadata to the egg folder and installs the Python code in the traditional way.
Ross