dev-python/PyQt4-4.5 is shipped with some Python files that strictly require Python 2.6 due to inaccurate (by upstream) syntax choices. The syntax "except Exception as e" is not supported in Python 2.5. This causes pkg_postinst (while byte-compiling .py files) to print errors. I suppose there is no need for more explanation since Python/Qt herds know what I am "talking" about. The fix is quite trivial and attached. Reproducible: Always Steps to Reproduce:
Created attachment 194761 [details, diff] >= Python 2.5 support patch
I am a bit unsure about Python 2.5 metaclass support, so I ask somebody to review that part of the patch.
*** Bug 274499 has been marked as a duplicate of this bug. ***
This is invalid IMHO. You are trying to patch files in port_v3 which is only imported if python version is >= 3.0, and that syntax is perfectly valid in python 3.0 and above. Actually there is an issue with those files and python_mod_optimize, but it'll be taken care of in bug #274499.
Both syntaxes are valid in Python 3.0 AFAIK. So, my patch does not cause any regression.
(In reply to comment #5) > Both syntaxes are valid in Python 3.0 AFAIK. So, my patch does not cause any > regression. > This is not the point. AFAICS you are changing correct upstream code for no valid reason.
We can discuss about better ways to fix the issue, but "no valid reasons" doesn't mean anything. Reason is: fix errors, if there's a better, clean way to do that, then great, stop writing and post a patch.
"fix the issue"? What issue are you talking about? The code in port_v3 is fine. The compilation errors arise from calling python_mod_optimize, as I already said. Changing that code is not the way to go IMHO. I've already proposed a workaround in bug #274499, but the proper fix would be installing port_v3 OR port_v2, based on the python version we are building against. There's no point in having both port_v2 and port_v3 installed.
'except exception, variable' is invalid in Python 3.