Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit distutils3-base |
| 2 | |
| 3 | DISTUTILS_BUILD_ARGS ?= "" |
| 4 | DISTUTILS_BUILD_EXT_ARGS ?= "" |
| 5 | DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}" |
| 6 | DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \ |
| 7 | --install-data=${STAGING_DATADIR}" |
| 8 | DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \ |
| 9 | --install-data=${D}/${datadir}" |
| 10 | |
| 11 | distutils3_do_compile() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 13 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ |
| 15 | build ${DISTUTILS_BUILD_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 16 | bbfatal_log "${PYTHON_PN} setup.py build_ext execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 18 | distutils3_do_compile[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | |
| 20 | distutils3_stage_headers() { |
| 21 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 23 | bbfatal_log "${PYTHON_PN} setup.py install_headers execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 25 | distutils3_stage_headers[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | |
| 27 | distutils3_stage_all() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 29 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 30 | install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} |
| 31 | PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 33 | bbfatal_log "${PYTHON_PN} setup.py install (stage) execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 35 | distutils3_stage_all[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | |
| 37 | distutils3_do_install() { |
| 38 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 40 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 41 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 43 | bbfatal_log "${PYTHON_PN} setup.py install execution failed." |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | |
| 45 | # support filenames with *spaces* |
| 46 | find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; |
| 47 | |
| 48 | if test -e ${D}${bindir} ; then |
| 49 | for i in ${D}${bindir}/* ; do \ |
| 50 | sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i |
| 51 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 52 | done |
| 53 | fi |
| 54 | |
| 55 | if test -e ${D}${sbindir}; then |
| 56 | for i in ${D}${sbindir}/* ; do \ |
| 57 | sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${bindir}/env\ ${PYTHON_PN}:g $i |
| 58 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 59 | done |
| 60 | fi |
| 61 | |
| 62 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
| 63 | |
| 64 | # |
| 65 | # FIXME: Bandaid against wrong datadir computation |
| 66 | # |
| 67 | if test -e ${D}${datadir}/share; then |
| 68 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ |
| 69 | rmdir ${D}${datadir}/share |
| 70 | fi |
| 71 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 72 | distutils3_do_install[vardepsexclude] = "MACHINE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 73 | |
| 74 | EXPORT_FUNCTIONS do_compile do_install |
| 75 | |
| 76 | export LDSHARED="${CCLD} -shared" |