All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/9] distutils: Consider S != B case
Date: Wed, 10 Feb 2016 17:43:28 +0000	[thread overview]
Message-ID: <d7fb520732892e8f08f7817b7abd127b98fa6c1d.1455126045.git.raj.khem@gmail.com> (raw)
In-Reply-To: <cover.1455126045.git.raj.khem@gmail.com>

out of tree builds can break the assumption about setup.py being in the
current directory, seen especially with devtool when using externalsrc
many python modules cant build since it cant find setup.py in devtool
workspace

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/distutils.bbclass  | 27 +++++++++++++++++----------
 meta/classes/distutils3.bbclass | 26 +++++++++++++++++++-------
 2 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index cd06713..d9e0086 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -8,44 +8,51 @@ DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
     --install-data=${D}/${datadir}"
 
 distutils_do_compile() {
-         STAGING_INCDIR=${STAGING_INCDIR} \
-         STAGING_LIBDIR=${STAGING_LIBDIR} \
-         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
-         ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS} || \
-         bbfatal "${PYTHON_PN} setup.py build execution failed."
+        cwd=$PWD;cd ${S}
+        STAGING_INCDIR=${STAGING_INCDIR} \
+        STAGING_LIBDIR=${STAGING_LIBDIR} \
+        BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
+        bbfatal "${PYTHON_PN} setup.py build execution failed."
+        cd $cwd
 }
 
 distutils_stage_headers() {
+        cwd=$PWD;cd ${S}
         install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install_headers execution failed."
+        cd $cwd
 }
 
 distutils_stage_all() {
+        cwd=$PWD;cd ${S}
         STAGING_INCDIR=${STAGING_INCDIR} \
         STAGING_LIBDIR=${STAGING_LIBDIR} \
         install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
         PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install (stage) execution failed."
+        cd $cwd
 }
 
 distutils_do_install() {
+        cwd=$PWD;cd ${S}
         install -d ${D}${PYTHON_SITEPACKAGES_DIR}
         STAGING_INCDIR=${STAGING_INCDIR} \
         STAGING_LIBDIR=${STAGING_LIBDIR} \
         PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install execution failed."
 
         # 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 {} \;
 
-        if test -e ${D}${bindir} ; then	
+        if test -e ${D}${bindir} ; then
             for i in ${D}${bindir}/* ; do \
                 if [ ${PN} != "${BPN}-native" ]; then
                 	sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/env\ python:g $i
@@ -65,7 +72,6 @@ distutils_do_install() {
 
         rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
         rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/site.py*
-        
         #
         # FIXME: Bandaid against wrong datadir computation
         #
@@ -79,6 +85,7 @@ distutils_do_install() {
 	   rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py;
 	   rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc;
 	fi
+        cd $cwd
 }
 
 EXPORT_FUNCTIONS do_compile do_install
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
index 443bf3a..47cbf72 100644
--- a/meta/classes/distutils3.bbclass
+++ b/meta/classes/distutils3.bbclass
@@ -9,6 +9,8 @@ DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
     --install-data=${D}/${datadir}"
 
 distutils3_do_compile() {
+        cwd=$PWD
+        cd ${S}
         if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
                 SYS=${MACHINE}
         else
@@ -17,13 +19,16 @@ distutils3_do_compile() {
         STAGING_INCDIR=${STAGING_INCDIR} \
         STAGING_LIBDIR=${STAGING_LIBDIR} \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
-        build ${DISTUTILS_BUILD_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \
+        build -build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py build_ext execution failed."
+        cd $cwd
 }
 distutils3_do_compile[vardepsexclude] = "MACHINE"
 
 distutils3_stage_headers() {
+        cwd=$PWD
+        cd ${S}
         install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
         if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
                 SYS=${MACHINE}
@@ -31,12 +36,15 @@ distutils3_stage_headers() {
                 SYS=${HOST_SYS}
         fi
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install_headers execution failed."
+        cd $cwd
 }
 distutils3_stage_headers[vardepsexclude] = "MACHINE"
 
 distutils3_stage_all() {
+        cwd=$PWD
+        cd ${S}
         if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
                 SYS=${MACHINE}
         else
@@ -47,12 +55,15 @@ distutils3_stage_all() {
         install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
         PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install (stage) execution failed."
+        cd $cwd
 }
 distutils3_stage_all[vardepsexclude] = "MACHINE"
 
 distutils3_do_install() {
+        cwd=$PWD
+        cd ${S}
         install -d ${D}${PYTHON_SITEPACKAGES_DIR}
         if [ ${BUILD_SYS} != ${HOST_SYS} ]; then
                 SYS=${MACHINE}
@@ -63,13 +74,13 @@ distutils3_do_install() {
         STAGING_LIBDIR=${STAGING_LIBDIR} \
         PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${SYS} \
-        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
         bbfatal "${PYTHON_PN} setup.py install execution failed."
 
         # support filenames with *spaces*
         find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
 
-        if test -e ${D}${bindir} ; then	
+        if test -e ${D}${bindir} ; then
             for i in ${D}${bindir}/* ; do \
                 sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i
                 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
@@ -84,7 +95,7 @@ distutils3_do_install() {
         fi
 
         rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
-        
+
         #
         # FIXME: Bandaid against wrong datadir computation
         #
@@ -92,6 +103,7 @@ distutils3_do_install() {
             mv -f ${D}${datadir}/share/* ${D}${datadir}/
             rmdir ${D}${datadir}/share
         fi
+        cd $cwd
 }
 distutils3_do_install[vardepsexclude] = "MACHINE"
 
-- 
2.7.1



  reply	other threads:[~2016-02-10 17:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 17:43 [PATCH 0/9] Upgrade uclibc/musl to latest Khem Raj
2016-02-10 17:43 ` Khem Raj [this message]
2016-02-10 18:29   ` [PATCH 1/9] distutils: Consider S != B case Richard Purdie
2016-02-10 18:53     ` Khem Raj
2016-02-10 18:54   ` Phil Blundell
2016-02-10 19:01     ` Khem Raj
2016-02-10 17:43 ` [PATCH 2/9] ltp: Upgrade to 20160126 and fix build on musl Khem Raj
2016-02-11 10:12   ` Richard Purdie
2016-02-11 16:13     ` Khem Raj
2016-02-10 17:43 ` [PATCH 3/9] musl: Upgrade to tip of tree Khem Raj
2016-02-10 17:43 ` [PATCH 4/9] uclibc-ng: Bump up to 1.0.12 release Khem Raj
2016-02-10 21:52   ` akuster808
2016-02-10 17:43 ` [PATCH 5/9] uclibc: fetch from master branch not 1.0 Khem Raj
2016-02-10 17:43 ` [PATCH 6/9] strace: build fix for MIPS + musl libc Khem Raj
2016-02-10 17:43 ` [PATCH 7/9] gdb: " Khem Raj
2016-02-10 17:43 ` [PATCH 8/9] gdb: drop unnecessary CC_FOR_BUILD etc exports Khem Raj
2016-02-10 17:43 ` [PATCH 9/9] nettle.inc: drop duplicate LIC_FILES_CHKSUM and SRC_URI hashes Khem Raj
2016-02-13  8:23 ` [PATCH 0/9] Upgrade uclibc/musl to latest Richard Purdie
2016-02-13 15:43   ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7fb520732892e8f08f7817b7abd127b98fa6c1d.1455126045.git.raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.