diff mbox series

[47/48] sanity.bbclass: do not check for presence of distutils

Message ID 20221107145508.1051404-47-alex@linutronix.de
State New
Headers show
Series [01/48] man-pages: upgrade 5.13 -> 6.01 | expand

Commit Message

Alexander Kanavin Nov. 7, 2022, 2:55 p.m. UTC
This will be removed in 3.12 and has been deprecated for a while.

sysconfig is the replacement for distutils.sysconfig

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/classes-global/sanity.bbclass | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Ross Burton Nov. 8, 2022, 6:15 p.m. UTC | #1
On 7 Nov 2022, at 14:55, Alexander Kanavin via lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org> wrote:
>     # 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.
> +    # minimal installations: glib-2.0-natives requries # xml.parsers.expat
>     try:
>         import xml.parsers.expat
> -        import distutils.sysconfig
> +        import sysconfig

Well, we check for distutils because it’s often packaged separately, for example in Debian/Ubuntu it is part of python3-distutils and is not installed if you just ‘apt install python3’.

sysconfig is not split out, it’s part of the core library.

If we don’t actually need a *host* distutils anymore (and this is easily tested) then we can remove this check entirely. If we do, then this test needs to remain and the code that uses *host* distutils should be fixed.

Ross
Alexander Kanavin Nov. 8, 2022, 6:35 p.m. UTC | #2
I'd say we should just drop the check then. If something breaks, then
that something needs to be fixed to not use distutils anyway, and not
doing the check will expose those items in need of fixing.

Alex

On Tue, 8 Nov 2022 at 19:18, Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 7 Nov 2022, at 14:55, Alexander Kanavin via lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org> wrote:
> >     # 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.
> > +    # minimal installations: glib-2.0-natives requries # xml.parsers.expat
> >     try:
> >         import xml.parsers.expat
> > -        import distutils.sysconfig
> > +        import sysconfig
>
> Well, we check for distutils because it’s often packaged separately, for example in Debian/Ubuntu it is part of python3-distutils and is not installed if you just ‘apt install python3’.
>
> sysconfig is not split out, it’s part of the core library.
>
> If we don’t actually need a *host* distutils anymore (and this is easily tested) then we can remove this check entirely. If we do, then this test needs to remain and the code that uses *host* distutils should be fixed.
>
> Ross
diff mbox series

Patch

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 606444cae1..26533a3521 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -625,11 +625,10 @@  def check_sanity_version_change(status, d):
     # never again until the sanity version or host distrubution id/version changes.
 
     # 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.
+    # minimal installations: glib-2.0-natives requries # xml.parsers.expat
     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)