Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10514 closed Bug Report - General (Won't Fix) has an invalid syntax error

Reported by: christopher.j.reeves@… Owned by:
Priority: minor Milestone: unknown
Component: Packaging Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: yes

Description does not define which version of python to use. (i.e. 2 or 3). As a result a syntax error occurs due to differences in print statements between v2 and v3 of python.

GorillaOnCrack? has submitted an update to the script to github in the mythtv/packaging project.

Change History (4)

comment:1 Changed 9 years ago by christopher.j.reeves@…

comment:2 Changed 9 years ago by Raymond Wagner

Resolution: Won't Fix
Status: newclosed

I'm closing this one due to it not making any sense. The switch to use print as a function rather than a directive is fine, but you left out the all important from __future__ import print_function which allows it to continue to work on Python 2.6+. You didn't take care of the issue of the old __cmp__ method being no longer being used in Python 3.x, meaning this script will delete log files in some arbitrary and completely incorrect order. The script still used OptionParser, which is deprecated and should not be used for Python 3.x. One commit appeared to do nothing but move parts of the code from 4-space to 2-space soft tabbing.

I've made the necessary changes to the script to allow it to be run directly under Python 2.6+ or Python 3.x, and will be committing such in the next day or so.

comment:3 Changed 9 years ago by christopher.j.reeves@…

Refer to line 95 of the patch.

ls = sorted(LogFile?.filter(opts.logpath, os.listdir(opts.logpath)), key=lambda self:self.filename)

comment:4 Changed 9 years ago by Raymond Wagner

Ticket locked: set

That line was lost among the 200 lines of unnecessary indentation changes made during the same commit, and improper ordering anyway. The whole purpose of breaking apart the various groups is so that the numeric elements can be sorted and grouped properly.

Note: See TracTickets for help on using tickets.