View Single Post
Old 03-30-2014, 07:09 PM   #1
trying
Member
trying doesn't littertrying doesn't litter
 
Posts: 21
Karma: 104
Join Date: Oct 2013
Device: none
"Setting up a calibre development environment" documentation suggestion

As a newbie Calibre programmer on Windows looking at the source code download, one of the very first things that I wondered about was "Where is the code that implements the X.exe program?". After a bit of looking around I found in setup/__init__.py:

Code:
    epsrc = re.compile(r'entry_points = (\{.*?\})', re.DOTALL).\
            search(open('src/calibre/linux.py', 'rb').read()).group(1)
And src/calibre/linux.py contains:

Code:
entry_points = {
        'console_scripts': [
             'ebook-device       = calibre.devices.cli:main',
             'ebook-meta         = calibre.ebooks.metadata.cli:main',
             'ebook-convert      = calibre.ebooks.conversion.cli:main',
             'ebook-polish       = calibre.ebooks.oeb.polish.main:main',
             'markdown-calibre   = calibre.ebooks.markdown.__main__:run',
             'web2disk           = calibre.web.fetch.simple:main',
             'calibre-server     = calibre.library.server.main:main',
             'lrf2lrs            = calibre.ebooks.lrf.lrfparser:main',
             'lrs2lrf            = calibre.ebooks.lrf.lrs.convert_from:main',
             'calibre-debug      = calibre.debug:main',
             'calibredb          = calibre.library.cli:main',
             'calibre-parallel   = calibre.utils.ipc.worker:main',
             'calibre-customize  = calibre.customize.ui:main',
             'calibre-complete   = calibre.utils.complete:main',
             'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main',
             'calibre-smtp = calibre.utils.smtp:main',
        ],
        'gui_scripts' : [
            __appname__+' = calibre.gui2.main:main',
            'lrfviewer    = calibre.gui2.lrf_renderer.main:main',
            'ebook-viewer = calibre.gui2.viewer.main:main',
            'ebook-edit   = calibre.gui2.tweak_book.main:main',
                            ],
      }
From this it can be determined that the python module that implements ebook-convert.exe, for example, is found in src/calibre/ebooks/conversion/cli.py starting at its main() function.

May I suggest that you add something mentioning entry_points in src/calibre/linux.py to the Code Layout section of the Setting up a calibre development environment?
trying is offline   Reply With Quote