Modify

Opened 4 years ago

Closed 7 months ago

Last modified 7 months ago

#8276 closed enhancement (fixed)

PATCH: Python 2.4 compatibility.

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

Description (last modified by rjollos)

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 4 years ago.
run_on_python_24.patch (6.1 KB) - added by koeppj@… 4 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 guidod 3 years ago.
trac-discussion-plugin.no-ifelse-timeline-01.patch (478 bytes) - added by guidod 3 years ago.

Download all attachments as: .zip

Change History (20)

Changed 4 years ago by anonymous

comment:1 Changed 4 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 4 years ago by Blackhex

  • Resolution set to wontfix
  • Status changed from new to closed

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 follow-up: Changed 4 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 4 years ago by rjollos

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 4 years ago by koeppj@…

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

Changed 4 years ago by koeppj@…

Patch to allow plugin to run on Python version 2.4

comment:6 Changed 4 years ago by Blackhex

  • Keywords patch added
  • Priority changed from normal to low
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Summary changed from Compile Error of api.py for 0.11 to PATCH: Python 2.4 compatibility.
  • Type changed from defect to enhancement

Thank you.

comment:7 follow-up: Changed 3 years ago by 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

comment:8 in reply to: ↑ 7 Changed 3 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 3 years ago by rjollos

  • Description modified (diff)

comment:10 Changed 2 years ago by rjollos

#9146 closed as a duplicate.

comment:11 Changed 2 years ago by rjollos

#8803 closed as a duplicate.

comment:12 follow-up: Changed 2 years ago by rjollos

(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 7 months ago by hasienda

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 7 months ago by hasienda

Trying to pull changes from the resource 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.

Last edited 7 months ago by hasienda (previous) (diff)

comment:15 Changed 7 months ago by hasienda

  • Resolution set to fixed
  • Status changed from reopened to closed

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 7 months ago by hasienda

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.

Add Comment

Modify Ticket

Action
as closed The owner will remain Blackhex.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.