Message ID | AS8PR09MB4645B9D742E68820D384DA6DA8029@AS8PR09MB4645.eurprd09.prod.outlook.com |
---|---|
State | Accepted, archived |
Commit | 6f2d85a7b7d94101f2ce67115166fa86c185650f |
Headers | show |
Series | pip_install_wheel: improve wheel handling | expand |
Hi look like this is causing some build error: https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/4816/steps/12/logs/stdio > -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded- > core@lists.openembedded.org> On Behalf Of Konrad Weihmann > Sent: Tuesday, 1 March, 2022 3:54 PM > To: openembedded-core@lists.openembedded.org > Cc: Konrad Weihmann <kweihmann@outlook.com> > Subject: [OE-core] [PATCH] pip_install_wheel: improve wheel handling > > - replace python3 prefix when guessing the wheel name > as there are still plenty of recipes out there that do use > python3 prefixes > - remove all previously generated wheels matching the glob > to avoid installing any outdated blob > - don't use PV in glob, as PV doesn't necessarily align with the > version used inside of the setuptools configuration. > this will avoid having the user set PYPA_WHEEL in a lot > of recipes > - respect SETUPTOOLS_SETUP_PATH in PIP_INSTALL_DIST_PATH > and use B as a fallback only (in case this class is inherited > without setuptools3 class being there as well). > recipes like python3-smbus run in a subfolder of the > workspace and were failing in before this adjustment > > Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> > --- > meta/classes/pip_install_wheel.bbclass | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/meta/classes/pip_install_wheel.bbclass > b/meta/classes/pip_install_wheel.bbclass > index 5b7e5cd706..e1fc25cbeb 100644 > --- a/meta/classes/pip_install_wheel.bbclass > +++ b/meta/classes/pip_install_wheel.bbclass > @@ -1,12 +1,13 @@ > DEPENDS:append = " python3-pip-native" > > def guess_pip_install_package_name(d): > + import re > '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' > - return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_') > + return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python-3", "", > d.getVar('BPN')).replace('-', '_')) > > PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" > -PIP_INSTALL_DIST_PATH ?= "${B}/dist" > -PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}- > ${PV}-*.whl" > +PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or > d.getVar('B')}/dist" > +PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*- > *.whl" > > PIP_INSTALL_ARGS ?= "\ > -vvvv \ > @@ -28,6 +29,8 @@ PIP_INSTALL_PYTHON = "python3" > PIP_INSTALL_PYTHON:class-native = "nativepython3" > > pip_install_wheel_do_install () { > + # cleanup previously generated files > + rm -f ${PYPA_WHEEL} > nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || > bbfatal_log "Failed to pip install wheel. Check the logs." > > -- > 2.25.1
On Tue, 2022-03-01 at 09:32 +0000, Lee Chee Yang wrote: > Hi > > look like this is causing some build error: > https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/4816/steps/12/logs/stdio Yes, https://autobuilder.yoctoproject.org/typhoon/#/builders/20/builds/5156/steps/11/logs/stdio too. I've stopped that build and dropped the patch. Cheers, Richard
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 5b7e5cd706..e1fc25cbeb 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass @@ -1,12 +1,13 @@ DEPENDS:append = " python3-pip-native" def guess_pip_install_package_name(d): + import re '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' - return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_') + return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python-3", "", d.getVar('BPN')).replace('-', '_')) PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" -PIP_INSTALL_DIST_PATH ?= "${B}/dist" -PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl" +PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or d.getVar('B')}/dist" +PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl" PIP_INSTALL_ARGS ?= "\ -vvvv \ @@ -28,6 +29,8 @@ PIP_INSTALL_PYTHON = "python3" PIP_INSTALL_PYTHON:class-native = "nativepython3" pip_install_wheel_do_install () { + # cleanup previously generated files + rm -f ${PYPA_WHEEL} nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || bbfatal_log "Failed to pip install wheel. Check the logs."
- replace python3 prefix when guessing the wheel name as there are still plenty of recipes out there that do use python3 prefixes - remove all previously generated wheels matching the glob to avoid installing any outdated blob - don't use PV in glob, as PV doesn't necessarily align with the version used inside of the setuptools configuration. this will avoid having the user set PYPA_WHEEL in a lot of recipes - respect SETUPTOOLS_SETUP_PATH in PIP_INSTALL_DIST_PATH and use B as a fallback only (in case this class is inherited without setuptools3 class being there as well). recipes like python3-smbus run in a subfolder of the workspace and were failing in before this adjustment Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> --- meta/classes/pip_install_wheel.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)