diff options
| author | Douglas Royds <douglas.royds@taitradio.com> | 2019-05-14 17:55:59 +1200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-15 17:53:29 +0100 |
| commit | 3de77b33eecbf6e65e5d9d1eedb5f2aea3886766 (patch) | |
| tree | 67aae93c300143b6f4f8179cbd2389426fd81e57 | |
| parent | 2537269bf53b99827191390ce9f9205cc821ec54 (diff) | |
| download | poky-3de77b33eecbf6e65e5d9d1eedb5f2aea3886766.tar.gz | |
distutils: Tidy and simplify for readability
Line lengths, remove duplication, and use the PYTHON variable provided by
pythonnative.bbclass.
Coincidentally fixes a dormant defect in distutils3.bbclass in which we were
sedding for STAGING_BINDIR_NATIVE/python-python3/python3.
(From OE-Core rev: 7b8dd17c65e2d7d163f452833f21469918bf222e)
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/distutils.bbclass | 26 | ||||
| -rw-r--r-- | meta/classes/distutils3.bbclass | 22 |
2 files changed, 19 insertions, 29 deletions
diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass index b5c9c2fbbd..3759b58263 100644 --- a/meta/classes/distutils.bbclass +++ b/meta/classes/distutils.bbclass | |||
| @@ -52,25 +52,20 @@ distutils_do_install() { | |||
| 52 | 52 | ||
| 53 | # support filenames with *spaces* | 53 | # support filenames with *spaces* |
| 54 | # only modify file if it contains path and recompile it | 54 | # only modify file if it contains path and recompile it |
| 55 | find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; -exec ${STAGING_BINDIR_NATIVE}/python-native/python -mcompileall {} \; | 55 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ |
| 56 | -exec sed -i -e s:${D}::g {} \; \ | ||
| 57 | -exec ${STAGING_BINDIR_NATIVE}/python-native/python -mcompileall {} \; | ||
| 56 | 58 | ||
| 57 | if test -e ${D}${bindir} ; then | 59 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 58 | for i in ${D}${bindir}/* ; do \ | 60 | if [ -f "$i" ]; then |
| 59 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i | 61 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
| 60 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | 62 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 61 | done | 63 | fi |
| 62 | fi | 64 | done |
| 63 | |||
| 64 | if [ -e ${D}${sbindir} ]; then | ||
| 65 | for i in ${D}${sbindir}/* ; do \ | ||
| 66 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i | ||
| 67 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | ||
| 68 | done | ||
| 69 | fi | ||
| 70 | 65 | ||
| 71 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth | 66 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
| 72 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/site.py* | 67 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/site.py* |
| 73 | 68 | ||
| 74 | # | 69 | # |
| 75 | # FIXME: Bandaid against wrong datadir computation | 70 | # FIXME: Bandaid against wrong datadir computation |
| 76 | # | 71 | # |
| @@ -80,7 +75,8 @@ distutils_do_install() { | |||
| 80 | fi | 75 | fi |
| 81 | 76 | ||
| 82 | # Fix backport modules | 77 | # Fix backport modules |
| 83 | if [ -e ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ] && [ -e ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py ]; then | 78 | if [ -e ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ] && |
| 79 | [ -e ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py ]; then | ||
| 84 | rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py; | 80 | rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py; |
| 85 | rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc; | 81 | rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc; |
| 86 | fi | 82 | fi |
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass index 42e7f5ae53..05a24bfe26 100644 --- a/meta/classes/distutils3.bbclass +++ b/meta/classes/distutils3.bbclass | |||
| @@ -56,24 +56,18 @@ distutils3_do_install() { | |||
| 56 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." | 56 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." |
| 57 | 57 | ||
| 58 | # support filenames with *spaces* | 58 | # support filenames with *spaces* |
| 59 | find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; | 59 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ |
| 60 | -exec sed -i -e s:${D}::g {} \; | ||
| 60 | 61 | ||
| 61 | if test -e ${D}${bindir} ; then | 62 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 62 | for i in ${D}${bindir}/* ; do \ | 63 | if [ -f "$i" ]; then |
| 63 | sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i | 64 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i |
| 64 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | 65 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 65 | done | 66 | fi |
| 66 | fi | 67 | done |
| 67 | |||
| 68 | if test -e ${D}${sbindir}; then | ||
| 69 | for i in ${D}${sbindir}/* ; do \ | ||
| 70 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i | ||
| 71 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | ||
| 72 | done | ||
| 73 | fi | ||
| 74 | 68 | ||
| 75 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth | 69 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
| 76 | 70 | ||
| 77 | # | 71 | # |
| 78 | # FIXME: Bandaid against wrong datadir computation | 72 | # FIXME: Bandaid against wrong datadir computation |
| 79 | # | 73 | # |
