Opened 15 years ago

Closed 15 years ago

#19441 closed defect (fixed)

gtk-builder-convert incompatible with Python 3

Reported by: gale@… Owned by: nox@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc:
Port: gtk2

Description

The python script gtk-builder-convert uses the shell bang

#!/usr/bin/env python

to access the python interpreter. So it gets whatever version of python is currently selected as current in MacPorts. But this script is not compatible with version >= 3.0 of Python: the script contains a print statement, but print has changed to a function in version >= 3.0 of Python. There may be additional incompatibilities, I have not checked.

Note that this also implies that this port has a runtime dependency on Python which is missing from the portfile.

Attachments (1)

patch-gtk-builder-convert-2.diff (2.0 KB) - added by gale@… 15 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 in reply to:  description Changed 15 years ago by gale@…

See also #19442.

comment:2 Changed 15 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to nox@…

comment:3 Changed 15 years ago by nox@…

Status: newassigned

I'll fix this because of #19440, but you should not report every python3 incompatibility, report them upstream instead.

comment:4 Changed 15 years ago by nox@…

Resolution: fixed
Status: assignedclosed

comment:5 Changed 15 years ago by gale@…

Unfortunately, with this change the script will now work *only* for python versions >= 3.0. We could expand that to >= 2.6 by adding "from future import print_function" at the top. But it would still fail for < 2.6 which is still quite widespread.

I'm afraid that the only practical solution may be to choose a specific major python version, runtime-depend on it, and hard-wire it into the shell-bang.

Note that the crash of this script causes the gnome-keyring port to fail to build.

You're right that this really needs to be fixed upstream. And I reported it there as you requested (added to related issue http://bugzilla.gnome.org/show_bug.cgi?id=559947 ). But they may be very slow to fix it. On many platforms, there is a standard default python version, chosen conservatively. So it will be a long time before this bug begins showing up very often outside of MacPorts.

comment:6 Changed 15 years ago by gale@…

Sorry, never mind. It does work.

This delays the pain for a while. In Python 3.2 the string format operator "%" is scheduled to be removed. If that actually happens, it will require a whole slew of changes here. Other than that, we should be able to continue to support "any old" Python version for quite a while.

comment:7 Changed 15 years ago by gale@…

Oh, but you only fixed one of the print statements. There are several.

Attached is a replacement patch that fixes all of them.

Changed 15 years ago by gale@…

comment:8 Changed 15 years ago by nox@…

Resolution: fixed
Status: closedreopened

comment:9 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:10 Changed 15 years ago by nox@…

Resolution: fixed
Status: reopenedclosed

Patch updated in r50710.

Note: See TracTickets for help on using tickets.