Register Guidelines E-Books Search Today's Posts Mark Forums Read

 MobileRead Forums Info to start working with Calibre source

 05-31-2011, 11:33 AM #1 samphan Junior Member   Posts: 1 Karma: 10 Join Date: May 2011 Device: Galaxy Tab 10.1 Info to start working with Calibre source Hello, I'm new to Calibre. Where can I find any info to start working with the Calibre source? Such as directory structure and API documentation? Thanks, Samphan.
 05-31-2011, 11:54 AM #2 user_none Sigil & calibre developer     Posts: 2,488 Karma: 1054509 Join Date: Jan 2009 Location: Florida, USA Device: Nook STR Info for setting up a development environment manual.calibre-ebook.com/develop.html User manual manual.calibre-ebook.com/ which does contain API documentation. Most of the documentation is in the code itself. If you have questions ask.
 06-29-2011, 01:13 PM #3 Halo Connoisseur     Posts: 96 Karma: 72130 Join Date: Nov 2008 Location: San Francisco Bay Area, CA, USA Device: Sony PRS-505, Kindle DX 1st Gen, Kindle Fire 1st Gen Hello. I read "Setting up a calibre development environment" in the user's manual but I am still confused about how to set up a Windows 7 development environment. I would like to have two versions of calibre on my system:One for day-to-day use with my regular libraries. This would be a weekly release or older version. Another for development use with a test library that I would keep up to date with the bzr repository. The installer will not allow me to have two copies of calibre installed. When I run it again I'm asked asked to change, repair, or remove. To work around that I installed Cygwin so I have a unix-like environment on Windows. I then performed a bzr checkout of the source as described in the calibre manual. I went with Cygwin since I'm comfortable with the unix CLI and I expect to use the Launchpad SSH integration at some point. Is this a recommended setup or is there a better way? Can I have separate development and production installations on the same computer? I'm not sure what to do next. I assume I set CALIBRE_DEVELOP_FROM to point to the bzr checkout. Is that correct? Will that affect my use of calibre installed from the installer? Last edited by Halo; 06-29-2011 at 01:16 PM.
 06-29-2011, 01:48 PM #4 kovidgoyal creator of calibre     Posts: 28,665 Karma: 7295841 Join Date: Oct 2006 Location: Mumbai, India Device: Various If you want a separate "dev" calibre and normal calibre, write a .bat file that launches the dev calibre like this set CALIBRE_DEVELOP_FROM=whatever calibre --with-library c:\path\to\test\library Another bat file for normal calibre calibre --with-library c:\path\to\normal\library
06-29-2011, 02:48 PM   #5
chaley
"chaley", not "charley"

Posts: 7,525
Karma: 1971458
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
 Originally Posted by kovidgoyal If you want a separate "dev" calibre and normal calibre, write a .bat file that launches the dev calibre like this
I have 4 scripts that choose different source hierarchies: one for calibre baseline and 3 for different kinds of development (normal, speculative, and store plugins). I also have 5 scripts that choose different libraries: production, small test (30 books with 25 bizarre custom columns), medium test (2000 books with 5 custom columns), large test (5,000 books with 3 custom columns), and huge test (20,000 books with 1 custom column). So, to run calibre, I first choose the source by running one script, then I choose the library and run calibre by running another script. The calibre portable .bat file in resources contains all the information necessary to set up these scripts.

Regarding the installer, I almost never run calibre other than from source so I don't care what calibre binary is installed. I run the installer from time to time because calibre source can depend on DLLs and other binary files in the binary version. My experience is that updating calibre binary once every month or so is sufficient, but there have been times where I must do it more often. There is no problem with updating the binary more often, but I am lazy.

If I really need to run a calibre binary, I do it in a virtual machine so I have full control over what it sees.

06-29-2011, 04:36 PM   #6
Halo
Connoisseur

Posts: 96
Karma: 72130
Join Date: Nov 2008
Location: San Francisco Bay Area, CA, USA
Device: Sony PRS-505, Kindle DX 1st Gen, Kindle Fire 1st Gen
Quote:
 Originally Posted by kovidgoyal If you want a separate "dev" calibre and normal calibre, write a .bat file that launches the dev calibre like this set CALIBRE_DEVELOP_FROM=whatever calibre --with-library c:\path\to\test\library Another bat file for normal calibre calibre --with-library c:\path\to\normal\library
I tried this but it doesn't appear to be executing the right code. I edited src\calibre\__init__.py and added print "Hello, world!" near the top. I ran the following from the command line:

Code:
C:\Users\owner>set CALIBRE_DEVELOP_FROM=c:\cygwin\home\owner\calibre
C:\Users\owner>echo %CALIBRE_DEVELOP_FROM%
c:\cygwin\home\owner\calibre

C:\Users\owner>calibre --with-library "C:\Users\owner\Calibre Test"

C:\Users\owner>
I didn't see the statement print. I think it's still using the calibre executable that I installed:
Quote:
 C:\Users\owner>where calibre C:\Program Files (x86)\Calibre2\calibre.exe
Just to set expectations, I don't know anything about Python so I'd appreciate if it you are very explicit about what I need to type. I think the section in the user's guide about setting up a development environment assumes a lot of things that I don't know.

 06-29-2011, 04:41 PM #7 kovidgoyal creator of calibre     Posts: 28,665 Karma: 7295841 Join Date: Oct 2006 Location: Mumbai, India Device: Various set CALIBRE_DEVELOP_FROM=c:\cygwin\home\owner\calibre\ src And note that you will only see print statements if you run calibre in debug mode calibre-debug -g
06-29-2011, 04:46 PM   #8
Halo
Connoisseur

Posts: 96
Karma: 72130
Join Date: Nov 2008
Location: San Francisco Bay Area, CA, USA
Device: Sony PRS-505, Kindle DX 1st Gen, Kindle Fire 1st Gen
Quote:
 Originally Posted by chaley The calibre portable .bat file in resources contains all the information necessary to set up these scripts.
Thanks for directing me to that script. I will take a look at it and see if I can get it to work for me.

06-29-2011, 04:51 PM   #9
Halo
Connoisseur

Posts: 96
Karma: 72130
Join Date: Nov 2008
Location: San Francisco Bay Area, CA, USA
Device: Sony PRS-505, Kindle DX 1st Gen, Kindle Fire 1st Gen
Quote:
 Originally Posted by kovidgoyal set CALIBRE_DEVELOP_FROM=c:\cygwin\home\owner\calibre\ src
Thanks, Kovid! That fixed it. It looks like I am good to go.

 07-18-2011, 04:18 PM #10 ivanjt Guru   Posts: 856 Karma: 1027478 Join Date: Aug 2010 Location: South of France Device: kindle dx; eDGe This may be a stupid question but is it possible to get Calibre source code in something like a zip or tgz file. The reason I'm asking is because I use OS/2 and we don't have a port of Bazaar and I don't want to port that first. I want to try and port Calibre to OS/2 as we have python and QT4 ported so I think it should be possible (quite a lot of the newer software we use is ported from Linux).
 07-18-2011, 04:22 PM #11 chaley "chaley", not "charley"   Posts: 7,525 Karma: 1971458 Join Date: Jan 2010 Location: France Device: Many android devices Go to http://sourceforge.net/projects/calibre/files/ and download the tar.gz for the release of your choice.
07-18-2011, 05:00 PM   #12
ivanjt
Guru

Posts: 856
Karma: 1027478
Join Date: Aug 2010
Location: South of France
Device: kindle dx; eDGe
Quote:
 Originally Posted by chaley Go to http://sourceforge.net/projects/calibre/files/ and download the tar.gz for the release of your choice.
Thanks, got it. Maybe I shouldn't have read the manual first

 10-14-2011, 11:36 PM #13 katsu Member   Posts: 15 Karma: 10 Join Date: Oct 2011 Device: iPad,Kindle3 ..... Last edited by katsu; 10-14-2011 at 11:43 PM.
 10-14-2011, 11:42 PM #14 katsu Member   Posts: 15 Karma: 10 Join Date: Oct 2011 Device: iPad,Kindle3 I read manual "Setting up a calibre development environment". does not print "Hello, world!" where should I check? $python --version Python 2.6.5$ cat /etc/redhat-release CentOS Linux release 6.0 (Final) I extract source to /home/katsu/calibre/calibre $ls ~/calibre/calibre/ COPYRIGHT INSTALL README imgsrc session.vim src Changelog.old.yaml LICENSE format_docs recipes setup Changelog.yaml LICENSE.rtf icons resources setup.py do Binary install with: sudo python -c "import urllib2; exec urllib2.urlopen('http://status.calibre-ebook.com/linux_installer').read(); main()"$ which calibre /usr/bin/calibre $echo$PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin set CALIBRE_DEVELOP_FROM=/home/katsu/calibre/calibre/src edit src/calibre/__init__.py (add 'print ("Hello, world 3")' at line 1) run calibredb (it show Usage but no show "Hello, world!") run calibre --verbose (it start normally but no show "Hello, world!") and run calibre-debug -g $calibre-debug -g Starting up... Started up in 1.0858399868$ (it start normally but no show "Hello, world!", close it, return to shell normally) I've probably missed something..
 10-14-2011, 11:46 PM #15 kovidgoyal creator of calibre     Posts: 28,665 Karma: 7295841 Join Date: Oct 2006 Location: Mumbai, India Device: Various Make sure you are running the official calibre binary not your distro's calibre package.