diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/setuptools3_legacy.bbclass | |
parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz |
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.
(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/setuptools3_legacy.bbclass')
-rw-r--r-- | meta/classes-recipe/setuptools3_legacy.bbclass | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/classes-recipe/setuptools3_legacy.bbclass b/meta/classes-recipe/setuptools3_legacy.bbclass new file mode 100644 index 0000000000..21748f922a --- /dev/null +++ b/meta/classes-recipe/setuptools3_legacy.bbclass | |||
@@ -0,0 +1,84 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | # This class is for packages which use the deprecated setuptools behaviour, | ||
8 | # specifically custom install tasks which don't work correctly with bdist_wheel. | ||
9 | # This behaviour is deprecated in setuptools[1] and won't work in the future, so | ||
10 | # all users of this should consider their options: pure Python modules can use a | ||
11 | # modern Python tool such as build[2], or packages which are doing more (such as | ||
12 | # installing init scripts) should use a fully-featured build system such as Meson. | ||
13 | # | ||
14 | # [1] https://setuptools.pypa.io/en/latest/history.html#id142 | ||
15 | # [2] https://pypi.org/project/build/ | ||
16 | |||
17 | inherit setuptools3-base | ||
18 | |||
19 | B = "${WORKDIR}/build" | ||
20 | |||
21 | SETUPTOOLS_BUILD_ARGS ?= "" | ||
22 | SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \ | ||
23 | --prefix=${prefix} \ | ||
24 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ | ||
25 | --install-data=${datadir}" | ||
26 | |||
27 | SETUPTOOLS_PYTHON = "python3" | ||
28 | SETUPTOOLS_PYTHON:class-native = "nativepython3" | ||
29 | |||
30 | SETUPTOOLS_SETUP_PATH ?= "${S}" | ||
31 | |||
32 | setuptools3_legacy_do_configure() { | ||
33 | : | ||
34 | } | ||
35 | |||
36 | setuptools3_legacy_do_compile() { | ||
37 | cd ${SETUPTOOLS_SETUP_PATH} | ||
38 | NO_FETCH_BUILD=1 \ | ||
39 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
40 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
41 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ | ||
42 | build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \ | ||
43 | bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed." | ||
44 | } | ||
45 | setuptools3_legacy_do_compile[vardepsexclude] = "MACHINE" | ||
46 | |||
47 | setuptools3_legacy_do_install() { | ||
48 | cd ${SETUPTOOLS_SETUP_PATH} | ||
49 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} | ||
50 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
51 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
52 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ | ||
53 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ | ||
54 | build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \ | ||
55 | bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed." | ||
56 | |||
57 | # support filenames with *spaces* | ||
58 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ | ||
59 | -exec sed -i -e s:${D}::g {} \; | ||
60 | |||
61 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do | ||
62 | if [ -f "$i" ]; then | ||
63 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i | ||
64 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | ||
65 | fi | ||
66 | done | ||
67 | |||
68 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth | ||
69 | |||
70 | # | ||
71 | # FIXME: Bandaid against wrong datadir computation | ||
72 | # | ||
73 | if [ -e ${D}${datadir}/share ]; then | ||
74 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ | ||
75 | rmdir ${D}${datadir}/share | ||
76 | fi | ||
77 | } | ||
78 | setuptools3_legacy_do_install[vardepsexclude] = "MACHINE" | ||
79 | |||
80 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
81 | |||
82 | export LDSHARED="${CCLD} -shared" | ||
83 | DEPENDS += "python3-setuptools-native" | ||
84 | |||