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 05/24] classes: Add distutils for python3
Date: Fri, 28 Jun 2013 15:03:50 -0700	[thread overview]
Message-ID: <860ba65f833a1b1055378ee6d891f619e330d68e.1372456294.git.raj.khem@gmail.com> (raw)
In-Reply-To: <4da336aceedb08e21f23fed08fede84eec15ad7b.1372456294.git.raj.khem@gmail.com>
In-Reply-To: <cover.1372456294.git.raj.khem@gmail.com>

In line with python2 add distutils and setuptools
classes for handing python3

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/distutils-tools.bbclass        |   77 +++++++++++++++++++++++
 meta/classes/distutils3-base.bbclass        |    5 ++
 meta/classes/distutils3-native-base.bbclass |    3 +
 meta/classes/distutils3.bbclass             |   90 +++++++++++++++++++++++++++
 meta/classes/setuptools3.bbclass            |   10 +++
 5 files changed, 185 insertions(+)
 create mode 100644 meta/classes/distutils-tools.bbclass
 create mode 100644 meta/classes/distutils3-base.bbclass
 create mode 100644 meta/classes/distutils3-native-base.bbclass
 create mode 100644 meta/classes/distutils3.bbclass
 create mode 100644 meta/classes/setuptools3.bbclass

diff --git a/meta/classes/distutils-tools.bbclass b/meta/classes/distutils-tools.bbclass
new file mode 100644
index 0000000..f43450e
--- /dev/null
+++ b/meta/classes/distutils-tools.bbclass
@@ -0,0 +1,77 @@
+DISTUTILS_BUILD_ARGS ?= ""
+DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
+DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
+    --install-data=${STAGING_DATADIR}"
+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_ext execution failed."
+}
+
+distutils_stage_headers() {
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install_headers execution failed."
+}
+
+distutils_stage_all() {
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install (stage) execution failed."
+}
+
+distutils_do_install() {
+        echo "Beginning ${PN} Install ..."
+        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
+        echo "Step 2 of ${PN} Install ..."
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install execution failed."
+
+        echo "Step 3 of ${PN} Install ..."
+        # support filenames with *spaces*
+        find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
+            sed -i -e s:${D}::g $i
+        done
+
+        echo "Step 4 of ${PN} Install ..."
+        if test -e ${D}${bindir} ; then	
+            for i in ${D}${bindir}/* ; do \
+                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
+            done
+        fi
+
+        echo "Step 4 of ${PN} Install ..."
+        if test -e ${D}${sbindir}; then
+            for i in ${D}${sbindir}/* ; do \
+                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
+            done
+        fi
+
+        echo "Step 5 of ${PN} Install ..."
+        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
+        
+        #
+        # FIXME: Bandaid against wrong datadir computation
+        #
+        if test -e ${D}${datadir}/share; then
+            mv -f ${D}${datadir}/share/* ${D}${datadir}/
+        fi
+}
+
+#EXPORT_FUNCTIONS do_compile do_install
+
+export LDSHARED="${CCLD} -shared"
diff --git a/meta/classes/distutils3-base.bbclass b/meta/classes/distutils3-base.bbclass
new file mode 100644
index 0000000..82ab6a3
--- /dev/null
+++ b/meta/classes/distutils3-base.bbclass
@@ -0,0 +1,5 @@
+DEPENDS  += "${@["${PYTHON_PN}-native ${PYTHON_PN}", ""][(d.getVar('PACKAGES', True) == '')]}"
+RDEPENDS_${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
+
+inherit distutils-common-base python3native
+
diff --git a/meta/classes/distutils3-native-base.bbclass b/meta/classes/distutils3-native-base.bbclass
new file mode 100644
index 0000000..b4a333f
--- /dev/null
+++ b/meta/classes/distutils3-native-base.bbclass
@@ -0,0 +1,3 @@
+PYTHON_BASEVERSION = "3.3"
+
+inherit distutils-native-base
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
new file mode 100644
index 0000000..3738b14
--- /dev/null
+++ b/meta/classes/distutils3.bbclass
@@ -0,0 +1,90 @@
+
+PYTHON_BASEVERSION = "3.3"
+
+inherit distutils3-base 
+#distutils-tools
+
+DISTUTILS_BUILD_ARGS ?= ""
+DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
+DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
+    --install-data=${STAGING_DATADIR}"
+DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
+    --install-data=${D}/${datadir}"
+
+distutils3_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_ext execution failed."
+}
+
+distutils3_stage_headers() {
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install_headers execution failed."
+}
+
+distutils3_stage_all() {
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install (stage) execution failed."
+}
+
+distutils3_do_install() {
+        echo "Beginning ${PN} Install ..."
+        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
+
+        echo "Step 2 of ${PN} Install ..."
+        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} || \
+        bbfatal "${PYTHON_PN} setup.py install execution failed."
+
+        echo "Step 3 of ${PN} Install ..."
+        # support filenames with *spaces*
+        find ${D} -name "*.py" -print0 | while read -d $'\0' i ; do \
+            sed -i -e s:${D}::g $i
+        done
+
+        echo "Step 4 of ${PN} Install ..."
+        if test -e ${D}${bindir} ; then	
+            for i in ${D}${bindir}/* ; do \
+                echo "Processing " $i; \
+                sed -i \
+                    -e s:${STAGING_BINDIR_NATIVE}/python3-native:${bindir}:g \
+                    $i
+            done
+        fi
+
+        echo "Step 4 of ${PN} Install ..."
+        if test -e ${D}${sbindir}; then
+            for i in ${D}${sbindir}/* ; do \
+                echo "Processing " $i; \
+                sed -i \
+                    -e s:${STAGING_BINDIR_NATIVE}/python3-native:${bindir}:g \
+                    $i
+            done
+        fi
+
+        echo "Step 5 of ${PN} Install ..."
+        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
+        
+        #
+        # FIXME: Bandaid against wrong datadir computation
+        #
+        if test -e ${D}${datadir}/share; then
+            mv -f ${D}${datadir}/share/* ${D}${datadir}/
+        fi
+}
+
+EXPORT_FUNCTIONS do_compile do_install
+
+export LDSHARED="${CCLD} -shared"
diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass
new file mode 100644
index 0000000..601c0f6
--- /dev/null
+++ b/meta/classes/setuptools3.bbclass
@@ -0,0 +1,10 @@
+inherit distutils3
+
+DEPENDS += "python3-distribute-native"
+
+DISTUTILS_INSTALL_ARGS = "--root=${D} \
+    --prefix=${prefix} \
+    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
+    --install-data=${datadir}"
+
+#    --single-version-externally-managed \
-- 
1.7.9.5



  parent reply	other threads:[~2013-06-28 22:04 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 21:59 [PATCH 00/24] Add python3 recipes Khem Raj
2013-06-28 22:03 ` [PATCH 01/24] generate-manifest-3.3.py: Add script to generate python 3.3 manifests Khem Raj
2013-06-28 22:03 ` [PATCH 02/24] python3native.bbclass: Add python3 abstraction class Khem Raj
2013-06-28 22:03 ` [PATCH 03/24] package_rpm.bbclass:Make the regexp less greedy Khem Raj
2013-06-28 22:03 ` [PATCH 04/24] classes/distutils: Introduce PYTHON_PN Khem Raj
2013-06-29  5:29   ` Martin Jansa
2013-06-29 14:07     ` Khem Raj
2013-06-28 22:03 ` Khem Raj [this message]
2013-06-28 22:03 ` [PATCH 06/24] setuptools.bbclass: Use python-distribute instead of python-setuptools Khem Raj
2013-06-28 22:03 ` [PATCH 07/24] distutils3.bbclass: Port the distutils class fix to handle filenames with spaces Khem Raj
2013-06-28 22:03 ` [PATCH 08/24] setuptools3.bbclass: Remove useless multiline comment Khem Raj
2013-06-28 22:03 ` [PATCH 09/24] distutils: Introduce PYTHON_ABI variable Khem Raj
2013-06-28 22:03 ` [PATCH 10/24] distutils3: Do build_ext as separate step during compile Khem Raj
2013-06-28 22:03 ` [PATCH 11/24] python-3.3-manifest: Add python3 manifest file Khem Raj
2013-06-28 22:03 ` [PATCH 12/24] python3: Add recipes Khem Raj
2013-08-26 13:32   ` Martin Jansa
2013-08-26 17:38     ` Khem Raj
2013-08-27  5:23     ` Khem Raj
2013-08-27  7:45       ` Martin Jansa
2013-08-27  7:48         ` Martin Jansa
2013-08-27 18:10           ` Khem Raj
2013-08-27 18:15             ` Martin Jansa
2013-08-28  6:23               ` Khem Raj
2013-06-28 22:03 ` [PATCH 13/24] python3: Add native recipe Khem Raj
2013-06-28 22:03 ` [PATCH 14/24] python_2.7.3.bb: Inherit python-dir Khem Raj
2013-06-28 22:04 ` [PATCH 15/24] ipython: Add recipes for ipython2 and ipython3 Khem Raj
2013-06-28 22:04 ` [PATCH 16/24] python-distribute: Add recipes for python2 and python3 Khem Raj
2013-07-08 10:49   ` Martin Jansa
2013-06-28 22:04 ` [PATCH 17/24] zeromq: Add recipe Khem Raj
2013-06-28 22:04 ` [PATCH 18/24] pyzmq: Add recipes using python3 Khem Raj
2013-06-28 22:04 ` [PATCH 19/24] python3-pycurl: Add recipe Khem Raj
2013-07-08 10:44   ` Martin Jansa
2013-06-28 22:04 ` [PATCH 20/24] python3-docutils: " Khem Raj
2013-06-28 22:04 ` [PATCH 21/24] python3-jinja: Recipe for python3 templating system Khem Raj
2013-06-30 10:30   ` Martin Jansa
2013-06-28 22:04 ` [PATCH 22/24] python3-nose: Testing tools for python Khem Raj
2013-06-28 22:04 ` [PATCH 23/24] python3-sphinx: New recipe for documentation system Khem Raj
2013-06-28 22:04 ` [PATCH 24/24] python3: Upgrade to 3.3.2 Khem Raj
2013-07-08 10:37   ` Paul Eggleton
2013-06-29  5:38 ` [PATCH 00/24] Add python3 recipes Martin Jansa
2013-06-29 14:11   ` Khem Raj
2013-06-29 15:31     ` Martin Jansa
2013-06-29 17:43       ` Khem Raj
2013-07-30  8:16       ` Khem Raj
2013-07-30 16:45         ` Saul Wold
2013-07-30 18:28           ` Khem Raj
2013-07-31 20:40         ` Saul Wold
2013-07-31 20:59           ` Khem Raj
2013-07-31 22:31             ` Khem Raj
2013-07-31 22:49               ` Saul Wold
2013-07-31 22:51                 ` Khem Raj
2013-07-31 23:05                   ` Saul Wold
2013-08-01  4:32                     ` Khem Raj
2013-08-01 14:47                     ` Khem Raj
2013-08-01 20:19                     ` Khem Raj
2013-08-02  4:53                       ` Saul Wold
2013-08-02  7:27                         ` Khem Raj
2013-08-03 22:28                           ` Saul Wold
2013-08-05  5:10                             ` Saul Wold
2013-08-05 17:50                               ` Khem Raj
2013-08-06  5:29                               ` Khem Raj
2013-08-07  4:57                         ` Khem Raj
2013-07-08 10:37 ` Paul Eggleton

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=860ba65f833a1b1055378ee6d891f619e330d68e.1372456294.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.