summaryrefslogtreecommitdiffstats
path: root/meta/classes/distutils3.bbclass
diff options
context:
space:
mode:
authorJack Mitchell <ml@embed.me.uk>2020-12-08 16:03:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-15 22:51:55 +0000
commitdf7bccf25496393ee58ec28afb00ad42d7abf70e (patch)
tree736ecb4e287596ce19e308ae9c592e17debdd45e /meta/classes/distutils3.bbclass
parente5f74ec3c84a5143b273867a7ea51a5c542e82fc (diff)
downloadpoky-df7bccf25496393ee58ec28afb00ad42d7abf70e.tar.gz
distutils3: allow setup.py to be run from a different directory to ${S}
Sometimes setup.py can be buried deep in a source tree. This has traditionally been solved with setting S to the subdirectory in the source. However with the new pseudo changes, some python modules make changes to files beneath ${S}, for example: S = "${WORKDIR}/git/python/pythonmodule" then in setup.py it works with source code in a relative fashion, such as: ../../src This causes pseudo to abort as it isn't tracking the paths. Therefore implement the variable DISTUTILS_SETUP_PATH so that recipes can use: S = "${WORKDIR}/git" DISTUTILS_SETUP_PATH = "${S}/python/pythonmodule" inherit distutils3 This allows the full source tree to be monitored, while distutils can run setup.py from a location other than ${S}. (From OE-Core rev: ddcc349cede0c4fe1909df1ded7b0a7c509cd758) Signed-off-by: Jack Mitchell <ml@embed.me.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/distutils3.bbclass')
-rw-r--r--meta/classes/distutils3.bbclass10
1 files changed, 6 insertions, 4 deletions
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
index 7356b5245a..a916a8000c 100644
--- a/meta/classes/distutils3.bbclass
+++ b/meta/classes/distutils3.bbclass
@@ -12,28 +12,30 @@ DISTUTILS_INSTALL_ARGS ?= "--root=${D} \
12DISTUTILS_PYTHON = "python3" 12DISTUTILS_PYTHON = "python3"
13DISTUTILS_PYTHON_class-native = "nativepython3" 13DISTUTILS_PYTHON_class-native = "nativepython3"
14 14
15DISTUTILS_SETUP_PATH ?= "${S}"
16
15distutils3_do_configure() { 17distutils3_do_configure() {
16 : 18 :
17} 19}
18 20
19distutils3_do_compile() { 21distutils3_do_compile() {
20 cd ${S} 22 cd ${DISTUTILS_SETUP_PATH}
21 NO_FETCH_BUILD=1 \ 23 NO_FETCH_BUILD=1 \
22 STAGING_INCDIR=${STAGING_INCDIR} \ 24 STAGING_INCDIR=${STAGING_INCDIR} \
23 STAGING_LIBDIR=${STAGING_LIBDIR} \ 25 STAGING_LIBDIR=${STAGING_LIBDIR} \
24 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \ 26 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
25 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \ 27 build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \
26 bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed." 28 bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed."
27} 29}
28distutils3_do_compile[vardepsexclude] = "MACHINE" 30distutils3_do_compile[vardepsexclude] = "MACHINE"
29 31
30distutils3_do_install() { 32distutils3_do_install() {
31 cd ${S} 33 cd ${DISTUTILS_SETUP_PATH}
32 install -d ${D}${PYTHON_SITEPACKAGES_DIR} 34 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
33 STAGING_INCDIR=${STAGING_INCDIR} \ 35 STAGING_INCDIR=${STAGING_INCDIR} \
34 STAGING_LIBDIR=${STAGING_LIBDIR} \ 36 STAGING_LIBDIR=${STAGING_LIBDIR} \
35 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ 37 PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
36 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/setup.py \ 38 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
37 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \ 39 build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \
38 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." 40 bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed."
39 41