Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 05-31-2011, 11:33 AM   #1
samphan
Junior Member
samphan began at the beginning.
 
Posts: 1
Karma: 10
Join Date: May 2011
Device: Galaxy Tab 10.1
Question 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.
samphan is offline   Reply With Quote
Old 05-31-2011, 11:54 AM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
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.
user_none is offline   Reply With Quote
Advert
Old 06-29-2011, 01:13 PM   #3
Halo
Connoisseur
Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.
 
Halo's Avatar
 
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:
  1. One for day-to-day use with my regular libraries. This would be a weekly release or older version.
  2. 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.
Halo is offline   Reply With Quote
Old 06-29-2011, 01:48 PM   #4
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: 43,858
Karma: 22666666
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
kovidgoyal is offline   Reply With Quote
Old 06-29-2011, 02:48 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
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.
chaley is offline   Reply With Quote
Advert
Old 06-29-2011, 04:36 PM   #6
Halo
Connoisseur
Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.
 
Halo's Avatar
 
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 View Post
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.
Halo is offline   Reply With Quote
Old 06-29-2011, 04:41 PM   #7
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: 43,858
Karma: 22666666
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
kovidgoyal is offline   Reply With Quote
Old 06-29-2011, 04:46 PM   #8
Halo
Connoisseur
Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.
 
Halo's Avatar
 
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 View Post
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.
Halo is offline   Reply With Quote
Old 06-29-2011, 04:51 PM   #9
Halo
Connoisseur
Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.
 
Halo's Avatar
 
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 View Post
set CALIBRE_DEVELOP_FROM=c:\cygwin\home\owner\calibre\ src
Thanks, Kovid! That fixed it. It looks like I am good to go.
Halo is offline   Reply With Quote
Old 07-18-2011, 04:18 PM   #10
ivanjt
Guru
ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.
 
Posts: 858
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).
ivanjt is offline   Reply With Quote
Old 07-18-2011, 04:22 PM   #11
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Go to http://sourceforge.net/projects/calibre/files/ and download the tar.gz for the release of your choice.
chaley is offline   Reply With Quote
Old 07-18-2011, 05:00 PM   #12
ivanjt
Guru
ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.ivanjt ought to be getting tired of karma fortunes by now.
 
Posts: 858
Karma: 1027478
Join Date: Aug 2010
Location: South of France
Device: kindle dx; eDGe
Quote:
Originally Posted by chaley View Post
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
ivanjt is offline   Reply With Quote
Old 10-14-2011, 11:36 PM   #13
katsu
Member
katsu began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Oct 2011
Device: iPad,Kindle3
.....

Last edited by katsu; 10-14-2011 at 11:43 PM.
katsu is offline   Reply With Quote
Old 10-14-2011, 11:42 PM   #14
katsu
Member
katsu began at the beginning.
 
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..
katsu is offline   Reply With Quote
Old 10-14-2011, 11:46 PM   #15
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: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Make sure you are running the official calibre binary not your distro's calibre package.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sony Reader Information, Start-Up and Reset Guide grooks Sony Reader 2 12-22-2010 07:06 PM
Prscustomizer not working and info on unicode shilpa Sony Reader 1 08-14-2009 01:35 AM
California to start using Open Source etextbooks Nate the great News 87 05-11-2009 12:18 PM
Different info between reader and Calibre db eyp Calibre 8 03-19-2009 03:53 AM
Sun's McNealy working on open source textbooks Bob Russell News 8 12-12-2006 02:03 PM


All times are GMT -4. The time now is 06:04 AM.


MobileRead.com is a privately owned, operated and funded community.