diff options
author | Tim Orling <ticotimo@gmail.com> | 2022-01-11 11:01:11 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-12 21:09:01 +0000 |
commit | 458f37948928da5ca752f8f8beff4e95e919d06f (patch) | |
tree | bfb61a723d385333d85f6967320eda85913b259f | |
parent | 5e36659ee314fdde2a357fa40a2109a9ebc7530d (diff) | |
download | poky-458f37948928da5ca752f8f8beff4e95e919d06f.tar.gz |
setuptools3: refactor for no distutils bbclasses
Add setuptools3-base.bbclass as a re-usable starting point similar to
what used to be distutils-common-base.bbclass and disutils3-base.bbclass.
We no longer need to support python2, so no need for a
setuptools-common-base.bbclass.
Refactor setuptools3.bbclass to use setuptools3-base.bbclass instead of
the distulis*.bbclasses.
(From OE-Core rev: ca73393a36c4144662ea8570f904154188e9815a)
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/setuptools3-base.bbclass | 31 | ||||
-rw-r--r-- | meta/classes/setuptools3.bbclass | 66 |
2 files changed, 96 insertions, 1 deletions
diff --git a/meta/classes/setuptools3-base.bbclass b/meta/classes/setuptools3-base.bbclass new file mode 100644 index 0000000000..5098ae9d64 --- /dev/null +++ b/meta/classes/setuptools3-base.bbclass | |||
@@ -0,0 +1,31 @@ | |||
1 | DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}" | ||
2 | DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}" | ||
3 | RDEPENDS:${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}" | ||
4 | |||
5 | export STAGING_INCDIR | ||
6 | export STAGING_LIBDIR | ||
7 | |||
8 | # LDSHARED is the ld *command* used to create shared library | ||
9 | export LDSHARED = "${CCLD} -shared" | ||
10 | # LDXXSHARED is the ld *command* used to create shared library of C++ | ||
11 | # objects | ||
12 | export LDCXXSHARED = "${CXX} -shared" | ||
13 | # CCSHARED are the C *flags* used to create objects to go into a shared | ||
14 | # library (module) | ||
15 | export CCSHARED = "-fPIC -DPIC" | ||
16 | # LINKFORSHARED are the flags passed to the $(CC) command that links | ||
17 | # the python executable | ||
18 | export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic" | ||
19 | |||
20 | FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*" | ||
21 | |||
22 | FILES:${PN}-staticdev += "\ | ||
23 | ${PYTHON_SITEPACKAGES_DIR}/*.a \ | ||
24 | " | ||
25 | FILES:${PN}-dev += "\ | ||
26 | ${datadir}/pkgconfig \ | ||
27 | ${libdir}/pkgconfig \ | ||
28 | ${PYTHON_SITEPACKAGES_DIR}/*.la \ | ||
29 | " | ||
30 | inherit python3native python3targetconfig | ||
31 | |||
diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass index 8ca66ee708..fd8499d26c 100644 --- a/meta/classes/setuptools3.bbclass +++ b/meta/classes/setuptools3.bbclass | |||
@@ -1,4 +1,68 @@ | |||
1 | inherit distutils3 | 1 | inherit setuptools3-base |
2 | 2 | ||
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" | ||
3 | DEPENDS += "python3-setuptools-native" | 67 | DEPENDS += "python3-setuptools-native" |
4 | 68 | ||