Ticket #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
Change History
comment:1 in reply to: ↑ description Changed 4 years ago by gale@…
comment:3 Changed 4 years ago by nox@…
- Status changed from new to assigned
I'll fix this because of #19440, but you should not report every python3 incompatibility, report them upstream instead.
comment:4 Changed 4 years ago by nox@…
- Status changed from assigned to closed
- Resolution set to fixed
comment:5 Changed 4 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 4 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 4 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.
comment:8 Changed 4 years ago by nox@…
- Status changed from closed to reopened
- Resolution fixed deleted
comment:10 Changed 4 years ago by nox@…
- Status changed from reopened to closed
- Resolution set to fixed
Patch updated in r50710.


See also #19442.