View Single Post
Old 12-17-2019, 01:02 AM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Yay!

On the porting front, you'll need to decide how many old versions of calibre you're trying to support. The popular six.py library is pretty available in calibre, since it's a dependency of dateutil and thus calibre has always (indirectly) used it:

calibre 1.48.0 -- 2.15.0: six 1.4.1
calibre 2.16.0 -- 2.85.0: six 1.7.2
calibre 3.0.0 -- current: six 1.10.0

A Kovid said, the polyglot module, internal to calibre, provides some compat layers as well, starting with calibre 3.32 you have:

Code:
from polyglot.builtins import is_py3, reraise, zip, map, filter, iteritems, iterkeys, itervalues
from polyglot.urllib import urlopen, urlencode
And lots more with later versions (primarily 3.41 and on), we can help you figure out what versions have what (if you need it).

Some previous discussion has occurred on the topic:

Python 2 to Python 3, Polyglot & Plugins
Python 3, Polyglot & @six.wraps

Last edited by eschwartz; 12-17-2019 at 01:07 AM.
eschwartz is offline   Reply With Quote