summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass
blob: 0922a1ab6e0b700f72b44924c6e8b69eb69f153a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
inherit obmc-phosphor-utils
inherit pythonnative

DEPENDS += "python"

export BUILD_SYS
export HOST_SYS
export STAGING_INCDIR
export STAGING_LIBDIR

PYTHON_AUTOTOOLS_PACKAGE ?= "${PN}"

python() {
    for pkg in listvar_to_list(d, 'PYTHON_AUTOTOOLS_PACKAGE'):
        set_append(d, 'FILES_%s' % pkg,
                   d.getVar('PYTHON_SITEPACKAGES_DIR', True))
}

# In order to facilitate packages that use python3native, but also
# depend on python2 scripts we need to replace the #! to be nativepython
# instead of just python.  Without this, `which python` points to the
# host's python, which is not the one where required modules would be
# installed.
do_install_append_class-native() {
    for i in ${D}${bindir}/* ${D}${sbindir}/*; do
        if [ -f "$i" ]; then
            sed -i -e s:env\ python:env\ nativepython:g $i
        fi
    done
}