Patrick Williams | 451f49f | 2020-02-24 16:20:46 -0600 | [diff] [blame] | 1 | inherit obmc-phosphor-utils |
| 2 | inherit python3native |
| 3 | |
Patrick Williams | 52d65cf | 2020-02-26 15:46:53 -0600 | [diff] [blame^] | 4 | OBMC_PYTHON_EXE="python3" |
| 5 | OBMC_PYTHON_EXE_class-native="nativepython3" |
| 6 | |
Patrick Williams | 451f49f | 2020-02-24 16:20:46 -0600 | [diff] [blame] | 7 | DEPENDS += "python3" |
| 8 | |
| 9 | export BUILD_SYS |
| 10 | export HOST_SYS |
| 11 | export STAGING_INCDIR |
| 12 | export STAGING_LIBDIR |
| 13 | |
| 14 | PYTHON_AUTOTOOLS_PACKAGE ?= "${PN}" |
| 15 | |
| 16 | python() { |
| 17 | for pkg in listvar_to_list(d, 'PYTHON_AUTOTOOLS_PACKAGE'): |
| 18 | set_append(d, 'FILES_%s' % pkg, |
| 19 | d.getVar('PYTHON_SITEPACKAGES_DIR', True)) |
| 20 | } |
Patrick Williams | 52d65cf | 2020-02-26 15:46:53 -0600 | [diff] [blame^] | 21 | |
| 22 | # python-setuptools does some mangling of the #! in any scripts it installs, |
| 23 | # which has been reported for years at pypa/setuptools#494. OE has |
| 24 | # workarounds in distutils3.bbclass, but we cannot inherit that here because |
| 25 | # it conflicts with autotools.bbclass. Port the un-mangling code here. |
| 26 | # |
| 27 | # This finds any ${PYTHON} executable path that got put into the scripts |
| 28 | # and reverts it back to "/usr/bin/env python3". It also reverts any full |
| 29 | # ${STAGING_BINDIR_NATIVE} path back to "/usr/bin". |
| 30 | # |
| 31 | do_install_append() { |
| 32 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 33 | if [ -f "$i" ]; then |
| 34 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${OBMC_PYTHON_EXE}:g $i |
| 35 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 36 | fi |
| 37 | done |
| 38 | } |