blob: a916a8000c5eff93c48406d3747791555e60acf5 [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"
13DISTUTILS_PYTHON_class-native = "nativepython3"
14
Andrew Geisslerc723b722021-01-08 16:14:09 -060015DISTUTILS_SETUP_PATH ?= "${S}"
16
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080017distutils3_do_configure() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050018 :
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21distutils3_do_compile() {
Andrew Geisslerc723b722021-01-08 16:14:09 -060022 cd ${DISTUTILS_SETUP_PATH}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023 NO_FETCH_BUILD=1 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 STAGING_INCDIR=${STAGING_INCDIR} \
25 STAGING_LIBDIR=${STAGING_LIBDIR} \
Andrew Geisslerc723b722021-01-08 16:14:09 -060026 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
Andrew Geissler82c905d2020-04-13 13:39:40 -050027 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028 bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050030distutils3_do_compile[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032distutils3_do_install() {
Andrew Geisslerc723b722021-01-08 16:14:09 -060033 cd ${DISTUTILS_SETUP_PATH}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 STAGING_INCDIR=${STAGING_INCDIR} \
36 STAGING_LIBDIR=${STAGING_LIBDIR} \
37 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
Andrew Geisslerc723b722021-01-08 16:14:09 -060038 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
Andrew Geissler82c905d2020-04-13 13:39:40 -050039 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041
42 # support filenames with *spaces*
Brad Bishopc342db32019-05-15 21:57:59 -040043 find ${D} -name "*.py" -exec grep -q ${D} {} \; \
44 -exec sed -i -e s:${D}::g {} \;
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045
Brad Bishopc342db32019-05-15 21:57:59 -040046 for i in ${D}${bindir}/* ${D}${sbindir}/*; do
47 if [ -f "$i" ]; then
48 sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
Brad Bishopc342db32019-05-15 21:57:59 -040050 fi
51 done
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
53 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
Brad Bishopc342db32019-05-15 21:57:59 -040054
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055 #
56 # FIXME: Bandaid against wrong datadir computation
57 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058 if [ -e ${D}${datadir}/share ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059 mv -f ${D}${datadir}/share/* ${D}${datadir}/
60 rmdir ${D}${datadir}/share
61 fi
62}
Patrick Williamsf1e5d692016-03-30 15:21:19 -050063distutils3_do_install[vardepsexclude] = "MACHINE"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065EXPORT_FUNCTIONS do_configure do_compile do_install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066
67export LDSHARED="${CCLD} -shared"