diff options
Diffstat (limited to 'meta/classes/pip_install_wheel.bbclass')
| -rw-r--r-- | meta/classes/pip_install_wheel.bbclass | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 954a6b750f..3861dae75a 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass | |||
| @@ -1,20 +1,10 @@ | |||
| 1 | DEPENDS:append = " python3-pip-native" | 1 | DEPENDS:append = " python3-pip-native" |
| 2 | 2 | ||
| 3 | def guess_pip_install_package_name(d): | ||
| 4 | import re | ||
| 5 | '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' | ||
| 6 | name = d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", d.getVar('BPN')) | ||
| 7 | return name.replace('-', '_') | ||
| 8 | |||
| 9 | PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" | ||
| 10 | |||
| 11 | # The directory where wheels should be written too. Build classes | 3 | # The directory where wheels should be written too. Build classes |
| 12 | # will ideally [cleandirs] this but we don't do that here in case | 4 | # will ideally [cleandirs] this but we don't do that here in case |
| 13 | # a recipe wants to install prebuilt wheels. | 5 | # a recipe wants to install prebuilt wheels. |
| 14 | PIP_INSTALL_DIST_PATH ?= "${WORKDIR}/dist" | 6 | PIP_INSTALL_DIST_PATH ?= "${WORKDIR}/dist" |
| 15 | 7 | ||
| 16 | PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl" | ||
| 17 | |||
| 18 | PIP_INSTALL_ARGS = "\ | 8 | PIP_INSTALL_ARGS = "\ |
| 19 | -vvvv \ | 9 | -vvvv \ |
| 20 | --ignore-installed \ | 10 | --ignore-installed \ |
| @@ -29,8 +19,14 @@ PIP_INSTALL_PYTHON = "python3" | |||
| 29 | PIP_INSTALL_PYTHON:class-native = "nativepython3" | 19 | PIP_INSTALL_PYTHON:class-native = "nativepython3" |
| 30 | 20 | ||
| 31 | pip_install_wheel_do_install () { | 21 | pip_install_wheel_do_install () { |
| 32 | nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || | 22 | COUNT=$(find ${PIP_INSTALL_DIST_PATH} -name '*.whl' | wc -l) |
| 33 | bbfatal_log "Failed to pip install wheel. Check the logs." | 23 | if test $COUNT -eq 0; then |
| 24 | bbfatal No wheels found in ${PIP_INSTALL_DIST_PATH} | ||
| 25 | elif test $COUNT -gt 1; then | ||
| 26 | bbfatal More than one wheel found in ${PIP_INSTALL_DIST_PATH}, this should not happen | ||
| 27 | fi | ||
| 28 | |||
| 29 | nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PIP_INSTALL_DIST_PATH}/*.whl | ||
| 34 | 30 | ||
| 35 | cd ${D} | 31 | cd ${D} |
| 36 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do | 32 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
