How to compile, install and debug Callibre in your favorite IDE¶
Calibre is a very nice ebook organizer, however developement documentation is, quite laconic.
Installing it for the first time turned out to be a major pain in the ass, when I installed it for the first time, as I had to do some experimentation.
I have installed callibre to a virtual enviorment, which also is a pain, nevertheless here is what to do.
Download callibre source
git clone https://github.com/kovidgoyal/calibre
Install all system dependencies (there quite many of them). For systems not based on debian install them by hand.
sudo aptitude build-dep calibre
Create virtual enviorment. You’ll have to pass
--system-site-packagesswitch that allows virtualenv to use system python packages.
cd calibre virtualenv -p python2 --system-site-packages venv source venv/bin/activate
Try to launch
python setup.py Traceback (most recent call last): (...) File "/tmp/calibre2/setup/build_environment.py", line 103, in get_sip_dir (...) EnvironmentError: Failed to find the location of the PyQt5 .sip files
Callibre can’t find system SIP files for PyQt5, you’ll beed to edit
setup/build_environment.pyfind a line that contains:
pyqt['pyqt_sip_dir'] = get_sip_dir(sys.prefix if iswindows else os.path.join(sys.prefix, 'share', 'sip'))
and replace it with:
pyqt['pyqt_sip_dir'] = get_sip_dir(sys.prefix if iswindows else os.path.join('/usr/', 'share', 'sip'))
/usr, if you installed PyQt and other dependencies for calibre setup.py should work now
python setup.py bootstrap. This command does some stuff I don’t really understand, but it is neccessary to build calibre.
Install Calibre in developement mode:
python setup.py develop.
Now to debug Calibre you’ll just need to launch
venv/bin/calibrein debug mode in your favorite IDE.