Modify

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#8276 closed enhancement (fixed)

PATCH: Python 2.4 compatibility.

Reported by: koeppj@… Owned by: Radek Bartoň
Priority: low Component: DiscussionPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

On build or install (python setup.py bdist_eng) I get the following error for a number of items. Start of log snippet

byte-compiling build/bdist.linux-x86_64/egg/tracdiscussion/api.py to api.pyc
  File "build/bdist.linux-x86_64/egg/tracdiscussion/api.py", line 1334
    'where' : 'WHERE ' + where if where else ''}
                                ^
SyntaxError: invalid syntax

Running this on RHEL 3.4 x64 with python 2.4 - revision 9598.

Attachments (4)

api.py (76.0 KB) - added by anonymous 13 years ago.
run_on_python_24.patch (6.1 KB) - added by koeppj@… 13 years ago.
Patch to allow plugin to run on Python version 2.4
trac-discussion-plugin.no-ifelse-api-01.patch (3.9 KB) - added by Guido U. Draheim 13 years ago.
trac-discussion-plugin.no-ifelse-timeline-01.patch (478 bytes) - added by Guido U. Draheim 13 years ago.

Download all attachments as: .zip

Change History (20)

Changed 13 years ago by anonymous

Attachment: api.py added

comment:1 Changed 13 years ago by koeppj@…

Realized this problem was due to use of python 2.5 inline conditionals. Suggest the docs get updated to indicate python 2.5 is a prereq or use the api.py I've addition.

comment:2 Changed 13 years ago by Radek Bartoň

Resolution: wontfix
Status: newclosed

Thank you for pointing this out. I'll mention it on the wiki page rather than fixing it. BTW: Attaching a patch would be more appreciated by potential users that has to use older Python versions.

comment:3 Changed 13 years ago by anonymous

Updated api.py is attached to this ticket. I'm not a python guru (I'm more a java guy) so I'm sure this is a more elegant way to fix but the api.py file attached to this ticket was compiled and runs on python 2.4. I'm note a registered user so can't create a proper patch.

comment:4 in reply to:  3 Changed 13 years ago by Ryan J Ollos

Replying to anonymous:

I'm note a registered user so can't create a proper patch.

Registration is not required to checkout a project branch. You can then use svn diff and output to a file.

comment:5 Changed 13 years ago by koeppj@…

Just realized that. Will upload one. Look for run_on_python_24.patch attached to this ticket.

Changed 13 years ago by koeppj@…

Attachment: run_on_python_24.patch added

Patch to allow plugin to run on Python version 2.4

comment:6 Changed 13 years ago by Radek Bartoň

Keywords: patch added
Priority: normallow
Resolution: wontfix
Status: closedreopened
Summary: Compile Error of api.py for 0.11PATCH: Python 2.4 compatibility.
Type: defectenhancement

Thank you.

comment:7 Changed 13 years ago by Guido U. Draheim

I am using the following patches for Python 2.4 compatibility:

trac-discussion-plugin/trac-discussion-plugin.no-ifelse-api-01.patch trac-discussion-plugin/trac-discussion-plugin.no-ifelse-timeline-01.patch

Prebuilt packages for CentOS-5 / RHEL5 can be downloaded from the Open Build Service at https://build.opensuse.org/package/show?package=trac-discussion-plugin&project=home%3Aguidod%3Atrac12

Changed 13 years ago by Guido U. Draheim

Changed 13 years ago by Guido U. Draheim

comment:8 in reply to:  7 Changed 12 years ago by dizzystreak

Replying to guidod:

I am using the following patches for Python 2.4 compatibility:

trac-discussion-plugin/trac-discussion-plugin.no-ifelse-api-01.patch trac-discussion-plugin/trac-discussion-plugin.no-ifelse-timeline-01.patch

Prebuilt packages for CentOS-5 / RHEL5 can be downloaded from the Open Build Service at https://build.opensuse.org/package/show?package=trac-discussion-plugin&project=home%3Aguidod%3Atrac12

Unfortunately, there is more python2.5 style code in the plugin. Here is an example error message with the line number:

TemplateSyntaxError: invalid syntax (/usr/lib/python2.4/site-packages/tracdiscussion/templates/discussion-macros.html, line 55)

comment:9 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)

comment:10 Changed 12 years ago by Ryan J Ollos

#9146 closed as a duplicate.

comment:11 Changed 12 years ago by Ryan J Ollos

#8803 closed as a duplicate.

comment:12 Changed 12 years ago by Ryan J Ollos

(In [12057]) Fixes #9963, Refs #9800, #8276, #8803, #9146: Added check in setup.py for minimum required Python version. Python 2.5 is currently required. Later, we'll aim to restore full Python 2.4 compatibility.

comment:13 in reply to:  12 Changed 10 years ago by Steffen Hoffmann

Replying to rjollos:

Later, we'll aim to restore full Python 2.4 compatibility.

Just what I noted to #6783 now. I've already cleaned an occurrence of 'if..else' in timeline event provider code (see [13882]). Will try to remember recording related changes here.

comment:14 Changed 10 years ago by Steffen Hoffmann

Trying to pull changes from advertised by guidod I see, that trac-discussion-plugin.no-ifelse-timeline-01.patch changes is essentially what I've already spotted and fixed in [13882] before.

However the more extensive trac-discussion-plugin.no-ifelse-api-01.patch changeset is still a very valuable contribution.

Version 0, edited 10 years ago by Steffen Hoffmann (next)

comment:15 Changed 10 years ago by Steffen Hoffmann

Resolution: fixed
Status: reopenedclosed

In 13886:

DiscussionPlugin: Bring full Trac 0.11 compatibility, closes #8276.

Most of these changes have been kindly contributed by Guido Draheim.
Thanks a lot for your time, encouraging me even more to find the remaining
places - Python code hidden in Genshi HTML template markup.

comment:16 Changed 10 years ago by Steffen Hoffmann

Since I failed to do a manual full install of Python2.4 (couldn't fix missing zlib) I could only do a load test for all modules. Please re-open this ticket in case we need more things to get fixed.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.