[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need help updating imgsizer for python2.1



On Tue, Jan 08, 2002 at 03:12:43PM +1100, Kim Oldfield wrote:
| On  8 Jan 2002, Peter S Galbraith typed:
| ] I'm the maintainer for imgsizer, 
| ] 
| ]  http://packages.debian.org/unstable/web/imgsizer.html
| ] 
| ]                                  which used to be a perl script and is
| ] now a python script.  I don't know python.  The scripts loads "cmp.py"
| 
| The cmp module has been replace by filecmp. One (untested) way of fixing
| it would be to change the line:
| 
|     import sys, os, getopt, cmp, string, re, urllib, commands
| 
| to
| 
|     import sys, os, getopt, string, re, urllib, commands
|     if sys.version > '1.6':
| 	import filecmp as cmp
|     else:
| 	import cmp

I'd prefer to write this as

try :
    import filecmp as cmp
except ImportError :
    import cmp

It is more pythonic to just try to do what it is you want, and handle
the situation when it fails, than it is do try and figure out what is
write and do only that which works.

| ] The package currently depends on python1.5.  What should it depend on
| ] when fixed?
| 
| python

This must be versioned though.  
    python >= (2.1) , python << (2.2)
will get you the current default version.

-D

-- 

All a man's ways seem innocent to him,
but motives are weighed by the Lord.
        Proverbs 16:2



Reply to: