MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Development (https://www.mobileread.com/forums/forumdisplay.php?f=240)
-   -   "Setting up a calibre development environment" documentation suggestion (https://www.mobileread.com/forums/showthread.php?t=236759)

trying 03-30-2014 08:09 PM

"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?

kovidgoyal 03-30-2014 11:25 PM

https://github.com/kovidgoyal/calibr...725d6353326b6e


All times are GMT -4. The time now is 08:50 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.