proxy-libintl: fix install for micro and simply stage
[openembedded.git] / classes / distutils.bbclass
blob4d1fc8c6fc9efd7afe9c24dc20c205d2c1a9f645
1 inherit distutils-base
3 DISTUTILS_BUILD_ARGS ?= ""
4 DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}"
5 DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \
6     --install-data=${STAGING_DATADIR}"
7 DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \
8     --install-data=${D}/${datadir}"
10 distutils_do_compile() {
11          STAGING_INCDIR=${STAGING_INCDIR} \
12          STAGING_LIBDIR=${STAGING_LIBDIR} \
13          BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
14          ${STAGING_BINDIR_NATIVE}/python setup.py build ${DISTUTILS_BUILD_ARGS} || \
15          oefatal "python setup.py build_ext execution failed."
18 distutils_stage_headers() {
19         install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages
20         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
21         ${STAGING_BINDIR_NATIVE}/python setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
22         oefatal "python setup.py install_headers execution failed."
25 distutils_stage_all() {
26         STAGING_INCDIR=${STAGING_INCDIR} \
27         STAGING_LIBDIR=${STAGING_LIBDIR} \
28         install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages
29         PYTHONPATH=${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages \
30         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
31         ${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
32         oefatal "python setup.py install (stage) execution failed."
35 distutils_do_install() {
36         install -d ${D}${libdir}/${PYTHON_DIR}/site-packages
37         STAGING_INCDIR=${STAGING_INCDIR} \
38         STAGING_LIBDIR=${STAGING_LIBDIR} \
39         PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \
40         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
41         ${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_INSTALL_ARGS} || \
42         oefatal "python setup.py install execution failed."
44         for i in `find ${D} -name "*.py"` ; do \
45             sed -i -e s:${D}::g $i
46         done
48         if test -e ${D}${bindir} ; then 
49             for i in ${D}${bindir}/* ; do \
50                 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
51             done
52         fi
54         if test -e ${D}${sbindir}; then
55             for i in ${D}${sbindir}/* ; do \
56                 sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
57             done
58         fi
60         rm -f ${D}${libdir}/${PYTHON_DIR}/site-packages/easy-install.pth
61         
62         #
63         # FIXME: Bandaid against wrong datadir computation
64         #
65         if test -e ${D}${datadir}/share; then
66             mv -f ${D}${datadir}/share/* ${D}${datadir}/
67         fi
70 EXPORT_FUNCTIONS do_compile do_install