View Single Post
Old 03-01-2010, 09:10 PM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,512
Karma: 28548962
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's possible to make a plugin that is cross platform in this case as well.

What you do is the following (this will only work in the next release of calibre)

Put all three versions of the dependency in the plugin zip file, alongwith any needed dlls. Put them in subdirectories called

windows, osx, linux

Then in the run method of your plugin do this:

Code:
from calibre.constants import iswindows, isosx
pdir = 'windows' if iswindows else 'osx' if isosx else 'linux'
ppath = os.path.join(self.sys_insertion_path, pdir)
sys.insert(0, ppath)
try:
   import your_dependency
   plugin code
finally:
   sys.path.remove(ppath)
kovidgoyal is offline   Reply With Quote