blob: 12561340b075d9f4b68f9090794b481f0cbbb0ae [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001inherit setuptools3-base pip_install_wheel
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00003# bdist_wheel builds in ./dist
4#B = "${WORKDIR}/build"
Andrew Geissler595f6302022-01-24 19:11:47 +00005
6SETUPTOOLS_BUILD_ARGS ?= ""
7SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
8 --prefix=${prefix} \
9 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
10 --install-data=${datadir}"
11
12SETUPTOOLS_PYTHON = "python3"
13SETUPTOOLS_PYTHON:class-native = "nativepython3"
14
15SETUPTOOLS_SETUP_PATH ?= "${S}"
16
17setuptools3_do_configure() {
18 :
19}
20
21setuptools3_do_compile() {
22 cd ${SETUPTOOLS_SETUP_PATH}
23 NO_FETCH_BUILD=1 \
24 STAGING_INCDIR=${STAGING_INCDIR} \
25 STAGING_LIBDIR=${STAGING_LIBDIR} \
26 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000027 bdist_wheel ${SETUPTOOLS_BUILD_ARGS} || \
28 bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed."
Andrew Geissler595f6302022-01-24 19:11:47 +000029}
30setuptools3_do_compile[vardepsexclude] = "MACHINE"
31
32setuptools3_do_install() {
33 cd ${SETUPTOOLS_SETUP_PATH}
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000034
35 pip_install_wheel_do_install
Andrew Geissler595f6302022-01-24 19:11:47 +000036
37 # support filenames with *spaces*
38 find ${D} -name "*.py" -exec grep -q ${D} {} \; \
39 -exec sed -i -e s:${D}::g {} \;
40
41 for i in ${D}${bindir}/* ${D}${sbindir}/*; do
42 if [ -f "$i" ]; then
43 sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i
44 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
45 fi
46 done
47
48 rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
49
50 #
51 # FIXME: Bandaid against wrong datadir computation
52 #
53 if [ -e ${D}${datadir}/share ]; then
54 mv -f ${D}${datadir}/share/* ${D}${datadir}/
55 rmdir ${D}${datadir}/share
56 fi
57}
58setuptools3_do_install[vardepsexclude] = "MACHINE"
59
60EXPORT_FUNCTIONS do_configure do_compile do_install
61
62export LDSHARED="${CCLD} -shared"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000063DEPENDS += "python3-setuptools-native python3-wheel-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064