blob: a6d8e8763f3eddfb78068d7b5df6c617f5e037ab [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001inherit distutils3-base
2
Andrew Geissler82c905d2020-04-13 13:39:40 -05003B = "${WORKDIR}/build"
4distutils_do_configure[cleandirs] = "${B}"
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006DISTUTILS_BUILD_ARGS ?= ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
8 --prefix=${prefix} \
9 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
10 --install-data=${datadir}"
11
Brad Bishopc342db32019-05-15 21:57:59 -040012DISTUTILS_PYTHON = "python3"
Patrick Williams213cb262021-08-07 19:21:33 -050013DISTUTILS_PYTHON:class-native = "nativepython3"
Brad Bishopc342db32019-05-15 21:57:59 -040014
Andrew Geisslerd1e89492021-02-12 15:35:20 -060015DISTUTILS_SETUP_PATH ?= "${S}"
16
Andrew Geissler595f6302022-01-24 19:11:47 +000017python __anonymous() {
18 bb.warn("distutils3.bbclass is deprecated, please use setuptools3.bbclass instead")
19}
20
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021distutils3_do_configure() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050022 :
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
25distutils3_do_compile() {
Andrew Geisslerd1e89492021-02-12 15:35:20 -060026 cd ${DISTUTILS_SETUP_PATH}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027 NO_FETCH_BUILD=1 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 STAGING_INCDIR=${STAGING_INCDIR} \
29 STAGING_LIBDIR=${STAGING_LIBDIR} \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060030 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
Andrew Geissler82c905d2020-04-13 13:39:40 -050031 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032 bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050034distutils3_do_compile[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036distutils3_do_install() {
Andrew Geisslerd1e89492021-02-12 15:35:20 -060037 cd ${DISTUTILS_SETUP_PATH}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 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} \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060042 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
Andrew Geissler82c905d2020-04-13 13:39:40 -050043 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045
46 # support filenames with *spaces*
Brad Bishopc342db32019-05-15 21:57:59 -040047 find ${D} -name "*.py" -exec grep -q ${D} {} \; \
48 -exec sed -i -e s:${D}::g {} \;
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Brad Bishopc342db32019-05-15 21:57:59 -040050 for i in ${D}${bindir}/* ${D}${sbindir}/*; do
51 if [ -f "$i" ]; then
52 sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
Brad Bishopc342db32019-05-15 21:57:59 -040054 fi
55 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
57 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
Brad Bishopc342db32019-05-15 21:57:59 -040058
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059 #
60 # FIXME: Bandaid against wrong datadir computation
61 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 if [ -e ${D}${datadir}/share ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063 mv -f ${D}${datadir}/share/* ${D}${datadir}/
64 rmdir ${D}${datadir}/share
65 fi
66}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050067distutils3_do_install[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069EXPORT_FUNCTIONS do_configure do_compile do_install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070
71export LDSHARED="${CCLD} -shared"