11-17-2014, 05:27 AM | #1 |
Wizard
Posts: 1,177
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
A free Calibre Windows development environment using Visual Studio
In this post I give a brief overview of how to use Visual Studio to create a freeware Windows development and debugging environment for Calibre.
You will now have a project hierarchy that contains all the Calibre source code, making it easy to navigate the various folders and python files, edit the code etc. Visual Studio 2013 has GitHub integration for source control. Yay! It is explained in detail here http://msdn.microsoft.com/en-us/library/hh850445.aspx, especially the section "Put an existing solution under local Git version control". You cannot build the Calibre project you have just created, but that is not necessary because you can install the latest Calibre release, and run that from source, which will use the Python files in your Calibre project, as defined by the CALIBRE_DEVELOP_FROM environment variable. So to debug Calibre:
An optional extra: a simpler alternative way to attach the debugger to Calibre. Normally we use F5 in Visual Studio to debug. This builds the solution and launches it in the debugger. This is not possible with the Calibre project we created...unless:
Now when you hit F5, the CalibreDebug project builds and launches in the debugger. CalibreDebug is a small C# project that does two things:
In theory it should be possible to mix Python debugging with C/C++, so we could step from Python code into the C/C++ libraries that Calibre uses, but I have not got this working yet. I hope you find this post useful. Last edited by ShellShock; 01-01-2015 at 07:05 AM. |
11-17-2014, 07:45 AM | #2 |
creator of calibre
Posts: 44,726
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That should come in handy for people that like to use Visual Studio, I have added a link to this thread in the User Manual's development section.
|
Advert | |
|
11-18-2014, 06:18 AM | #3 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Very, very nice. I have so missed being able to step through the code.
|
11-23-2014, 06:01 AM | #4 |
Wizard
Posts: 1,177
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
It is also possible to debug plugins using the Visual Studio environment I described in the first post.
This will create a new solution with the new Python project in it. This seems to be a bug in the wizard - I was expecting it to add the new project to the existing Calibre solution. Not to worry.
Last edited by ShellShock; 01-01-2015 at 07:07 AM. |
05-16-2016, 05:12 PM | #5 | ||||||
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2011
Device: Android
|
Not sure why I'm having such trouble, I did find this article helpful with the following additional hacks..
I modified my Microsoft Visual Studio install to include: Quote:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat I then edited the: C:\Python27\Lib\distutils\msvc9compiler.py to fix a 'can't find the vcvarsall.bat' error. Quote:
Quote:
Quote:
Quote:
I then added a PYTHONPATH environmental variable with: Quote:
Rob References: http://blog.abstractfactory.io/pyqt5...or-python-2-7/ https://bugreports.qt.io/browse/QTBUG-50191 http://stackoverflow.com/questions/3...tudio-2015-v-1 https://www.riverbankcomputing.com/p...ch/037061.html |
||||||
Advert | |
|
11-06-2020, 09:14 AM | #6 | |
Enthusiast
Posts: 47
Karma: 10
Join Date: Oct 2020
Device: Kobo Aura
|
Unfortunately I haven’t gotten this to work with “Attach using Process ID” in VSCodium on macOS Catalina (10.15.7). This is the error I keep getting from VS:
Quote:
|
|
12-12-2020, 10:56 PM | #7 |
Junior Member
Posts: 3
Karma: 10
Join Date: Dec 2020
Device: none
|
Hello, I wonder if debugging this way would be possible to see the way the different supported devices (ereaders) store their ebook files. For example, my kindle stores their mobi files inside "documents" main folder. I guess not, but in case, many thanks.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Setting up a calibre development environment" documentation suggestion | trying | Development | 1 | 03-30-2014 11:25 PM |
calibre VMWare development environment | kovidgoyal | Calibre | 30 | 12-30-2009 01:43 PM |
eBook Library Blocked by Visual Studio | MickeyC | Sony Reader | 14 | 10-23-2009 09:15 AM |
Setting up Mac Calibre development environment? | pdurrant | Calibre | 2 | 01-06-2009 08:10 AM |
setup development environment | JeffElkins | Calibre | 21 | 10-22-2008 04:25 PM |