|  04-13-2011, 03:20 PM | #1 | 
| Sigil Developer            Posts: 9,072 Karma: 6361556 Join Date: Nov 2009 Device: many | 
				
				How to get version of Calibre being run from within plugin?
			 
			
			Hi, Forgive me is I missed this in the plugin documentation, but how should a plugin determine which version of calibre it is running under when it is invoked. For example, since .htmlz support was just added, I would like a file type plugin to create an .htmlz file and not a zip file but only for calibre version 0.7.55 and later. For earlier, I would like to have it stay with the .zip format so that one version of the plugin works for all versions of Calibre out there. Is this currently possible and if so what is the best way to to get the current calibre version from within the plugin? Thanks, KevinH | 
|   |   | 
|  04-13-2011, 03:36 PM | #2 | 
| Calibre Plugins Developer            Posts: 4,735 Karma: 2197770 Join Date: Oct 2010 Location: Australia Device: Kindle Oasis | 
			
			from calibre.constants import numeric_version Search Calibre for numeric_version to find the usages. It is basically a tuple like (0, 7, 54) that you can just do operator comparisons with. Plugin updater makes use of it. | 
|   |   | 
| Advert | |
|  | 
|  04-13-2011, 04:34 PM | #3 | |
| Sigil Developer            Posts: 9,072 Karma: 6361556 Join Date: Nov 2009 Device: many | 
			
			Hi, Quote: 
 Thank you!. That was exactly what I needed. KevinH | |
|   |   | 
|  04-14-2011, 07:24 AM | #4 | 
| Sigil developer            Posts: 1,274 Karma: 1101600 Join Date: Jan 2011 Location: UK Device: Kindle PW, K4 NT, K3, Kobo Touch | 
			
			You might want to consider just restricting your plugin to the minimum version of Calibre that supports the feature.    Trying to support multiple versions of Calibre could become a headache and makes your testing that much harder. To make sure the plugin does not run unless Calibre's version is at a certain level, add this to your InterfacActionBase class: minimum_calibre_version = (0, 7, 55) | 
|   |   | 
|  04-14-2011, 07:42 AM | #5 | 
| Calibre Plugins Developer            Posts: 4,735 Karma: 2197770 Join Date: Oct 2010 Location: Australia Device: Kindle Oasis | 
			
			@meme - its a valid point - except he explicitly stated that he only wanted to have one version of the plugin which worked with all versions of Calibre   Being a file type plugin he isn't quite as restricted as working with the latest versions of Calibre as those of us working on the bleeding edge in the (mostly) gui plugin world   | 
|   |   | 
| Advert | |
|  | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Run plugin after "send to device" | minicheck | Development | 1 | 02-26-2011 09:42 PM | 
| DjVu Plugin for DR1000 - version 0.2 | luite | iRex | 30 | 10-18-2010 03:49 PM | 
| Run plugin before import | dremo | Plugins | 6 | 01-09-2009 12:40 PM | 
| should calibre_postinstall be run when just updating to new version? | ould | Calibre | 1 | 12-08-2008 01:33 PM | 
| [Apple]Java Embedding Plugin 0.9.2: Force java to run in browsers other than Safari | Zire | Lounge | 4 | 05-24-2005 09:12 PM |