Opened 8 years ago

Closed 8 years ago

# [patch] Syntax error found when building egg

Reported by: Owned by: stevek Steffen Hoffmann high AccountManagerPlugin major compatibility python2.4 Ryan J Ollos 0.12

### Description

When building the egg on our RHEL 5 server (w/ python version 2.4.3) via "python setup.py bdist_egg", I see the following in the byte-compiling section of the log:

byte-compiling build/bdist.linux-x86_64/egg/acct_mgr/htfile.py to htfile.pyc
File "build/bdist.linux-x86_64/egg/acct_mgr/htfile.py", line 158
finally:
^
SyntaxError: invalid syntax


Even with this error, the egg is created.

### comment:1 in reply to:  description ; follow-up:  2 Changed 8 years ago by Steffen Hoffmann

When building the egg on our RHEL 5 server (w/ python version 2.4.3) ![...]

byte-compiling build/bdist.linux-x86_64/egg/acct_mgr/htfile.py to htfile.pyc
File "build/bdist.linux-x86_64/egg/acct_mgr/htfile.py", line 158
finally:
!^
SyntaxError: invalid syntax


Of course, try..finally syntax has been introduced to Python2.5, so this is actually about maintaining compatibility to Python2.4.

Even with this error, the egg is created.

But still this will cause a regression, since PasswordAuthStores can't work for you anymore with current trunk code added in changeset [9272].

In [9289] I've already removed compatibility code dedicated to Python2.3 . I'll have a look at the code at least before doing the next release to 0.11 branch, since even Trac 0.12 was maintained compatibility to Python2.4 .

But I hesitate to let trunk fall back into more complicated code just for this issue, as fixing PasswordAuthStores related code required a good amount of time and is already aiming at current Trac (0.13dev), where Python2.4 has been dropped recently for good measure. It's a nightmare to maintain such old program environments that effectively block reasonable progress (with statements being of major concern here).

Don't meant to offend you, but when will you have the chance to get the system in question pushed to a more recent state? In fact even very conservative Debian GNU/Linux current stable has Python2.5.2 . I thought, this would already be the absolute minimum, so I stand corrected here.

### comment:2 in reply to:  1 Changed 8 years ago by Ryan J Ollos

Don't meant to offend you, but when will you have the chance to get the system in question pushed to a more recent state? In fact even very conservative Debian GNU/Linux current stable has Python2.5.2 . I thought, this would already be the absolute minimum, so I stand corrected here.

This is a frustration I've experienced with Red Hat Enterprise Linux as well. The latest version is Red Hat EL 5.5, and it is still running Python 2.4. You can point to another package repository such as DAG and get later versions of Python, but I imagine that this is allowed or desired by some administrators.

### comment:3 Changed 8 years ago by Steffen Hoffmann

Severity: normal → major new → assigned

Ok, exactly what I just found on my own as well. RHEL5 is old , but RHEL5.5 has been released only months ago. So we should still support it, nice to developers or not, who cares? After all, there's reasonable admin/user interest here.

Will try to do the change tomorrow and

1) attach a patch here, 2) wait for confirmation before 3) committing to trunk

### Changed 8 years ago by Steffen Hoffmann

draft for needed patch

### comment:4 Changed 8 years ago by Steffen Hoffmann

Summary: Syntax error found when building egg → [patch] Syntax error found when building egg

I couldn't sleep without at least trying a fix. Please review/test it. :-)

### comment:5 follow-up:  6 Changed 8 years ago by stevek

The code compiles successfully. Thanks!!

### comment:6 in reply to:  5 ; follow-up:  8 Changed 8 years ago by Steffen Hoffmann

The code compiles successfully. Thanks!!

You're welcome. Did you run the test suite as well as suggested before?

I'm not totally happy with this, but I see no other way as to loose part of code robustness to win Python2.4 compatibility. I don't say 'win back' for good reason here, as the offending try..finally statements are in place for more than four(!) years now (i.e. see yourself in

Anyway this may still prove to be a good move, since this is just again one potential issue less that users could stumble upon. Thank you for report and testing the fix.

### comment:7 Changed 8 years ago by Steffen Hoffmann

Resolution: → fixed assigned → closed

(In [9338]) AccountManagerPlugin: Defer introduction of new 'try..finally' statement, closes #7863.

I do want to finally support Python2.4 due to RHEL5.x still using it, as I see the trade-off of theoretically higher code robustness for definitely broader plugin availability as acceptable.

### comment:8 in reply to:  6 Changed 8 years ago by stevek

You're welcome. Did you run the test suite as well as suggested before?

Could you show me where to find the test suite?

### comment:9 Changed 8 years ago by Steffen Hoffmann

Easy:

$> cd accountmanagerplugin/trunk$> python ./setup.py test
(much output while running the unittests)

OK
\$>


### comment:10 Changed 8 years ago by stevek

Test suite passed all 26 tests!!

### comment:11 Changed 8 years ago by Steffen Hoffmann

Very good. Seems all well done now.

### Modify Ticket

Change Properties