diff options
author | Douglas Royds <douglas.royds@taitradio.com> | 2019-05-06 18:47:25 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-08 12:15:17 +0100 |
commit | a839671f6e029d0fe8c131d37127b5a5906494e5 (patch) | |
tree | 3a1741207248897a6f66e6dd28627c0cd4f90f44 /meta/classes/distutils3.bbclass | |
parent | 568f0ab886cbcf83fcd9f154886280a7881d30fe (diff) | |
download | poky-a839671f6e029d0fe8c131d37127b5a5906494e5.tar.gz |
distutils: Run python from the PATH in the -native case as well
The python distutils generate a python wrapper script for each package,
containing shebang lines pointing to the python executable.
In our case, this is a fully-qualified path to python-native in the
recipe-sysroot-native.
Ubuntu 18.04 restricts the useful length of the shebang line to 125
characters, and Ubuntu 16.04 restricts it to 77. In both cases, the
staged python script fails to run due to the length of the path to
the python-native executable.
Replace the shebang line with nativepython or nativepython3 as appropriate.
The nativepython symlink is installed by the python-native recipe:
#!/usr/bin/env nativepython
We were already doing this for on-target distutils components.
This change applies the sed-line to -native distutils components as well.
In this way, -native clients of these components can invoke the wrapper scripts
directly, without themselves needing to inherit pythonnative.
This works around a known setuptools issue:
https://github.com/pypa/setuptools/issues/494
Even once this issue has been resolved upstream,
we will still need to replace `python` with `nativepython`
(From OE-Core rev: 0a5bd4f30182a3d55153e5ade76f1dfd5b52b482)
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/distutils3.bbclass')
-rw-r--r-- | meta/classes/distutils3.bbclass | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass index 834e322474..42e7f5ae53 100644 --- a/meta/classes/distutils3.bbclass +++ b/meta/classes/distutils3.bbclass | |||
@@ -10,6 +10,9 @@ DISTUTILS_INSTALL_ARGS ?= "--root=${D} \ | |||
10 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ | 10 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ |
11 | --install-data=${datadir}" | 11 | --install-data=${datadir}" |
12 | 12 | ||
13 | DISTUTILS_PYTHON = "python3" | ||
14 | DISTUTILS_PYTHON_class-native = "nativepython3" | ||
15 | |||
13 | distutils3_do_configure() { | 16 | distutils3_do_configure() { |
14 | if [ "${CLEANBROKEN}" != "1" ] ; then | 17 | if [ "${CLEANBROKEN}" != "1" ] ; then |
15 | NO_FETCH_BUILD=1 \ | 18 | NO_FETCH_BUILD=1 \ |
@@ -57,14 +60,14 @@ distutils3_do_install() { | |||
57 | 60 | ||
58 | if test -e ${D}${bindir} ; then | 61 | if test -e ${D}${bindir} ; then |
59 | for i in ${D}${bindir}/* ; do \ | 62 | for i in ${D}${bindir}/* ; do \ |
60 | sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i | 63 | sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
61 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | 64 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
62 | done | 65 | done |
63 | fi | 66 | fi |
64 | 67 | ||
65 | if test -e ${D}${sbindir}; then | 68 | if test -e ${D}${sbindir}; then |
66 | for i in ${D}${sbindir}/* ; do \ | 69 | for i in ${D}${sbindir}/* ; do \ |
67 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i | 70 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
68 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | 71 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
69 | done | 72 | done |
70 | fi | 73 | fi |