summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Royds <douglas.royds@taitradio.com>2019-05-14 17:55:59 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-15 17:52:49 +0100
commit7b8dd17c65e2d7d163f452833f21469918bf222e (patch)
tree4114128c07be375cbfd891947fac490e4ff29df2
parent9609256bfcfbb3860f68f1d8e553e9dd051ad218 (diff)
downloadopenembedded-core-contrib-7b8dd17c65e2d7d163f452833f21469918bf222e.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. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/distutils.bbclass26
-rw-r--r--meta/classes/distutils3.bbclass22
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() {
# support filenames with *spaces*
# only modify file if it contains path and recompile it
- find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; -exec ${STAGING_BINDIR_NATIVE}/python-native/python -mcompileall {} \;
+ find ${D} -name "*.py" -exec grep -q ${D} {} \; \
+ -exec sed -i -e s:${D}::g {} \; \
+ -exec ${STAGING_BINDIR_NATIVE}/python-native/python -mcompileall {} \;
- if test -e ${D}${bindir} ; then
- for i in ${D}${bindir}/* ; do \
- sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
+ for i in ${D}${bindir}/* ${D}${sbindir}/*; do
+ if [ -f "$i" ]; then
+ sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
- done
- fi
-
- if [ -e ${D}${sbindir} ]; then
- for i in ${D}${sbindir}/* ; do \
- sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
- sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
- done
- fi
+ fi
+ done
rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/site.py*
-
+
#
# FIXME: Bandaid against wrong datadir computation
#
@@ -80,7 +75,8 @@ distutils_do_install() {
fi
# Fix backport modules
- if [ -e ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ] && [ -e ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py ]; then
+ if [ -e ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ] &&
+ [ -e ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py ]; then
rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py;
rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc;
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() {
bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
# support filenames with *spaces*
- find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
+ find ${D} -name "*.py" -exec grep -q ${D} {} \; \
+ -exec sed -i -e s:${D}::g {} \;
- if test -e ${D}${bindir} ; then
- for i in ${D}${bindir}/* ; do \
- sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
+ for i in ${D}${bindir}/* ${D}${sbindir}/*; do
+ if [ -f "$i" ]; then
+ sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
- done
- fi
-
- if test -e ${D}${sbindir}; then
- for i in ${D}${sbindir}/* ; do \
- sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
- sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
- done
- fi
+ fi
+ done
rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
-
+
#
# FIXME: Bandaid against wrong datadir computation
#