Opened 5 months ago

Closed 4 months ago

Last modified 4 months ago

#69036 closed defect (fixed)

glib2 @2.78.3_1: gdbus-codegen fails with python3.12 due to distutils use

Reported by: tenzap Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), jmroot (Joshua Root)
Port: glib2

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I was trying to build gtk3 and was facing this build error.

ModuleNotFoundError: No module named 'distutils'

I had to install py-setuptools to make it build

See also https://stackoverflow.com/questions/77233855/why-did-i-got-an-error-modulenotfounderror-no-module-named-distutils

Attachments (1)

main.log.gz (21.7 KB) - added by tenzap 5 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 months ago by jmroot (Joshua Root)

Owner: set to mascguy
Status: newassigned

Distutils was of course removed from the Python stdlib in 3.12. But gtk3 doesn't directly depend on Python, so a log would be useful to see what is actually using this.

Changed 5 months ago by tenzap

Attachment: main.log.gz added

comment:2 Changed 5 months ago by tenzap

see log attached

comment:3 Changed 5 months ago by jmroot (Joshua Root)

Cc: ryandesign added
Port: glib2 added; gtk3 removed
Summary: gtk3 @3.24.38_0+x11: with python3.12 it now requires setuptools module to buildglib2 @2.78.3_1: gdbus-codegen fails with python3.12 due to distutils use

OK, so it's gdbus-codegen which is part of glib2.

comment:4 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

So what is the solution? Add py312-setuputils as a runtime dependency to glib2 and glib2-devel?

comment:5 Changed 5 months ago by jmroot (Joshua Root)

comment:6 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

So for glib2 we could do any of these:

  1. add a patch for that change and add py312-packaging dependency
  2. add py312-setuputils dependency
  3. revert to python311

That commit was included 2.79.0 so for glib2-devel we have a fourth option:

  1. update to 2.79.0 and add py312-packaging dependency

Chris, what do you want to do?

comment:7 in reply to:  6 ; Changed 4 months ago by mascguy (Christopher Nielsen)

Replying to ryandesign:

So for glib2 we could do any of these:

  1. add a patch for that change and add py312-packaging dependency
  2. add py312-setuputils dependency
  3. revert to python311

That commit was included 2.79.0 so for glib2-devel we have a fourth option:

  1. update to 2.79.0 and add py312-packaging dependency

Chris, what do you want to do?

Still buried with work for my day job, so may not be able to look at this right away. But option 1 would be my preference.

More generally, we need to be cautious about switching to Python 3.12, particularly for foundational ports like this. (Just a general suggestion, to avoid having to scramble to fix issues.)

comment:8 in reply to:  7 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Replying to mascguy:

Replying to ryandesign:

  1. add a patch for that change and add py312-packaging dependency

But option 1 would be my preference.

Ok. I may look into this in the next days if nobody else beats me to it.

More generally, we need to be cautious about switching to Python 3.12, particularly for foundational ports like this. (Just a general suggestion, to avoid having to scramble to fix issues.)

Evidently! This distutils thing seems like one big easy-to-overlook problem (it occurs with gobject-introspection too in #69105), and syntax warnings due to lack of use of raw strings is another big one I've seen several times already in other ports. I was trying to be helpful but I should have remembered that I don't understand Python so I've discontinued my effort to switch ports to Python 3.12 and will leave it for those more knowledgeable.

comment:9 Changed 4 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In 8142ad6b5bc52b1f55903c48fc947f901244d55c/macports-ports (master):

glib2: fix gdbus-codegen

Use the packaging module instead of the removed distutils.

Closes: #69036

comment:10 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: jmroot added

Thank you!

The same change (or an update to version 2.79.0 or later) is still needed in glib2-devel.

Note: See TracTickets for help on using tickets.