blob: 909415efa031ed9c774f55f3e2fcf7385d604c69 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001inherit distutils3-base
2
3B = "${WORKDIR}/build"
4distutils_do_configure[cleandirs] = "${B}"
5
6DISTUTILS_BUILD_ARGS ?= ""
7DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
8 --prefix=${prefix} \
9 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
10 --install-data=${datadir}"
11
12DISTUTILS_PYTHON = "python3"
13DISTUTILS_PYTHON:class-native = "nativepython3"
14
15DISTUTILS_SETUP_PATH ?= "${S}"
16
17python __anonymous() {
18 bb.warn("distutils3.bbclass is deprecated, please use setuptools3.bbclass instead")
19}
20
21distutils3_do_configure() {
22 :
23}
24
25distutils3_do_compile() {
26 cd ${DISTUTILS_SETUP_PATH}
27 NO_FETCH_BUILD=1 \
28 STAGING_INCDIR=${STAGING_INCDIR} \
29 STAGING_LIBDIR=${STAGING_LIBDIR} \
Patrick Williams39653562024-03-01 08:54:02 -060030 ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py \
Andrew Geissler9aee5002022-03-30 16:27:02 +000031 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
Patrick Williams39653562024-03-01 08:54:02 -060032 bbfatal_log "'python3 setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
Andrew Geissler9aee5002022-03-30 16:27:02 +000033}
34distutils3_do_compile[vardepsexclude] = "MACHINE"
35
36distutils3_do_install() {
37 cd ${DISTUTILS_SETUP_PATH}
38 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
39 STAGING_INCDIR=${STAGING_INCDIR} \
40 STAGING_LIBDIR=${STAGING_LIBDIR} \
41 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
Patrick Williams39653562024-03-01 08:54:02 -060042 ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py \
Andrew Geissler9aee5002022-03-30 16:27:02 +000043 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
Patrick Williams39653562024-03-01 08:54:02 -060044 bbfatal_log "'python3 setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
Andrew Geissler9aee5002022-03-30 16:27:02 +000045
46 # support filenames with *spaces*
47 find ${D} -name "*.py" -exec grep -q ${D} {} \; \
48 -exec sed -i -e s:${D}::g {} \;
49
50 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
53 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
54 fi
55 done
56
57 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
58
59 #
60 # FIXME: Bandaid against wrong datadir computation
61 #
62 if [ -e ${D}${datadir}/share ]; then
63 mv -f ${D}${datadir}/share/* ${D}${datadir}/
64 rmdir ${D}${datadir}/share
65 fi
66}
67distutils3_do_install[vardepsexclude] = "MACHINE"
68
69EXPORT_FUNCTIONS do_configure do_compile do_install
70
71export LDSHARED="${CCLD} -shared"