diff options
| author | Tim Orling <ticotimo@gmail.com> | 2022-02-24 12:21:29 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2022-03-01 09:13:42 -0800 |
| commit | d6dcffc75445fafa93ed4e55f549b149fc9161eb (patch) | |
| tree | bf7d35aa2434f27d7699f076073ab672a6a3d01d /meta-python/classes | |
| parent | 9c0cbd1d8f2f4d7370dfd2be747efd5014f539fa (diff) | |
| download | meta-openembedded-d6dcffc75445fafa93ed4e55f549b149fc9161eb.tar.gz | |
distutils*.bbclass: move from oe-core
distutils has been deprecated in Python 3.10 and will be removed in
Python 3.12 (predicted release date October 2023). For now, move these
classes from oe-core to allow users to migrate.
A deprecation warning has been added to each class.
Documentation is also being dropped in oe-core, but users can refer to
3.4 documentation for the legacy variables and classes.
[YOCTO #14610]
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/classes')
| -rw-r--r-- | meta-python/classes/distutils-common-base.bbclass | 28 | ||||
| -rw-r--r-- | meta-python/classes/distutils3-base.bbclass | 9 | ||||
| -rw-r--r-- | meta-python/classes/distutils3.bbclass | 71 |
3 files changed, 108 insertions, 0 deletions
diff --git a/meta-python/classes/distutils-common-base.bbclass b/meta-python/classes/distutils-common-base.bbclass new file mode 100644 index 0000000000..59c750a3cf --- /dev/null +++ b/meta-python/classes/distutils-common-base.bbclass | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | export STAGING_INCDIR | ||
| 2 | export STAGING_LIBDIR | ||
| 3 | |||
| 4 | # LDSHARED is the ld *command* used to create shared library | ||
| 5 | export LDSHARED = "${CCLD} -shared" | ||
| 6 | # LDXXSHARED is the ld *command* used to create shared library of C++ | ||
| 7 | # objects | ||
| 8 | export LDCXXSHARED = "${CXX} -shared" | ||
| 9 | # CCSHARED are the C *flags* used to create objects to go into a shared | ||
| 10 | # library (module) | ||
| 11 | export CCSHARED = "-fPIC -DPIC" | ||
| 12 | # LINKFORSHARED are the flags passed to the $(CC) command that links | ||
| 13 | # the python executable | ||
| 14 | export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic" | ||
| 15 | |||
| 16 | FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*" | ||
| 17 | |||
| 18 | FILES:${PN}-staticdev += "\ | ||
| 19 | ${PYTHON_SITEPACKAGES_DIR}/*.a \ | ||
| 20 | " | ||
| 21 | FILES:${PN}-dev += "\ | ||
| 22 | ${datadir}/pkgconfig \ | ||
| 23 | ${libdir}/pkgconfig \ | ||
| 24 | ${PYTHON_SITEPACKAGES_DIR}/*.la \ | ||
| 25 | " | ||
| 26 | python __anonymous() { | ||
| 27 | bb.warn("distutils-common-base.bbclass is deprecated, please use setuptools3-base.bbclass instead") | ||
| 28 | } | ||
diff --git a/meta-python/classes/distutils3-base.bbclass b/meta-python/classes/distutils3-base.bbclass new file mode 100644 index 0000000000..850c535bb1 --- /dev/null +++ b/meta-python/classes/distutils3-base.bbclass | |||
| @@ -0,0 +1,9 @@ | |||
| 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 | inherit distutils-common-base python3native python3targetconfig | ||
| 6 | |||
| 7 | python __anonymous() { | ||
| 8 | bb.warn("distutils3-base.bbclass is deprecated, please use setuptools3-base.bbclass instead") | ||
| 9 | |||
diff --git a/meta-python/classes/distutils3.bbclass b/meta-python/classes/distutils3.bbclass new file mode 100644 index 0000000000..a6d8e8763f --- /dev/null +++ b/meta-python/classes/distutils3.bbclass | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | inherit distutils3-base | ||
| 2 | |||
| 3 | B = "${WORKDIR}/build" | ||
| 4 | distutils_do_configure[cleandirs] = "${B}" | ||
| 5 | |||
| 6 | DISTUTILS_BUILD_ARGS ?= "" | ||
| 7 | DISTUTILS_INSTALL_ARGS ?= "--root=${D} \ | ||
| 8 | --prefix=${prefix} \ | ||
| 9 | --install-lib=${PYTHON_SITEPACKAGES_DIR} \ | ||
| 10 | --install-data=${datadir}" | ||
| 11 | |||
| 12 | DISTUTILS_PYTHON = "python3" | ||
| 13 | DISTUTILS_PYTHON:class-native = "nativepython3" | ||
| 14 | |||
| 15 | DISTUTILS_SETUP_PATH ?= "${S}" | ||
| 16 | |||
| 17 | python __anonymous() { | ||
| 18 | bb.warn("distutils3.bbclass is deprecated, please use setuptools3.bbclass instead") | ||
| 19 | } | ||
| 20 | |||
| 21 | distutils3_do_configure() { | ||
| 22 | : | ||
| 23 | } | ||
| 24 | |||
| 25 | distutils3_do_compile() { | ||
| 26 | cd ${DISTUTILS_SETUP_PATH} | ||
| 27 | NO_FETCH_BUILD=1 \ | ||
| 28 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 29 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 30 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ | ||
| 31 | build --build-base=${B} ${DISTUTILS_BUILD_ARGS} || \ | ||
| 32 | bbfatal_log "'${PYTHON_PN} setup.py build ${DISTUTILS_BUILD_ARGS}' execution failed." | ||
| 33 | } | ||
| 34 | distutils3_do_compile[vardepsexclude] = "MACHINE" | ||
| 35 | |||
| 36 | distutils3_do_install() { | ||
| 37 | cd ${DISTUTILS_SETUP_PATH} | ||
| 38 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} | ||
| 39 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 40 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 41 | PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ | ||
| 42 | ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ | ||
| 43 | build --build-base=${B} install --skip-build ${DISTUTILS_INSTALL_ARGS} || \ | ||
| 44 | bbfatal_log "'${PYTHON_PN} setup.py install ${DISTUTILS_INSTALL_ARGS}' execution failed." | ||
| 45 | |||
| 46 | # support filenames with *spaces* | ||
| 47 | find ${D} -name "*.py" -exec grep -q ${D} {} \; \ | ||
| 48 | -exec sed -i -e s:${D}::g {} \; | ||
| 49 | |||
| 50 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do | ||
| 51 | if [ -f "$i" ]; then | ||
| 52 | sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i | ||
| 53 | sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i | ||
| 54 | fi | ||
| 55 | done | ||
| 56 | |||
| 57 | rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth | ||
| 58 | |||
| 59 | # | ||
| 60 | # FIXME: Bandaid against wrong datadir computation | ||
| 61 | # | ||
| 62 | if [ -e ${D}${datadir}/share ]; then | ||
| 63 | mv -f ${D}${datadir}/share/* ${D}${datadir}/ | ||
| 64 | rmdir ${D}${datadir}/share | ||
| 65 | fi | ||
| 66 | } | ||
| 67 | distutils3_do_install[vardepsexclude] = "MACHINE" | ||
| 68 | |||
| 69 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
| 70 | |||
| 71 | export LDSHARED="${CCLD} -shared" | ||
