blob: 89a884a1b25908867114163712ac86550d532993 [file] [log] [blame]
Patrick Williams451f49f2020-02-24 16:20:46 -06001inherit obmc-phosphor-utils
2inherit python3native
3
Patrick Williams52d65cf2020-02-26 15:46:53 -06004OBMC_PYTHON_EXE="python3"
5OBMC_PYTHON_EXE_class-native="nativepython3"
6
Patrick Williams451f49f2020-02-24 16:20:46 -06007DEPENDS += "python3"
8
9export BUILD_SYS
10export HOST_SYS
11export STAGING_INCDIR
12export STAGING_LIBDIR
13
14PYTHON_AUTOTOOLS_PACKAGE ?= "${PN}"
15
16python() {
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 Williams52d65cf2020-02-26 15:46:53 -060021
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#
31do_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}