blob: 6c303068820f2a9f5d4e874c489fb14ee54fed3b [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit distutils3-base
2
3DISTUTILS_BUILD_ARGS ?= ""
4DISTUTILS_BUILD_EXT_ARGS ?= ""
5DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
6DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
7 --install-data=${STAGING_DATADIR}"
8DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
9 --install-data=${D}/${datadir}"
10
11distutils3_do_compile() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012 STAGING_INCDIR=${STAGING_INCDIR} \
13 STAGING_LIBDIR=${STAGING_LIBDIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
15 build ${DISTUTILS_BUILD_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050016 bbfatal_log "${PYTHON_PN} setup.py build_ext execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050018distutils3_do_compile[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
20distutils3_stage_headers() {
21 install -d ${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050023 bbfatal_log "${PYTHON_PN} setup.py install_headers execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050025distutils3_stage_headers[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
27distutils3_stage_all() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 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 Williamsc124f4f2015-09-15 14:41:29 -050032 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050033 bbfatal_log "${PYTHON_PN} setup.py install (stage) execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050035distutils3_stage_all[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
37distutils3_do_install() {
38 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039 STAGING_INCDIR=${STAGING_INCDIR} \
40 STAGING_LIBDIR=${STAGING_LIBDIR} \
41 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${DISTUTILS_INSTALL_ARGS} || \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050043 bbfatal_log "${PYTHON_PN} setup.py install execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044
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 \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 sed -i -e s:${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051 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 \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057 sed -i -e s:${STAGING_BINDIR_NATIVE}/python-${PYTHON_PN}/${PYTHON_PN}:${USRBINPATH}/env\ ${PYTHON_PN}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 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 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 if [ -e ${D}${datadir}/share ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 mv -f ${D}${datadir}/share/* ${D}${datadir}/
69 rmdir ${D}${datadir}/share
70 fi
71}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050072distutils3_do_install[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073
74EXPORT_FUNCTIONS do_compile do_install
75
76export LDSHARED="${CCLD} -shared"