Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | inherit setuptools3-base |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 3 | B = "${WORKDIR}/build" |
| 4 | |
| 5 | SETUPTOOLS_BUILD_ARGS ?= "" |
| 6 | SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \ |
| 7 | --prefix=${prefix} \ |
| 8 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ |
| 9 | --install-data=${datadir}" |
| 10 | |
| 11 | SETUPTOOLS_PYTHON = "python3" |
| 12 | SETUPTOOLS_PYTHON:class-native = "nativepython3" |
| 13 | |
| 14 | SETUPTOOLS_SETUP_PATH ?= "${S}" |
| 15 | |
| 16 | setuptools3_do_configure() { |
| 17 | : |
| 18 | } |
| 19 | |
| 20 | setuptools3_do_compile() { |
| 21 | cd ${SETUPTOOLS_SETUP_PATH} |
| 22 | NO_FETCH_BUILD=1 \ |
| 23 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 24 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 25 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ |
| 26 | build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \ |
| 27 | bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed." |
| 28 | } |
| 29 | setuptools3_do_compile[vardepsexclude] = "MACHINE" |
| 30 | |
| 31 | setuptools3_do_install() { |
| 32 | cd ${SETUPTOOLS_SETUP_PATH} |
| 33 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} |
| 34 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 35 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 36 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ |
| 37 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ |
| 38 | build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \ |
| 39 | bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed." |
| 40 | |
| 41 | # support filenames with *spaces* |
| 42 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ |
| 43 | -exec sed -i -e s:${D}::g {} \; |
| 44 | |
| 45 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
| 46 | if [ -f "$i" ]; then |
| 47 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i |
| 48 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i |
| 49 | fi |
| 50 | done |
| 51 | |
| 52 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth |
| 53 | |
| 54 | # |
| 55 | # FIXME: Bandaid against wrong datadir computation |
| 56 | # |
| 57 | if [ -e ${D}${datadir}/share ]; then |
| 58 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ |
| 59 | rmdir ${D}${datadir}/share |
| 60 | fi |
| 61 | } |
| 62 | setuptools3_do_install[vardepsexclude] = "MACHINE" |
| 63 | |
| 64 | EXPORT_FUNCTIONS do_configure do_compile do_install |
| 65 | |
| 66 | export LDSHARED="${CCLD} -shared" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | DEPENDS += "python3-setuptools-native" |
| 68 | |