All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/26] deprecation of distutils
@ 2021-11-26  4:35 Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 01/26] classes/distutils-*: add warning of deprecation Tim Orling
                   ` (25 more replies)
  0 siblings, 26 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

distutils is deprecated in Python 3.10 and will be removed in Python
3.12 (~October 2023).

This series inserts a deprecation warning into the distutils*.bbclasses
and drops or replaces distutils usage wherever possible.

Instead of distutils3-base, we introduce setuptools3-base, which also
incorporates distutils-common-base.

Remaining usage is in:
  * lib/recipetool/create_buildsys_python.py until we are ready to
    factor it out (and add pyproject.toml and setup.cfg handling)
  * oeqa selftests which are testing distutils3 functionality
  * glib-2.0: upstream is still using distutils.version.LooseVersion
  * gpgme: Still checks for distutils in m4/ax_python_devel.m4
  * python3-numpy: upstream still has a distutils/ module
  * python3-setuptools has a vendored _distutils

I might have missed something else.

No attempt has been made to look at layers outside of oe-core.

The intent is to let this percolate for a few weeks and then drop
distutils*.bbclasses (and move them to meta-python, but with the
warnings).

[YOCTO #14610]

The following changes since commit 6fca075a8d87d033359f81d476c8506df66ad53d:

  gcc: Drop no longer needed patch (2021-11-25 21:53:44 +0000)

are available in the Git repository at:

  git://push.openembedded.org/openembedded-core-contrib timo/core-deprecate-distutils_14610

Tim Orling (26):
  classes/distutils-*: add warning of deprecation
  setuptools: refactor for no distutils bbclasses
  python3-cython: DISTUTILS_* -> SETUPTOOLS_*
  dnf: inherit setuptools3-base instead of distutils
  libdnf: inherit setuptoools3-base not distutils
  python3-dbus: inherit setuptools3-base not distuils
  gpgme: inherit setuptools-base not distutils
  python3-pip: inherit setuptools3 not distutils3
  systemtap: use setuptools-base not distutils
  libcomps: inherit setuptools3-base not distutils
  createrepo-c: inherit setuptools3-base not distutils
  librepo: inherit setuptools3-base not distutils
  btrfs-tools: use setuptools3-base not distutils
  scripts/buildhistory-diff: drop use of distutils
  python3-pygobject: setuptools instead of distutils
  bind: inherit setuptools3-base instead of distutils
  python3-setuptools: do not depend on distutils
  sanity.bbclass: drop usage of distutils
  gstreamer1.0-python: inherit setuptools3-base
  recipetool/create_buildsys_python.py: less distutils
  waf.bbclass: drop usage of distutils
  dnf: drop python3-disutils dependency
  python3: refactor python-config patch
  lib/oe/terminal.py: use bb.version.LooseVersion
  python3native.bbclass: distutils -> sysconfig
  rootfs_rpm.bbclass: distutils -> sysconfig module

 meta/classes/distutils-common-base.bbclass    |  3 +
 meta/classes/distutils3-base.bbclass          |  3 +
 meta/classes/distutils3.bbclass               |  4 ++
 meta/classes/python3native.bbclass            |  2 +-
 meta/classes/rootfs_rpm.bbclass               |  2 +-
 meta/classes/sanity.bbclass                   | 16 ++---
 meta/classes/setuptools3-base.bbclass         | 31 +++++++++
 meta/classes/setuptools3.bbclass              | 67 +++++++++++++++++-
 meta/classes/waf.bbclass                      |  2 +-
 meta/lib/oe/terminal.py                       |  2 +-
 .../recipes-connectivity/bind/bind_9.16.23.bb |  2 +-
 .../btrfs-tools/btrfs-tools_5.15.bb           |  2 +-
 .../createrepo-c/createrepo-c_0.17.7.bb       |  2 +-
 meta/recipes-devtools/dnf/dnf_4.10.0.bb       |  3 +-
 .../libcomps/libcomps_0.1.18.bb               |  2 +-
 meta/recipes-devtools/libdnf/libdnf_0.65.0.bb |  2 +-
 .../librepo/librepo_1.14.2.bb                 |  2 +-
 .../python/python3-cython_0.29.24.bb          |  2 +-
 .../python/python3-dbus_1.2.18.bb             |  2 +-
 .../python/python3-pip_21.3.1.bb              |  2 +-
 .../python/python3-pygobject_3.42.0.bb        |  2 +-
 .../python/python3-setuptools_59.2.0.bb       |  1 -
 ...n-implement-legacy-disutils-behavior.patch | 68 +++++++++++++++++++
 .../python/python3/python-config.patch        | 55 ---------------
 .../recipes-devtools/python/python3_3.10.0.bb |  2 +-
 .../recipes-kernel/systemtap/systemtap_git.bb |  2 +-
 .../gstreamer/gstreamer1.0-python_1.18.5.bb   |  2 +-
 meta/recipes-support/gpgme/gpgme_1.16.0.bb    |  2 +-
 scripts/buildhistory-diff                     |  5 --
 .../lib/recipetool/create_buildsys_python.py  |  4 +-
 30 files changed, 204 insertions(+), 92 deletions(-)
 create mode 100644 meta/classes/setuptools3-base.bbclass
 create mode 100644 meta/recipes-devtools/python/python3/0001-python-config.in-implement-legacy-disutils-behavior.patch
 delete mode 100644 meta/recipes-devtools/python/python3/python-config.patch

-- 
2.30.2



^ permalink raw reply	[flat|nested] 29+ messages in thread

* [RFC PATCH 01/26] classes/distutils-*: add warning of deprecation
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses Tim Orling
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

distutils has been deprecated in Python 3.10 and will be removed in
Python 3.12 (predicted release date October 2023).

Add a warning now that recommends using the roughly equivalent
setuptools-* classes.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/distutils-common-base.bbclass | 3 +++
 meta/classes/distutils3-base.bbclass       | 3 +++
 meta/classes/distutils3.bbclass            | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/meta/classes/distutils-common-base.bbclass b/meta/classes/distutils-common-base.bbclass
index bc994f78de3..59c750a3cf7 100644
--- a/meta/classes/distutils-common-base.bbclass
+++ b/meta/classes/distutils-common-base.bbclass
@@ -23,3 +23,6 @@ FILES:${PN}-dev += "\
   ${libdir}/pkgconfig \
   ${PYTHON_SITEPACKAGES_DIR}/*.la \
 "
+python __anonymous() {
+    bb.warn("distutils-common-base.bbclass is deprecated, please use setuptools3-base.bbclass instead")
+}
diff --git a/meta/classes/distutils3-base.bbclass b/meta/classes/distutils3-base.bbclass
index d41873e4869..850c535bb17 100644
--- a/meta/classes/distutils3-base.bbclass
+++ b/meta/classes/distutils3-base.bbclass
@@ -4,3 +4,6 @@ RDEPENDS:${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-tar
 
 inherit distutils-common-base python3native python3targetconfig
 
+python __anonymous() {
+    bb.warn("distutils3-base.bbclass is deprecated, please use setuptools3-base.bbclass instead")
+
diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
index be645d37bd0..a6d8e8763f3 100644
--- a/meta/classes/distutils3.bbclass
+++ b/meta/classes/distutils3.bbclass
@@ -14,6 +14,10 @@ DISTUTILS_PYTHON:class-native = "nativepython3"
 
 DISTUTILS_SETUP_PATH ?= "${S}"
 
+python __anonymous() {
+    bb.warn("distutils3.bbclass is deprecated, please use setuptools3.bbclass instead")
+}
+
 distutils3_do_configure() {
     :
 }
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 01/26] classes/distutils-*: add warning of deprecation Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  7:37   ` [OE-core] " Konrad Weihmann
  2021-11-26  4:35 ` [RFC PATCH 03/26] python3-cython: DISTUTILS_* -> SETUPTOOLS_* Tim Orling
                   ` (23 subsequent siblings)
  25 siblings, 1 reply; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/setuptools3-base.bbclass | 31 +++++++++++++
 meta/classes/setuptools3.bbclass      | 67 ++++++++++++++++++++++++++-
 2 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 meta/classes/setuptools3-base.bbclass

diff --git a/meta/classes/setuptools3-base.bbclass b/meta/classes/setuptools3-base.bbclass
new file mode 100644
index 00000000000..5098ae9d64e
--- /dev/null
+++ b/meta/classes/setuptools3-base.bbclass
@@ -0,0 +1,31 @@
+DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}"
+DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}"
+RDEPENDS:${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
+
+export STAGING_INCDIR
+export STAGING_LIBDIR
+
+# LDSHARED is the ld *command* used to create shared library
+export LDSHARED  = "${CCLD} -shared"
+# LDXXSHARED is the ld *command* used to create shared library of C++
+# objects
+export LDCXXSHARED  = "${CXX} -shared"
+# CCSHARED are the C *flags* used to create objects to go into a shared
+# library (module)
+export CCSHARED  = "-fPIC -DPIC"
+# LINKFORSHARED are the flags passed to the $(CC) command that links
+# the python executable
+export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
+
+FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
+
+FILES:${PN}-staticdev += "\
+  ${PYTHON_SITEPACKAGES_DIR}/*.a \
+"
+FILES:${PN}-dev += "\
+  ${datadir}/pkgconfig \
+  ${libdir}/pkgconfig \
+  ${PYTHON_SITEPACKAGES_DIR}/*.la \
+"
+inherit python3native python3targetconfig
+
diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass
index 8ca66ee708e..4b8eca3f96e 100644
--- a/meta/classes/setuptools3.bbclass
+++ b/meta/classes/setuptools3.bbclass
@@ -1,4 +1,69 @@
-inherit distutils3
+inherit setuptools3-base
 
+B = "${WORKDIR}/build"
+distutils_do_configure[cleandirs] = "${B}"
+
+SETUPTOOLS_BUILD_ARGS ?= ""
+SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
+    --prefix=${prefix} \
+    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
+    --install-data=${datadir}"
+
+SETUPTOOLS_PYTHON = "python3"
+SETUPTOOLS_PYTHON:class-native = "nativepython3"
+
+SETUPTOOLS_SETUP_PATH ?= "${S}"
+
+setuptools3_do_configure() {
+    :
+}
+
+setuptools3_do_compile() {
+        cd ${SETUPTOOLS_SETUP_PATH}
+        NO_FETCH_BUILD=1 \
+        STAGING_INCDIR=${STAGING_INCDIR} \
+        STAGING_LIBDIR=${STAGING_LIBDIR} \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
+        build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \
+        bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed."
+}
+setuptools3_do_compile[vardepsexclude] = "MACHINE"
+
+setuptools3_do_install() {
+        cd ${SETUPTOOLS_SETUP_PATH}
+        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
+        STAGING_INCDIR=${STAGING_INCDIR} \
+        STAGING_LIBDIR=${STAGING_LIBDIR} \
+        PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
+        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
+        build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \
+        bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed."
+
+        # support filenames with *spaces*
+        find ${D} -name "*.py" -exec grep -q ${D} {} \; \
+                               -exec sed -i -e s:${D}::g {} \;
+
+        for i in ${D}${bindir}/* ${D}${sbindir}/*; do
+            if [ -f "$i" ]; then
+                sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i
+                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
+            fi
+        done
+
+        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
+
+        #
+        # FIXME: Bandaid against wrong datadir computation
+        #
+        if [ -e ${D}${datadir}/share ]; then
+            mv -f ${D}${datadir}/share/* ${D}${datadir}/
+            rmdir ${D}${datadir}/share
+        fi
+}
+setuptools3_do_install[vardepsexclude] = "MACHINE"
+
+EXPORT_FUNCTIONS do_configure do_compile do_install
+
+export LDSHARED="${CCLD} -shared"
 DEPENDS += "python3-setuptools-native"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 03/26] python3-cython: DISTUTILS_* -> SETUPTOOLS_*
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 01/26] classes/distutils-*: add warning of deprecation Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 04/26] dnf: inherit setuptools3-base instead of distutils Tim Orling
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

Refactor to new SETUPTOOLS_* variables

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/python/python3-cython_0.29.24.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-cython_0.29.24.bb b/meta/recipes-devtools/python/python3-cython_0.29.24.bb
index b1d21bd15c0..26333cb2718 100644
--- a/meta/recipes-devtools/python/python3-cython_0.29.24.bb
+++ b/meta/recipes-devtools/python/python3-cython_0.29.24.bb
@@ -8,7 +8,7 @@ RDEPENDS:${PN} += "\
 # running build_ext a second time during install fails, because Python
 # would then attempt to import cythonized modules built for the target
 # architecture.
-DISTUTILS_INSTALL_ARGS += "--skip-build"
+SETUPTOOLS_INSTALL_ARGS += "--skip-build"
 
 do_install:append() {
     # rename scripts that would conflict with the Python 2 build of Cython
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 04/26] dnf: inherit setuptools3-base instead of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (2 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 03/26] python3-cython: DISTUTILS_* -> SETUPTOOLS_* Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 05/26] libdnf: inherit setuptoools3-base not distutils Tim Orling
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/dnf/dnf_4.10.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/dnf/dnf_4.10.0.bb b/meta/recipes-devtools/dnf/dnf_4.10.0.bb
index cef2c03e4e2..6ff2a6b1e6f 100644
--- a/meta/recipes-devtools/dnf/dnf_4.10.0.bb
+++ b/meta/recipes-devtools/dnf/dnf_4.10.0.bb
@@ -23,7 +23,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/git"
 
-inherit cmake gettext bash-completion distutils3-base systemd
+inherit cmake gettext bash-completion setuptools3-base systemd
 
 DEPENDS += "libdnf librepo libcomps python3-iniparse"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 05/26] libdnf: inherit setuptoools3-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (3 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 04/26] dnf: inherit setuptools3-base instead of distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 06/26] python3-dbus: inherit setuptools3-base not distuils Tim Orling
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/libdnf/libdnf_0.65.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/libdnf/libdnf_0.65.0.bb b/meta/recipes-devtools/libdnf/libdnf_0.65.0.bb
index fbda7769c07..81da04c9ca1 100644
--- a/meta/recipes-devtools/libdnf/libdnf_0.65.0.bb
+++ b/meta/recipes-devtools/libdnf/libdnf_0.65.0.bb
@@ -22,7 +22,7 @@ S = "${WORKDIR}/git"
 
 DEPENDS = "glib-2.0 libsolv libcheck librepo rpm gtk-doc libmodulemd json-c swig-native"
 
-inherit gtk-doc gobject-introspection cmake pkgconfig distutils3-base
+inherit gtk-doc gobject-introspection cmake pkgconfig setuptools3-base
 
 EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DWITH_MAN=OFF -DPYTHON_DESIRED=3 \
                   ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DWITH_GIR=ON', '-DWITH_GIR=OFF', d)} \
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 06/26] python3-dbus: inherit setuptools3-base not distuils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (4 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 05/26] libdnf: inherit setuptoools3-base not distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 07/26] gpgme: inherit setuptools-base not distutils Tim Orling
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/python/python3-dbus_1.2.18.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-dbus_1.2.18.bb b/meta/recipes-devtools/python/python3-dbus_1.2.18.bb
index 9592fbf7169..c4687de13c2 100644
--- a/meta/recipes-devtools/python/python3-dbus_1.2.18.bb
+++ b/meta/recipes-devtools/python/python3-dbus_1.2.18.bb
@@ -11,7 +11,7 @@ SRC_URI[sha256sum] = "92bdd1e68b45596c833307a5ff4b217ee6929a1502f5341bae28fd120a
 
 S = "${WORKDIR}/dbus-python-${PV}"
 
-inherit distutils3-base autotools pkgconfig
+inherit setuptools3-base autotools pkgconfig
 
 # documentation needs python3-sphinx, which is not in oe-core or meta-python for now
 # change to use PACKAGECONFIG when python3-sphinx is added to oe-core
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 07/26] gpgme: inherit setuptools-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (5 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 06/26] python3-dbus: inherit setuptools3-base not distuils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 08/26] python3-pip: inherit setuptools3 not distutils3 Tim Orling
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

What was distutils-common-base has been merged into setuptools3-base,
since we no longer need to support python2 and python3.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-support/gpgme/gpgme_1.16.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-support/gpgme/gpgme_1.16.0.bb b/meta/recipes-support/gpgme/gpgme_1.16.0.bb
index 0ab30d93b9e..d31e1b3132e 100644
--- a/meta/recipes-support/gpgme/gpgme_1.16.0.bb
+++ b/meta/recipes-support/gpgme/gpgme_1.16.0.bb
@@ -59,7 +59,7 @@ EXTRA_OECONF += '--enable-languages="${LANGUAGES}" \
                  --disable-lang-python-test \
 '
 
-inherit autotools texinfo binconfig-disabled pkgconfig distutils-common-base ${PYTHON_INHERIT} multilib_header
+inherit autotools texinfo binconfig-disabled pkgconfig setuptools3-base ${PYTHON_INHERIT} multilib_header
 
 export PKG_CONFIG='pkg-config'
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 08/26] python3-pip: inherit setuptools3 not distutils3
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (6 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 07/26] gpgme: inherit setuptools-base not distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 09/26] systemtap: use setuptools-base not distutils Tim Orling
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/python/python3-pip_21.3.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-pip_21.3.1.bb b/meta/recipes-devtools/python/python3-pip_21.3.1.bb
index 6ddb1d62966..c893135059b 100644
--- a/meta/recipes-devtools/python/python3-pip_21.3.1.bb
+++ b/meta/recipes-devtools/python/python3-pip_21.3.1.bb
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c4fa2b50f55649f43060fa04b0919b9b"
 
 DEPENDS += "python3 python3-setuptools-native"
 
-inherit pypi distutils3
+inherit pypi setuptools3
 
 SRC_URI += "file://0001-change-shebang-to-python3.patch"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 09/26] systemtap: use setuptools-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (7 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 08/26] python3-pip: inherit setuptools3 not distutils3 Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 10/26] libcomps: inherit setuptools3-base " Tim Orling
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-kernel/systemtap/systemtap_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb
index d11d9b93a2d..04f7e03ab50 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.bb
+++ b/meta/recipes-kernel/systemtap/systemtap_git.bb
@@ -31,7 +31,7 @@ PACKAGECONFIG[monitor] = "--enable-monitor,--disable-monitor,ncurses json-c"
 PACKAGECONFIG[python3-probes] = "--with-python3-probes,--without-python3-probes,python3-setuptools-native"
 
 inherit autotools gettext pkgconfig systemd
-inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3-probes', 'distutils3-base', '', d)}
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3-probes', 'setuptools3-base', '', d)}
 
 # exporter comes with python3-probes
 PACKAGES =+ "${PN}-exporter"
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 10/26] libcomps: inherit setuptools3-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (8 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 09/26] systemtap: use setuptools-base not distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 11/26] createrepo-c: " Tim Orling
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/libcomps/libcomps_0.1.18.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb b/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
index 3fd4d5b83d4..5fa7fd3e35f 100644
--- a/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
+++ b/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
@@ -13,7 +13,7 @@ SRCREV = "dee4ae37f7818709802de28c4d16fa823bd83ae2"
 
 S = "${WORKDIR}/git"
 
-inherit cmake distutils3-base
+inherit cmake setuptools3-base
 
 DEPENDS += "libxml2 expat libcheck"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 11/26] createrepo-c: inherit setuptools3-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (9 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 10/26] libcomps: inherit setuptools3-base " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 12/26] librepo: " Tim Orling
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/createrepo-c/createrepo-c_0.17.7.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c_0.17.7.bb b/meta/recipes-devtools/createrepo-c/createrepo-c_0.17.7.bb
index 0c27756d2ac..0b18b8baa0d 100644
--- a/meta/recipes-devtools/createrepo-c/createrepo-c_0.17.7.bb
+++ b/meta/recipes-devtools/createrepo-c/createrepo-c_0.17.7.bb
@@ -15,7 +15,7 @@ S = "${WORKDIR}/git"
 DEPENDS = "expat curl glib-2.0 libxml2 openssl bzip2 zlib file sqlite3 xz rpm"
 DEPENDS:append:class-native = " file-replacement-native"
 
-inherit cmake pkgconfig bash-completion distutils3-base
+inherit cmake pkgconfig bash-completion setuptools3-base
 
 EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3 -DWITH_ZCHUNK=OFF -DENABLE_DRPM=OFF -DWITH_LIBMODULEMD=OFF"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 12/26] librepo: inherit setuptools3-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (10 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 11/26] createrepo-c: " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 13/26] btrfs-tools: use " Tim Orling
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/librepo/librepo_1.14.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/librepo/librepo_1.14.2.bb b/meta/recipes-devtools/librepo/librepo_1.14.2.bb
index 61a485cfe89..6cd8090b556 100644
--- a/meta/recipes-devtools/librepo/librepo_1.14.2.bb
+++ b/meta/recipes-devtools/librepo/librepo_1.14.2.bb
@@ -16,7 +16,7 @@ S = "${WORKDIR}/git"
 
 DEPENDS = "curl glib-2.0 openssl attr gpgme libxml2"
 
-inherit cmake distutils3-base pkgconfig
+inherit cmake setuptools3-base pkgconfig
 
 EXTRA_OECMAKE = " \
     -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} \
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 13/26] btrfs-tools: use setuptools3-base not distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (11 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 12/26] librepo: " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 14/26] scripts/buildhistory-diff: drop use of distutils Tim Orling
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/btrfs-tools/btrfs-tools_5.15.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.15.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.15.bb
index 399ba17e3ed..45872e4a972 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.15.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.15.bb
@@ -43,7 +43,7 @@ PACKAGECONFIG[crypto-libsodium] = "--with-crypto=libsodium,,libsodium"
 PACKAGECONFIG[crypto-libkcapi] = "--with-crypto=libkcapi,,libkcapi"
 
 inherit autotools-brokensep pkgconfig manpages
-inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'distutils3-base', '', d)}
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3-base', '', d)}
 
 CLEANBROKEN = "1"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 14/26] scripts/buildhistory-diff: drop use of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (12 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 13/26] btrfs-tools: use " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 15/26] python3-pygobject: setuptools instead " Tim Orling
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

The use of distutils.version.LooseVersion to check for GitPython > 0.3.1
is not really needed anymore since any supported distribution has at least
1.0.0 (centos-7 via epel7, debian-9, ubuntu-16.04)

If we want to reinstate this check, alternatives would be to require
python3-packaging on all hosts and use packaging.version.Version or
use an imported LooseVersion in bb.version.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 scripts/buildhistory-diff | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff
index 3bd40a2a1ea..a6e785aa238 100755
--- a/scripts/buildhistory-diff
+++ b/scripts/buildhistory-diff
@@ -11,7 +11,6 @@
 import sys
 import os
 import argparse
-from distutils.version import LooseVersion
 
 # Ensure PythonGit is installed (buildhistory_analysis needs it)
 try:
@@ -73,10 +72,6 @@ def main():
     parser = get_args_parser()
     args = parser.parse_args()
 
-    if LooseVersion(git.__version__) < '0.3.1':
-        sys.stderr.write("Version of GitPython is too old, please install GitPython (python-git) 0.3.1 or later in order to use this script\n")
-        sys.exit(1)
-
     if len(args.revisions) > 2:
         sys.stderr.write('Invalid argument(s) specified: %s\n\n' % ' '.join(args.revisions[2:]))
         parser.print_help()
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 15/26] python3-pygobject: setuptools instead of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (13 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 14/26] scripts/buildhistory-diff: drop use of distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 16/26] bind: inherit setuptools3-base " Tim Orling
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/python/python3-pygobject_3.42.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb b/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb
index b07969c5efb..74318337bad 100644
--- a/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb
+++ b/meta/recipes-devtools/python/python3-pygobject_3.42.0.bb
@@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7"
 GNOMEBASEBUILDCLASS = "meson"
 GIR_MESON_OPTION = ""
 
-inherit gnomebase distutils3-base gobject-introspection upstream-version-is-even
+inherit gnomebase setuptools3-base gobject-introspection upstream-version-is-even
 
 DEPENDS += "python3 glib-2.0"
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 16/26] bind: inherit setuptools3-base instead of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (14 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 15/26] python3-pygobject: setuptools instead " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 17/26] python3-setuptools: do not depend on distutils Tim Orling
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-connectivity/bind/bind_9.16.23.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-connectivity/bind/bind_9.16.23.bb b/meta/recipes-connectivity/bind/bind_9.16.23.bb
index c1bf250c26e..f4db113c7e1 100644
--- a/meta/recipes-connectivity/bind/bind_9.16.23.bb
+++ b/meta/recipes-connectivity/bind/bind_9.16.23.bb
@@ -46,7 +46,7 @@ EXTRA_OECONF = " --with-libtool --disable-devpoll --disable-auto-validation --en
                "
 LDFLAGS:append = " -lz"
 
-inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native distutils3-base', '', d)}
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native setuptools3-base', '', d)}
 
 # dhcp needs .la so keep them
 REMOVE_LIBTOOL_LA = "0"
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 17/26] python3-setuptools: do not depend on distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (15 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 16/26] bind: inherit setuptools3-base " Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 18/26] sanity.bbclass: drop usage of distutils Tim Orling
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

No longer depend on python3-distutils, current versions of setuptools
vendor as _distutils.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/python/python3-setuptools_59.2.0.bb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-setuptools_59.2.0.bb b/meta/recipes-devtools/python/python3-setuptools_59.2.0.bb
index 704f58abd31..9ff4095c7a9 100644
--- a/meta/recipes-devtools/python/python3-setuptools_59.2.0.bb
+++ b/meta/recipes-devtools/python/python3-setuptools_59.2.0.bb
@@ -22,7 +22,6 @@ RDEPENDS:${PN} = "\
     ${PYTHON_PN}-compile \
     ${PYTHON_PN}-compression \
     ${PYTHON_PN}-ctypes \
-    ${PYTHON_PN}-distutils \
     ${PYTHON_PN}-email \
     ${PYTHON_PN}-html \
     ${PYTHON_PN}-json \
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 18/26] sanity.bbclass: drop usage of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (16 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 17/26] python3-setuptools: do not depend on distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 19/26] gstreamer1.0-python: inherit setuptools3-base Tim Orling
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

Refactor to use newly imported bb.version.LooseVersion
and replace `import distutils.sysconfig` with 'import sysconfig`.

https://www.python.org/dev/peps/pep-0632/#id23

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/sanity.bbclass | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 9fbc9c18e7c..d7fdd5c04b1 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -462,7 +462,7 @@ def check_sanity_validmachine(sanity_data):
 # Patch before 2.7 can't handle all the features in git-style diffs.  Some
 # patches may incorrectly apply, and others won't apply at all.
 def check_patch_version(sanity_data):
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     import re, subprocess
 
     try:
@@ -478,7 +478,7 @@ def check_patch_version(sanity_data):
 # Unpatched versions of make 3.82 are known to be broken.  See GNU Savannah Bug 30612.
 # Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
 def check_make_version(sanity_data):
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     import subprocess
 
     try:
@@ -539,7 +539,7 @@ def check_wsl(d):
 # built buildtools-extended-tarball)
 #
 def check_gcc_version(sanity_data):
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     import subprocess
     
     build_cc, version = oe.utils.get_host_compiler_version(sanity_data)
@@ -552,7 +552,7 @@ def check_gcc_version(sanity_data):
 # but earlier versions do not; this needs to work properly for sstate
 # Version 1.28 is needed so opkg-build works correctly when reproducibile builds are enabled
 def check_tar_version(sanity_data):
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     import subprocess
     try:
         result = subprocess.check_output(["tar", "--version"], stderr=subprocess.STDOUT).decode('utf-8')
@@ -567,7 +567,7 @@ def check_tar_version(sanity_data):
 # The kernel tools assume git >= 1.8.3.1 (verified needed > 1.7.9.5) see #6162 
 # The git fetcher also had workarounds for git < 1.7.9.2 which we've dropped
 def check_git_version(sanity_data):
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     import subprocess
     try:
         result = subprocess.check_output(["git", "--version"], stderr=subprocess.DEVNULL).decode('utf-8')
@@ -655,10 +655,10 @@ def check_sanity_version_change(status, d):
 
     # Check the python install is complete. Examples that are often removed in
     # minimal installations: glib-2.0-natives requries # xml.parsers.expat and icu
-    # requires distutils.sysconfig.
+    # requires sysconfig module in Python standard library.
     try:
         import xml.parsers.expat
-        import distutils.sysconfig
+        import sysconfig
     except ImportError as e:
         status.addresult('Your Python 3 is not a full install. Please install the module %s (see the Getting Started guide for further information).\n' % e.name)
 
@@ -796,7 +796,7 @@ def check_sanity_everybuild(status, d):
         status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n')
 
     # Check the bitbake version meets minimum requirements
-    from distutils.version import LooseVersion
+    from bb.version import LooseVersion
     minversion = d.getVar('BB_MIN_VERSION')
     if (LooseVersion(bb.__version__) < LooseVersion(minversion)):
         status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__))
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 19/26] gstreamer1.0-python: inherit setuptools3-base
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (17 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 18/26] sanity.bbclass: drop usage of distutils Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:35 ` [RFC PATCH 20/26] recipetool/create_buildsys_python.py: less distutils Tim Orling
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

Drop distutils3-base usage as it is now deprecated.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb
index 045aea44099..1dd7d0d09a3 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb
@@ -23,4 +23,4 @@ EXTRA_OEMESON += "-Dlibpython-dir=${libdir}"
 REQUIRED_DISTRO_FEATURES = "gobject-introspection-data"
 GIR_MESON_OPTION = ""
 
-inherit meson pkgconfig distutils3-base upstream-version-is-even gobject-introspection features_check
+inherit meson pkgconfig setuptools3-base upstream-version-is-even gobject-introspection features_check
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 20/26] recipetool/create_buildsys_python.py: less distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (18 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 19/26] gstreamer1.0-python: inherit setuptools3-base Tim Orling
@ 2021-11-26  4:35 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 21/26] waf.bbclass: drop usage of distutils Tim Orling
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:35 UTC (permalink / raw)
  To: openembedded-core

distutils is deprecated in Python 3.10 with removal in Python 3.12
(~October 2023). Replace distutils.command.build_py with
setuptools.command.build_py.

There is still a check which decides to inherit setuptools3 vs distutils3
that will need to be refactored when we add pyproject.toml and setup.cfg
support for more modern PEP 517 packages.

Once distutils3.bbclass is dropped, any recipe inheriting distutils3
will throw a parsing error. The plan is to move distutils*.bbclasses to
meta-python. However if meta-python is not in bblayers, the parsing
error would still occur.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 scripts/lib/recipetool/create_buildsys_python.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index 0b6b042ed17..570be7e81b2 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -8,7 +8,7 @@
 import ast
 import codecs
 import collections
-import distutils.command.build_py
+import setuptools.command.build_py
 import email
 import imp
 import glob
@@ -459,7 +459,7 @@ class PythonRecipeHandler(RecipeHandler):
         else:
             package_dir = {}
 
-        class PackageDir(distutils.command.build_py.build_py):
+        class PackageDir(setuptools.command.build_py.build_py):
             def __init__(self, package_dir):
                 self.package_dir = package_dir
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 21/26] waf.bbclass: drop usage of distutils
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (19 preceding siblings ...)
  2021-11-26  4:35 ` [RFC PATCH 20/26] recipetool/create_buildsys_python.py: less distutils Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 22/26] dnf: drop python3-disutils dependency Tim Orling
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

Refactor to use newly imported bb.version.LooseVersion

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/waf.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
index df0ab8d73ff..f9e240c272a 100644
--- a/meta/classes/waf.bbclass
+++ b/meta/classes/waf.bbclass
@@ -43,7 +43,7 @@ BB_HASHBASE_WHITELIST += "WAFLOCK"
 
 python waf_preconfigure() {
     import subprocess
-    from distutils.version import StrictVersion
+    from bb.version import StrictVersion
     subsrcdir = d.getVar('S')
     python = d.getVar('WAF_PYTHON')
     wafbin = os.path.join(subsrcdir, 'waf')
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 22/26] dnf: drop python3-disutils dependency
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (20 preceding siblings ...)
  2021-11-26  4:36 ` [RFC PATCH 21/26] waf.bbclass: drop usage of distutils Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 23/26] python3: refactor python-config patch Tim Orling
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

Upstream dropped the now deprecated distutils:
18995d65 Remove distutils which are deprecated in python3.10 (RhBug:1950229)

Usage was replaced with sysconfig, which is in pyton3-core

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/recipes-devtools/dnf/dnf_4.10.0.bb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/meta/recipes-devtools/dnf/dnf_4.10.0.bb b/meta/recipes-devtools/dnf/dnf_4.10.0.bb
index 6ff2a6b1e6f..3fc24b132df 100644
--- a/meta/recipes-devtools/dnf/dnf_4.10.0.bb
+++ b/meta/recipes-devtools/dnf/dnf_4.10.0.bb
@@ -38,7 +38,6 @@ RDEPENDS:${PN} += " \
   python3-netclient \
   python3-email \
   python3-threading \
-  python3-distutils \
   python3-logging \
   python3-fcntl \
   librepo \
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 23/26] python3: refactor python-config patch
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (21 preceding siblings ...)
  2021-11-26  4:36 ` [RFC PATCH 22/26] dnf: drop python3-disutils dependency Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 24/26] lib/oe/terminal.py: use bb.version.LooseVersion Tim Orling
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

Drop legacy python-config.patch

distutils is deprecated in Python 3.10 and will be removed in Python
3.12 (~October 2023).

Rather than wholesale import the distutils.sysconfig module, refactor
to replicate legacy distutils usage that we need.

This merges changes to get_python_inc from 12-distutils-prefix-is-inside-staging-area.patch

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 ...n-implement-legacy-disutils-behavior.patch | 68 +++++++++++++++++++
 .../python/python3/python-config.patch        | 55 ---------------
 .../recipes-devtools/python/python3_3.10.0.bb |  2 +-
 3 files changed, 69 insertions(+), 56 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python3/0001-python-config.in-implement-legacy-disutils-behavior.patch
 delete mode 100644 meta/recipes-devtools/python/python3/python-config.patch

diff --git a/meta/recipes-devtools/python/python3/0001-python-config.in-implement-legacy-disutils-behavior.patch b/meta/recipes-devtools/python/python3/0001-python-config.in-implement-legacy-disutils-behavior.patch
new file mode 100644
index 00000000000..71fad65def0
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-python-config.in-implement-legacy-disutils-behavior.patch
@@ -0,0 +1,68 @@
+From 9bc5f12a31f1c90913bfa90f71ec12cea95de040 Mon Sep 17 00:00:00 2001
+From: Tim Orling <timothy.t.orling@intel.com>
+Date: Thu, 25 Nov 2021 17:48:23 -0800
+Subject: [PATCH] python-config.in: implement legacy disutils behavior
+
+The sysconfig behavior does not provide the correct paths for our usage,
+but rather than continue to use the deprecated distutils.sysconfig
+behavior, refactor the code paths we need to use supported standard
+library functionality.
+
+[YOCTO #14610]
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
+---
+ Misc/python-config.in | 31 +++++++++++++++++++++++++++----
+ 1 file changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/Misc/python-config.in b/Misc/python-config.in
+index ebd99daa0c..5959d74453 100644
+--- a/Misc/python-config.in
++++ b/Misc/python-config.in
+@@ -35,14 +35,37 @@ if '--help' in opt_flags:
+ 
+ for opt in opt_flags:
+     if opt == '--prefix':
+-        print(getvar('prefix'))
++	# borrow the legacy behavior of distutils.sysconfig.PREFIX
++        print(os.path.normpath(sys.prefix))
+ 
+     elif opt == '--exec-prefix':
+-        print(getvar('exec_prefix'))
++        # borrow the legacy behavior of distutils.sysconfig.EXEC_PREFIX
++        print(os.path.normpath(sys.exec_prefix))
+ 
+     elif opt in ('--includes', '--cflags'):
+-        flags = ['-I' + sysconfig.get_path('include'),
+-                 '-I' + sysconfig.get_path('platinclude')]
++        # borrowing the logic from legacy/deprecated distutils.sysconfig.get_python_inc
++
++        # Calculate the build qualifier flags if they are defined.  Adding the flags
++        # to the include and lib directories only makes sense for an installation, not
++        # an in-source build.
++        build_flags = ''
++        try:
++            if not sysconfig._PYTHON_BUILD:
++                build_flags = sys.abiflags
++        except AttributeError:
++            # It's not a configure-based build, so the sys module doesn't have
++            # this attribute, which is fine.
++            pass
++
++        incdir = os.path.join(sysconfig.get_config_var('srcdir'), 'Include')
++        if prefix is None and os.environ.get('STAGING_LIBDIR', "");
++            prefix = os.environ['STAGING_LIBDIR'].rstrip(lib_basename)
++        elif prefix is None:
++            prefix = sysconfig._BASE_EXEC_PREFIX or sysconfig._BASE_PREFIX
++        python_dir = 'python' + sysconfig.get_python_version() + build_flags
++        #platincdir = sysconfig._sys_home or sysconfig._PROJECT_BASE
++        flags = ['-I' + os.path.normpath(incdir),
++                 '-I' + os.path.join(prefix, "include", python_dir)]
+         if opt == '--cflags':
+             flags.extend(getvar('CFLAGS').split())
+         print(' '.join(flags))
+-- 
+2.30.2
+
diff --git a/meta/recipes-devtools/python/python3/python-config.patch b/meta/recipes-devtools/python/python3/python-config.patch
deleted file mode 100644
index c53f646af35..00000000000
--- a/meta/recipes-devtools/python/python3/python-config.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 57d073c12e7bede29919117b0141df14015eb27f Mon Sep 17 00:00:00 2001
-From: Tyler Hall <tylerwhall@gmail.com>
-Date: Sun, 4 May 2014 20:06:43 -0400
-Subject: [PATCH] python-config: Revert to using distutils.sysconfig
-
-The newer sysconfig module shares some code with distutils.sysconfig, but the same modifications as in
-
-12-distutils-prefix-is-inside-staging-area.patch makes distutils.sysconfig
-
-affect the native runtime as well as cross building. Use the old, patched
-implementation which returns paths in the staging directory and for the target,
-as appropriate.
-
-Upstream-Status: Inappropriate [Embedded Specific]
-
-Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
-
----
- Misc/python-config.in | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/Misc/python-config.in b/Misc/python-config.in
-index ebd99da..13e57ae 100644
---- a/Misc/python-config.in
-+++ b/Misc/python-config.in
-@@ -6,7 +6,9 @@
- import getopt
- import os
- import sys
--import sysconfig
-+import warnings
-+warnings.filterwarnings("ignore", category=DeprecationWarning)
-+from distutils import sysconfig
- 
- valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
-               'ldflags', 'extension-suffix', 'help', 'abiflags', 'configdir',
-@@ -35,14 +35,14 @@ if '--help' in opt_flags:
- 
- for opt in opt_flags:
-     if opt == '--prefix':
--        print(getvar('prefix'))
-+        print(sysconfig.PREFIX)
- 
-     elif opt == '--exec-prefix':
--        print(getvar('exec_prefix'))
-+        print(sysconfig.EXEC_PREFIX)
- 
-     elif opt in ('--includes', '--cflags'):
--        flags = ['-I' + sysconfig.get_path('include'),
--                 '-I' + sysconfig.get_path('platinclude')]
-+        flags = ['-I' + sysconfig.get_python_inc(),
-+                 '-I' + sysconfig.get_python_inc(plat_specific=True)]
-         if opt == '--cflags':
-             flags.extend(getvar('CFLAGS').split())
-         print(' '.join(flags))
diff --git a/meta/recipes-devtools/python/python3_3.10.0.bb b/meta/recipes-devtools/python/python3_3.10.0.bb
index e3300b6495b..6b965af0509 100644
--- a/meta/recipes-devtools/python/python3_3.10.0.bb
+++ b/meta/recipes-devtools/python/python3_3.10.0.bb
@@ -17,7 +17,6 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
            file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \
            ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
            file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \
-           file://python-config.patch \
            file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
            file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
            file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \
@@ -33,6 +32,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
            file://makerace.patch \
            file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
            file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
+           file://0001-python-config.in-implement-legacy-disutils-behavior.patch \
            "
 
 SRC_URI:append:class-native = " \
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 24/26] lib/oe/terminal.py: use bb.version.LooseVersion
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (22 preceding siblings ...)
  2021-11-26  4:36 ` [RFC PATCH 23/26] python3: refactor python-config patch Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 25/26] python3native.bbclass: distutils -> sysconfig Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 26/26] rootfs_rpm.bbclass: distutils -> sysconfig module Tim Orling
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

distutils has been deprecated in Python 3.10 and is slated for removal
in Python 3.12 (~October 2023).

Refactor to use the newly imported bb.version.LooseVersion instead of
distutils.version.LooseVersion.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/lib/oe/terminal.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 59aa80de669..6681b0831a5 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -5,7 +5,7 @@ import logging
 import oe.classutils
 import shlex
 from bb.process import Popen, ExecutionError
-from distutils.version import LooseVersion
+from bb.version import LooseVersion
 
 logger = logging.getLogger('BitBake.OE.Terminal')
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 25/26] python3native.bbclass: distutils -> sysconfig
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (23 preceding siblings ...)
  2021-11-26  4:36 ` [RFC PATCH 24/26] lib/oe/terminal.py: use bb.version.LooseVersion Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  2021-11-26  4:36 ` [RFC PATCH 26/26] rootfs_rpm.bbclass: distutils -> sysconfig module Tim Orling
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

In the comment it says we patch distutils modules, but we now are
patching sysconfig and not using disutils.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/python3native.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index 13fbaa5f9c7..3783c0c47eb 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -4,7 +4,7 @@ PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"
 EXTRANATIVEPATH += "python3-native"
 DEPENDS:append = " python3-native "
 
-# python-config and other scripts are using distutils modules
+# python-config and other scripts are using sysconfig modules
 # which we patch to access these variables
 export STAGING_INCDIR
 export STAGING_LIBDIR
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [RFC PATCH 26/26] rootfs_rpm.bbclass: distutils -> sysconfig module
  2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
                   ` (24 preceding siblings ...)
  2021-11-26  4:36 ` [RFC PATCH 25/26] python3native.bbclass: distutils -> sysconfig Tim Orling
@ 2021-11-26  4:36 ` Tim Orling
  25 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26  4:36 UTC (permalink / raw)
  To: openembedded-core

Change a comment to reference our custom changes to the
sysconfig module, as dnf no longer uses distutils.

[YOCTO #14610]

Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
---
 meta/classes/rootfs_rpm.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 3d8d784f792..bec4d63ed6c 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -4,7 +4,7 @@
 
 ROOTFS_PKGMANAGE = "rpm dnf"
 
-# dnf is using our custom distutils, and so will fail without these
+# dnf is using our custom sysconfig module, and so will fail without these
 export STAGING_INCDIR
 export STAGING_LIBDIR
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [OE-core] [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses
  2021-11-26  4:35 ` [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses Tim Orling
@ 2021-11-26  7:37   ` Konrad Weihmann
  2021-11-26 16:07     ` Tim Orling
  0 siblings, 1 reply; 29+ messages in thread
From: Konrad Weihmann @ 2021-11-26  7:37 UTC (permalink / raw)
  To: Tim Orling, openembedded-core



On 26.11.21 05:35, Tim Orling wrote:
> Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
> ---
>   meta/classes/setuptools3-base.bbclass | 31 +++++++++++++
>   meta/classes/setuptools3.bbclass      | 67 ++++++++++++++++++++++++++-
>   2 files changed, 97 insertions(+), 1 deletion(-)
>   create mode 100644 meta/classes/setuptools3-base.bbclass
> 
> diff --git a/meta/classes/setuptools3-base.bbclass b/meta/classes/setuptools3-base.bbclass
> new file mode 100644
> index 00000000000..5098ae9d64e
> --- /dev/null
> +++ b/meta/classes/setuptools3-base.bbclass
> @@ -0,0 +1,31 @@
> +DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}"
> +DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}"
> +RDEPENDS:${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
> +
> +export STAGING_INCDIR
> +export STAGING_LIBDIR
> +
> +# LDSHARED is the ld *command* used to create shared library
> +export LDSHARED  = "${CCLD} -shared"
> +# LDXXSHARED is the ld *command* used to create shared library of C++
> +# objects
> +export LDCXXSHARED  = "${CXX} -shared"
> +# CCSHARED are the C *flags* used to create objects to go into a shared
> +# library (module)
> +export CCSHARED  = "-fPIC -DPIC"
> +# LINKFORSHARED are the flags passed to the $(CC) command that links
> +# the python executable
> +export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
> +
> +FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
> +
> +FILES:${PN}-staticdev += "\
> +  ${PYTHON_SITEPACKAGES_DIR}/*.a \
> +"
> +FILES:${PN}-dev += "\
> +  ${datadir}/pkgconfig \
> +  ${libdir}/pkgconfig \
> +  ${PYTHON_SITEPACKAGES_DIR}/*.la \
> +"
> +inherit python3native python3targetconfig
> +
> diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass
> index 8ca66ee708e..4b8eca3f96e 100644
> --- a/meta/classes/setuptools3.bbclass
> +++ b/meta/classes/setuptools3.bbclass
> @@ -1,4 +1,69 @@
> -inherit distutils3
> +inherit setuptools3-base
>   
> +B = "${WORKDIR}/build"
> +distutils_do_configure[cleandirs] = "${B}"

I hope this will be removed in a later patch, as the function name 
doesn't match the rest of the class code function naming.
Or this here deserves a in code explantion

> +
> +SETUPTOOLS_BUILD_ARGS ?= ""
> +SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
> +    --prefix=${prefix} \
> +    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
> +    --install-data=${datadir}"
> +
> +SETUPTOOLS_PYTHON = "python3"
> +SETUPTOOLS_PYTHON:class-native = "nativepython3"
> +
> +SETUPTOOLS_SETUP_PATH ?= "${S}"
> +
> +setuptools3_do_configure() {
> +    :
> +}

Why do we need to export an empty function?
Wouldn't it make sense to use noexec here?

> +
> +setuptools3_do_compile() {
> +        cd ${SETUPTOOLS_SETUP_PATH}
> +        NO_FETCH_BUILD=1 \
> +        STAGING_INCDIR=${STAGING_INCDIR} \
> +        STAGING_LIBDIR=${STAGING_LIBDIR} \
> +        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
> +        build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \
> +        bbfatal_log "'${PYTHON_PN} setup.py build ${SETUPTOOLS_BUILD_ARGS}' execution failed."
> +}
> +setuptools3_do_compile[vardepsexclude] = "MACHINE"

Please append or += here otherwise manipulation done to this function 
vardepexclude done *before* the inherit in the recipe will be lost, 
without people noticing that easily

> +
> +setuptools3_do_install() {
> +        cd ${SETUPTOOLS_SETUP_PATH}
> +        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
> +        STAGING_INCDIR=${STAGING_INCDIR} \
> +        STAGING_LIBDIR=${STAGING_LIBDIR} \
> +        PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
> +        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
> +        build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \
> +        bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed."
> +
> +        # support filenames with *spaces*
> +        find ${D} -name "*.py" -exec grep -q ${D} {} \; \
> +                               -exec sed -i -e s:${D}::g {} \;
> +
> +        for i in ${D}${bindir}/* ${D}${sbindir}/*; do
> +            if [ -f "$i" ]; then
> +                sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${SETUPTOOLS_PYTHON}:g $i
> +                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
> +            fi
> +        done
> +
> +        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
> +
> +        #
> +        # FIXME: Bandaid against wrong datadir computation
> +        #
> +        if [ -e ${D}${datadir}/share ]; then
> +            mv -f ${D}${datadir}/share/* ${D}${datadir}/
> +            rmdir ${D}${datadir}/share
> +        fi
> +}
> +setuptools3_do_install[vardepsexclude] = "MACHINE"

Same here about the vardepexclude

> +
> +EXPORT_FUNCTIONS do_configure do_compile do_install
> +
> +export LDSHARED="${CCLD} -shared"
>   DEPENDS += "python3-setuptools-native"
>   
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#158798): https://lists.openembedded.org/g/openembedded-core/message/158798
> Mute This Topic: https://lists.openembedded.org/mt/87313857/3647476
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [OE-core] [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses
  2021-11-26  7:37   ` [OE-core] " Konrad Weihmann
@ 2021-11-26 16:07     ` Tim Orling
  0 siblings, 0 replies; 29+ messages in thread
From: Tim Orling @ 2021-11-26 16:07 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 6563 bytes --]

On Thu, Nov 25, 2021 at 11:37 PM Konrad Weihmann <kweihmann@outlook.com>
wrote:

>
>
> On 26.11.21 05:35, Tim Orling wrote:
> > Signed-off-by: Tim Orling <timothy.t.orling@intel.com>
> > ---
> >   meta/classes/setuptools3-base.bbclass | 31 +++++++++++++
> >   meta/classes/setuptools3.bbclass      | 67 ++++++++++++++++++++++++++-
> >   2 files changed, 97 insertions(+), 1 deletion(-)
> >   create mode 100644 meta/classes/setuptools3-base.bbclass
> >
> > diff --git a/meta/classes/setuptools3-base.bbclass
> b/meta/classes/setuptools3-base.bbclass
> > new file mode 100644
> > index 00000000000..5098ae9d64e
> > --- /dev/null
> > +++ b/meta/classes/setuptools3-base.bbclass
> > @@ -0,0 +1,31 @@
> > +DEPENDS:append:class-target = " ${PYTHON_PN}-native ${PYTHON_PN}"
> > +DEPENDS:append:class-nativesdk = " ${PYTHON_PN}-native ${PYTHON_PN}"
> > +RDEPENDS:${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' ==
> 'class-target']}"
> > +
> > +export STAGING_INCDIR
> > +export STAGING_LIBDIR
> > +
> > +# LDSHARED is the ld *command* used to create shared library
> > +export LDSHARED  = "${CCLD} -shared"
> > +# LDXXSHARED is the ld *command* used to create shared library of C++
> > +# objects
> > +export LDCXXSHARED  = "${CXX} -shared"
> > +# CCSHARED are the C *flags* used to create objects to go into a shared
> > +# library (module)
> > +export CCSHARED  = "-fPIC -DPIC"
> > +# LINKFORSHARED are the flags passed to the $(CC) command that links
> > +# the python executable
> > +export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
> > +
> > +FILES:${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
> > +
> > +FILES:${PN}-staticdev += "\
> > +  ${PYTHON_SITEPACKAGES_DIR}/*.a \
> > +"
> > +FILES:${PN}-dev += "\
> > +  ${datadir}/pkgconfig \
> > +  ${libdir}/pkgconfig \
> > +  ${PYTHON_SITEPACKAGES_DIR}/*.la \
> > +"
> > +inherit python3native python3targetconfig
> > +
> > diff --git a/meta/classes/setuptools3.bbclass
> b/meta/classes/setuptools3.bbclass
> > index 8ca66ee708e..4b8eca3f96e 100644
> > --- a/meta/classes/setuptools3.bbclass
> > +++ b/meta/classes/setuptools3.bbclass
> > @@ -1,4 +1,69 @@
> > -inherit distutils3
> > +inherit setuptools3-base
> >
> > +B = "${WORKDIR}/build"
> > +distutils_do_configure[cleandirs] = "${B}"
>
> I hope this will be removed in a later patch, as the function name
> doesn't match the rest of the class code function naming.
> Or this here deserves a in code explantion
>
> This was a copy-paste oversight and needs to be changed in a v2.
I believe I was trying to contemplate if it was still needed and forgot to
loop back.
 https://git.yoctoproject.org/poky/tree/meta/classes/distutils3.bbclass#n4

> +
> > +SETUPTOOLS_BUILD_ARGS ?= ""
> > +SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
> > +    --prefix=${prefix} \
> > +    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
> > +    --install-data=${datadir}"
> > +
> > +SETUPTOOLS_PYTHON = "python3"
> > +SETUPTOOLS_PYTHON:class-native = "nativepython3"
> > +
> > +SETUPTOOLS_SETUP_PATH ?= "${S}"
> > +
> > +setuptools3_do_configure() {
> > +    :
> > +}
>
> Why do we need to export an empty function?
> Wouldn't it make sense to use noexec here?
>
> This is what was in the original distutils3.bbclass
https://git.yoctoproject.org/poky/tree/meta/classes/distutils3.bbclass#n18
The colon (:) makes it a no-op (not empty). I believe this is our version
of defining an "interface" that can be implemented by subsequent recipes
inheriting the class.

> +
> > +setuptools3_do_compile() {
> > +        cd ${SETUPTOOLS_SETUP_PATH}
> > +        NO_FETCH_BUILD=1 \
> > +        STAGING_INCDIR=${STAGING_INCDIR} \
> > +        STAGING_LIBDIR=${STAGING_LIBDIR} \
> > +        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}
> setup.py \
> > +        build --build-base=${B} ${SETUPTOOLS_BUILD_ARGS} || \
> > +        bbfatal_log "'${PYTHON_PN} setup.py build
> ${SETUPTOOLS_BUILD_ARGS}' execution failed."
> > +}
> > +setuptools3_do_compile[vardepsexclude] = "MACHINE"
>
> Please append or += here otherwise manipulation done to this function
> vardepexclude done *before* the inherit in the recipe will be lost,
> without people noticing that easily
>
> This is directly from the original distutils3.bbclass
 https://git.yoctoproject.org/poky/tree/meta/classes/distutils3.bbclass#n30

> +
> > +setuptools3_do_install() {
> > +        cd ${SETUPTOOLS_SETUP_PATH}
> > +        install -d ${D}${PYTHON_SITEPACKAGES_DIR}
> > +        STAGING_INCDIR=${STAGING_INCDIR} \
> > +        STAGING_LIBDIR=${STAGING_LIBDIR} \
> > +        PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \
> > +        ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}
> setup.py \
> > +        build --build-base=${B} install --skip-build
> ${SETUPTOOLS_INSTALL_ARGS} || \
> > +        bbfatal_log "'${PYTHON_PN} setup.py install
> ${SETUPTOOLS_INSTALL_ARGS}' execution failed."
> > +
> > +        # support filenames with *spaces*
> > +        find ${D} -name "*.py" -exec grep -q ${D} {} \; \
> > +                               -exec sed -i -e s:${D}::g {} \;
> > +
> > +        for i in ${D}${bindir}/* ${D}${sbindir}/*; do
> > +            if [ -f "$i" ]; then
> > +                sed -i -e s:${PYTHON}:${USRBINPATH}/env\
> ${SETUPTOOLS_PYTHON}:g $i
> > +                sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
> > +            fi
> > +        done
> > +
> > +        rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
> > +
> > +        #
> > +        # FIXME: Bandaid against wrong datadir computation
> > +        #
> > +        if [ -e ${D}${datadir}/share ]; then
> > +            mv -f ${D}${datadir}/share/* ${D}${datadir}/
> > +            rmdir ${D}${datadir}/share
> > +        fi
> > +}
> > +setuptools3_do_install[vardepsexclude] = "MACHINE"
>
> Same here about the vardepexclude
>
> Again, this is directly from the distutil3.bbclass
 https://git.yoctoproject.org/poky/tree/meta/classes/distutils3.bbclass#n63

> +
> > +EXPORT_FUNCTIONS do_configure do_compile do_install
> > +
> > +export LDSHARED="${CCLD} -shared"
> >   DEPENDS += "python3-setuptools-native"
> >
> >
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#158798):
> https://lists.openembedded.org/g/openembedded-core/message/158798
> > Mute This Topic: https://lists.openembedded.org/mt/87313857/3647476
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> kweihmann@outlook.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>

[-- Attachment #2: Type: text/html, Size: 9798 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2021-11-26 16:08 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26  4:35 [RFC PATCH 00/26] deprecation of distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 01/26] classes/distutils-*: add warning of deprecation Tim Orling
2021-11-26  4:35 ` [RFC PATCH 02/26] setuptools: refactor for no distutils bbclasses Tim Orling
2021-11-26  7:37   ` [OE-core] " Konrad Weihmann
2021-11-26 16:07     ` Tim Orling
2021-11-26  4:35 ` [RFC PATCH 03/26] python3-cython: DISTUTILS_* -> SETUPTOOLS_* Tim Orling
2021-11-26  4:35 ` [RFC PATCH 04/26] dnf: inherit setuptools3-base instead of distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 05/26] libdnf: inherit setuptoools3-base not distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 06/26] python3-dbus: inherit setuptools3-base not distuils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 07/26] gpgme: inherit setuptools-base not distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 08/26] python3-pip: inherit setuptools3 not distutils3 Tim Orling
2021-11-26  4:35 ` [RFC PATCH 09/26] systemtap: use setuptools-base not distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 10/26] libcomps: inherit setuptools3-base " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 11/26] createrepo-c: " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 12/26] librepo: " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 13/26] btrfs-tools: use " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 14/26] scripts/buildhistory-diff: drop use of distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 15/26] python3-pygobject: setuptools instead " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 16/26] bind: inherit setuptools3-base " Tim Orling
2021-11-26  4:35 ` [RFC PATCH 17/26] python3-setuptools: do not depend on distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 18/26] sanity.bbclass: drop usage of distutils Tim Orling
2021-11-26  4:35 ` [RFC PATCH 19/26] gstreamer1.0-python: inherit setuptools3-base Tim Orling
2021-11-26  4:35 ` [RFC PATCH 20/26] recipetool/create_buildsys_python.py: less distutils Tim Orling
2021-11-26  4:36 ` [RFC PATCH 21/26] waf.bbclass: drop usage of distutils Tim Orling
2021-11-26  4:36 ` [RFC PATCH 22/26] dnf: drop python3-disutils dependency Tim Orling
2021-11-26  4:36 ` [RFC PATCH 23/26] python3: refactor python-config patch Tim Orling
2021-11-26  4:36 ` [RFC PATCH 24/26] lib/oe/terminal.py: use bb.version.LooseVersion Tim Orling
2021-11-26  4:36 ` [RFC PATCH 25/26] python3native.bbclass: distutils -> sysconfig Tim Orling
2021-11-26  4:36 ` [RFC PATCH 26/26] rootfs_rpm.bbclass: distutils -> sysconfig module Tim Orling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.