| 1 |
# SOME DESCRIPTIVE TITLE. |
| 2 |
# Copyright (C) Kovid Goyal |
| 3 |
# This file is distributed under the same license as the calibre package. |
| 4 |
# |
| 5 |
# Translators: |
| 6 |
msgid "" |
| 7 |
msgstr "" |
| 8 |
"Project-Id-Version: calibre\n" |
| 9 |
"Report-Msgid-Bugs-To: \n" |
| 10 |
"POT-Creation-Date: 2022-02-17 05:40+0000\n" |
| 11 |
"PO-Revision-Date: 2022-02-16 05:39+0000\n" |
| 12 |
"Last-Translator: Kovid Goyal <[email protected]>\n" |
| 13 |
"Language-Team: Maori (http://www.transifex.com/calibre/calibre/language/mi/)\n" |
| 14 |
"MIME-Version: 1.0\n" |
| 15 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 16 |
"Content-Transfer-Encoding: 8bit\n" |
| 17 |
"Language: mi\n" |
| 18 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n" |
| 19 |
|
| 20 |
#: ../../__w/calibre/calibre/manual/develop.rst:4 |
| 21 |
msgid "Setting up a calibre development environment" |
| 22 |
msgstr "" |
| 23 |
|
| 24 |
#: ../../__w/calibre/calibre/manual/develop.rst:6 |
| 25 |
msgid "" |
| 26 |
"calibre is completely open source, licensed under the `GNU GPL v3 " |
| 27 |
"<https://www.gnu.org/licenses/gpl.html>`_. This means that you are free to " |
| 28 |
"download and modify the program to your heart's content. In this section, " |
| 29 |
"you will learn how to get a calibre development environment set up on the " |
| 30 |
"operating system of your choice. calibre is written primarily in `Python " |
| 31 |
"<https://www.python.org>`_ with some C/C++ code for speed and system " |
| 32 |
"interfacing. Note that calibre requires at least Python 3.8." |
| 33 |
msgstr "" |
| 34 |
|
| 35 |
#: ../../__w/calibre/calibre/manual/develop.rst:14 |
| 36 |
msgid "Contents" |
| 37 |
msgstr "" |
| 38 |
|
| 39 |
#: ../../__w/calibre/calibre/manual/develop.rst:17 |
| 40 |
msgid "Design philosophy" |
| 41 |
msgstr "" |
| 42 |
|
| 43 |
#: ../../__w/calibre/calibre/manual/develop.rst:19 |
| 44 |
msgid "" |
| 45 |
"calibre has its roots in the Unix world, which means that its design is " |
| 46 |
"highly modular. The modules interact with each other via well defined " |
| 47 |
"interfaces. This makes adding new features and fixing bugs in calibre very " |
| 48 |
"easy, resulting in a frenetic pace of development. Because of its roots, " |
| 49 |
"calibre has a comprehensive command line interface for all its functions, " |
| 50 |
"documented in :doc:`generated/en/cli-index`." |
| 51 |
msgstr "" |
| 52 |
|
| 53 |
#: ../../__w/calibre/calibre/manual/develop.rst:24 |
| 54 |
msgid "" |
| 55 |
"The modular design of calibre is expressed via ``Plugins``. There is a " |
| 56 |
":ref:`tutorial <customize>` on writing calibre plugins. For example, adding " |
| 57 |
"support for a new device to calibre typically involves writing less than a " |
| 58 |
"100 lines of code in the form of a device driver plugin. You can browse the " |
| 59 |
"`built-in drivers " |
| 60 |
"<https://github.com/kovidgoyal/calibre/tree/master/src/calibre/devices>`_. " |
| 61 |
"Similarly, adding support for new conversion formats involves writing " |
| 62 |
"input/output format plugins. Another example of the modular design is the " |
| 63 |
":ref:`recipe system <news>` for fetching news. For more examples of plugins " |
| 64 |
"designed to add features to calibre, see the `Index of plugins " |
| 65 |
"<https://www.mobileread.com/forums/showthread.php?p=1362767#post1362767>`_." |
| 66 |
msgstr "" |
| 67 |
|
| 68 |
#: ../../__w/calibre/calibre/manual/develop.rst:34 |
| 69 |
msgid "Code layout" |
| 70 |
msgstr "" |
| 71 |
|
| 72 |
#: ../../__w/calibre/calibre/manual/develop.rst:36 |
| 73 |
msgid "" |
| 74 |
"All the calibre python code is in the ``calibre`` package. This package " |
| 75 |
"contains the following main sub-packages" |
| 76 |
msgstr "" |
| 77 |
|
| 78 |
#: ../../__w/calibre/calibre/manual/develop.rst:38 |
| 79 |
msgid "" |
| 80 |
"devices - All the device drivers. Just look through some of the built-in " |
| 81 |
"drivers to get an idea for how they work." |
| 82 |
msgstr "" |
| 83 |
|
| 84 |
#: ../../__w/calibre/calibre/manual/develop.rst:40 |
| 85 |
msgid "" |
| 86 |
"For details, see: ``devices.interface`` which defines the interface " |
| 87 |
"supported by device drivers and ``devices.usbms`` which defines a generic " |
| 88 |
"driver that connects to a USBMS device. All USBMS based drivers in calibre " |
| 89 |
"inherit from it." |
| 90 |
msgstr "" |
| 91 |
|
| 92 |
#: ../../__w/calibre/calibre/manual/develop.rst:43 |
| 93 |
msgid "" |
| 94 |
"e-books - All the e-book conversion/metadata code. A good starting point is" |
| 95 |
" ``calibre.ebooks.conversion.cli`` which is the module powering the " |
| 96 |
":command:`ebook-convert` command. The conversion process is controlled via " |
| 97 |
"``conversion.plumber``. The format independent code is all in ``ebooks.oeb``" |
| 98 |
" and the format dependent code is in ``ebooks.format_name``." |
| 99 |
msgstr "" |
| 100 |
|
| 101 |
#: ../../__w/calibre/calibre/manual/develop.rst:47 |
| 102 |
msgid "" |
| 103 |
"Metadata reading, writing, and downloading is all in ``ebooks.metadata``" |
| 104 |
msgstr "" |
| 105 |
|
| 106 |
#: ../../__w/calibre/calibre/manual/develop.rst:48 |
| 107 |
msgid "" |
| 108 |
"Conversion happens in a pipeline, for the structure of the pipeline, see " |
| 109 |
":ref:`conversion-introduction`. The pipeline consists of an input plugin, " |
| 110 |
"various transforms and an output plugin. The code that constructs and drives" |
| 111 |
" the pipeline is in :file:`plumber.py`. The pipeline works on a " |
| 112 |
"representation of an e-book that is like an unzipped epub, with manifest, " |
| 113 |
"spine, toc, guide, html content, etc. The class that manages this " |
| 114 |
"representation is OEBBook in ``ebooks.oeb.base``. The various " |
| 115 |
"transformations that are applied to the book during conversions live in " |
| 116 |
":file:`oeb/transforms/*.py`. And the input and output plugins live in " |
| 117 |
":file:`conversion/plugins/*.py`." |
| 118 |
msgstr "" |
| 119 |
|
| 120 |
#: ../../__w/calibre/calibre/manual/develop.rst:58 |
| 121 |
msgid "" |
| 122 |
"E-book editing happens using a different container object. It is documented " |
| 123 |
"in :ref:`polish_api`." |
| 124 |
msgstr "" |
| 125 |
|
| 126 |
#: ../../__w/calibre/calibre/manual/develop.rst:61 |
| 127 |
msgid "" |
| 128 |
"db - The database back-end. See :ref:`db_api` for the interface to the " |
| 129 |
"calibre library." |
| 130 |
msgstr "" |
| 131 |
|
| 132 |
#: ../../__w/calibre/calibre/manual/develop.rst:63 |
| 133 |
msgid "Content server: ``srv`` is the calibre Content server." |
| 134 |
msgstr "" |
| 135 |
|
| 136 |
#: ../../__w/calibre/calibre/manual/develop.rst:65 |
| 137 |
msgid "" |
| 138 |
"gui2 - The Graphical User Interface. GUI initialization happens in " |
| 139 |
"``gui2.main`` and ``gui2.ui``. The e-book-viewer is in ``gui2.viewer``. The " |
| 140 |
"e-book editor is in ``gui2.tweak_book``." |
| 141 |
msgstr "" |
| 142 |
|
| 143 |
#: ../../__w/calibre/calibre/manual/develop.rst:67 |
| 144 |
msgid "" |
| 145 |
"If you want to locate the entry points for all the various calibre " |
| 146 |
"executables, look at the ``entry_points`` structure in `linux.py " |
| 147 |
"<https://github.com/kovidgoyal/calibre/blob/master/src/calibre/linux.py>`_." |
| 148 |
msgstr "" |
| 149 |
|
| 150 |
#: ../../__w/calibre/calibre/manual/develop.rst:71 |
| 151 |
msgid "" |
| 152 |
"If you need help understanding the code, post in the `development forum " |
| 153 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_ and you will " |
| 154 |
"most likely get help from one of calibre's many developers." |
| 155 |
msgstr "" |
| 156 |
|
| 157 |
#: ../../__w/calibre/calibre/manual/develop.rst:75 |
| 158 |
msgid "Getting the code" |
| 159 |
msgstr "" |
| 160 |
|
| 161 |
#: ../../__w/calibre/calibre/manual/develop.rst:77 |
| 162 |
msgid "" |
| 163 |
"You can get the calibre source code in two ways, using a version control " |
| 164 |
"system or directly downloading a :website_base:`tarball <dist/src>`." |
| 165 |
msgstr "" |
| 166 |
|
| 167 |
#: ../../__w/calibre/calibre/manual/develop.rst:80 |
| 168 |
msgid "" |
| 169 |
"calibre uses `Git <https://www.git-scm.com/>`_, a distributed version " |
| 170 |
"control system. Git is available on all the platforms calibre supports. " |
| 171 |
"After installing Git, you can get the calibre source code with the command::" |
| 172 |
msgstr "" |
| 173 |
|
| 174 |
#: ../../__w/calibre/calibre/manual/develop.rst:86 |
| 175 |
msgid "" |
| 176 |
"On Windows you will need the complete path name, that will be something like" |
| 177 |
" :file:`C:\\\\Program Files\\\\Git\\\\git.exe`." |
| 178 |
msgstr "" |
| 179 |
|
| 180 |
#: ../../__w/calibre/calibre/manual/develop.rst:88 |
| 181 |
msgid "" |
| 182 |
"calibre is a very large project with a very long source control history, so " |
| 183 |
"the above can take a while (10 mins to an hour depending on your internet " |
| 184 |
"speed)." |
| 185 |
msgstr "" |
| 186 |
|
| 187 |
#: ../../__w/calibre/calibre/manual/develop.rst:91 |
| 188 |
msgid "" |
| 189 |
"If you want to get the code faster, the source code for the latest release " |
| 190 |
"is always available as an :website_base:`archive <dist/src>`." |
| 191 |
msgstr "" |
| 192 |
|
| 193 |
#: ../../__w/calibre/calibre/manual/develop.rst:94 |
| 194 |
msgid "To update a branch to the latest code, use the command::" |
| 195 |
msgstr "" |
| 196 |
|
| 197 |
#: ../../__w/calibre/calibre/manual/develop.rst:98 |
| 198 |
msgid "" |
| 199 |
"You can also browse the code at `GitHub " |
| 200 |
"<https://github.com/kovidgoyal/calibre>`_." |
| 201 |
msgstr "" |
| 202 |
|
| 203 |
#: ../../__w/calibre/calibre/manual/develop.rst:101 |
| 204 |
msgid "Submitting your changes to be included" |
| 205 |
msgstr "" |
| 206 |
|
| 207 |
#: ../../__w/calibre/calibre/manual/develop.rst:103 |
| 208 |
msgid "" |
| 209 |
"If you only plan to make a few small changes, you can make your changes and " |
| 210 |
"create a \"merge directive\" which you can then attach to a ticket in the " |
| 211 |
"calibre `bug tracker <https://bugs.launchpad.net/calibre>`_. To do this, " |
| 212 |
"make your changes, then run::" |
| 213 |
msgstr "" |
| 214 |
|
| 215 |
#: ../../__w/calibre/calibre/manual/develop.rst:111 |
| 216 |
msgid "" |
| 217 |
"This will create a :file:`my-changes` file in the current folder, simply " |
| 218 |
"attach that to a ticket on the calibre `bug tracker " |
| 219 |
"<https://bugs.launchpad.net/calibre>`_. Note that this will include *all* " |
| 220 |
"the commits you have made. If you only want to send some commits, you have " |
| 221 |
"to change ``origin/master`` above. To send only the last commit, use::" |
| 222 |
msgstr "" |
| 223 |
|
| 224 |
#: ../../__w/calibre/calibre/manual/develop.rst:119 |
| 225 |
msgid "" |
| 226 |
"To send the last *n* commits, replace *1* with *n*, for example, for the " |
| 227 |
"last 3 commits::" |
| 228 |
msgstr "" |
| 229 |
|
| 230 |
#: ../../__w/calibre/calibre/manual/develop.rst:124 |
| 231 |
msgid "Be careful to not include merges when using ``HEAD~n``." |
| 232 |
msgstr "" |
| 233 |
|
| 234 |
#: ../../__w/calibre/calibre/manual/develop.rst:126 |
| 235 |
msgid "" |
| 236 |
"If you plan to do a lot of development on calibre, then the best method is " |
| 237 |
"to create a `GitHub <https://github.com>`__ account. Below is a basic guide " |
| 238 |
"to setting up your own fork of calibre in a way that will allow you to " |
| 239 |
"submit pull requests for inclusion into the main calibre repository:" |
| 240 |
msgstr "" |
| 241 |
|
| 242 |
#: ../../__w/calibre/calibre/manual/develop.rst:131 |
| 243 |
msgid "" |
| 244 |
"Setup git on your machine as described in this article: `Setup Git " |
| 245 |
"<https://help.github.com/articles/set-up-git>`_" |
| 246 |
msgstr "" |
| 247 |
|
| 248 |
#: ../../__w/calibre/calibre/manual/develop.rst:132 |
| 249 |
msgid "" |
| 250 |
"Setup ssh keys for authentication to GitHub, as described here: `Generating " |
| 251 |
"SSH keys <https://help.github.com/articles/generating-ssh-keys>`_" |
| 252 |
msgstr "" |
| 253 |
|
| 254 |
#: ../../__w/calibre/calibre/manual/develop.rst:133 |
| 255 |
msgid "" |
| 256 |
"Go to https://github.com/kovidgoyal/calibre and click the :guilabel:`Fork` " |
| 257 |
"button." |
| 258 |
msgstr "" |
| 259 |
|
| 260 |
#: ../../__w/calibre/calibre/manual/develop.rst:134 |
| 261 |
msgid "In a Terminal do::" |
| 262 |
msgstr "" |
| 263 |
|
| 264 |
#: ../../__w/calibre/calibre/manual/develop.rst:139 |
| 265 |
msgid "" |
| 266 |
"Replace <username> above with your GitHub username. That will get your fork " |
| 267 |
"checked out locally." |
| 268 |
msgstr "" |
| 269 |
|
| 270 |
#: ../../__w/calibre/calibre/manual/develop.rst:140 |
| 271 |
msgid "" |
| 272 |
"You can make changes and commit them whenever you like. When you are ready " |
| 273 |
"to have your work merged, do a::" |
| 274 |
msgstr "" |
| 275 |
|
| 276 |
#: ../../__w/calibre/calibre/manual/develop.rst:144 |
| 277 |
msgid "" |
| 278 |
"and go to ``https://github.com/<username>/calibre`` and click the " |
| 279 |
":guilabel:`Pull Request` button to generate a pull request that can be " |
| 280 |
"merged." |
| 281 |
msgstr "" |
| 282 |
|
| 283 |
#: ../../__w/calibre/calibre/manual/develop.rst:145 |
| 284 |
msgid "" |
| 285 |
"You can update your local copy with code from the main repo at any time by " |
| 286 |
"doing::" |
| 287 |
msgstr "" |
| 288 |
|
| 289 |
#: ../../__w/calibre/calibre/manual/develop.rst:150 |
| 290 |
msgid "" |
| 291 |
"You should also keep an eye on the calibre `development forum " |
| 292 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_. Before making " |
| 293 |
"major changes, you should discuss them in the forum or contact Kovid " |
| 294 |
"directly (his email address is all over the source code)." |
| 295 |
msgstr "" |
| 296 |
|
| 297 |
#: ../../__w/calibre/calibre/manual/develop.rst:156 |
| 298 |
msgid "Windows development environment" |
| 299 |
msgstr "" |
| 300 |
|
| 301 |
#: ../../__w/calibre/calibre/manual/develop.rst:158 |
| 302 |
#: ../../__w/calibre/calibre/manual/develop.rst:192 |
| 303 |
#: ../../__w/calibre/calibre/manual/develop.rst:228 |
| 304 |
msgid "" |
| 305 |
"You must also get the calibre source code separately as described above." |
| 306 |
msgstr "" |
| 307 |
|
| 308 |
#: ../../__w/calibre/calibre/manual/develop.rst:160 |
| 309 |
msgid "" |
| 310 |
"Install calibre normally, using the Windows installer. Then open a Command " |
| 311 |
"Prompt and change to the previously checked out calibre code folder. For " |
| 312 |
"example::" |
| 313 |
msgstr "" |
| 314 |
|
| 315 |
#: ../../__w/calibre/calibre/manual/develop.rst:165 |
| 316 |
#: ../../__w/calibre/calibre/manual/develop.rst:240 |
| 317 |
msgid "calibre is the folder that contains the src and resources sub-folders." |
| 318 |
msgstr "" |
| 319 |
|
| 320 |
#: ../../__w/calibre/calibre/manual/develop.rst:167 |
| 321 |
msgid "" |
| 322 |
"The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to" |
| 323 |
" the absolute path of the src folder. So, following the example above, it " |
| 324 |
"would be ``C:\\Users\\kovid\\work\\calibre\\src``. `Here is a short guide " |
| 325 |
"<https://docs.python.org/using/windows.html#excursus-setting-environment-" |
| 326 |
"variables>`_ to setting environment variables on Windows." |
| 327 |
msgstr "" |
| 328 |
|
| 329 |
#: ../../__w/calibre/calibre/manual/develop.rst:172 |
| 330 |
msgid "" |
| 331 |
"Once you have set the environment variable, open a new command prompt and " |
| 332 |
"check that it was correctly set by using the command::" |
| 333 |
msgstr "" |
| 334 |
|
| 335 |
#: ../../__w/calibre/calibre/manual/develop.rst:177 |
| 336 |
#: ../../__w/calibre/calibre/manual/develop.rst:251 |
| 337 |
msgid "" |
| 338 |
"Setting this environment variable means that calibre will now load all its " |
| 339 |
"Python code from the specified location." |
| 340 |
msgstr "" |
| 341 |
|
| 342 |
#: ../../__w/calibre/calibre/manual/develop.rst:179 |
| 343 |
msgid "" |
| 344 |
"That's it! You are now ready to start hacking on the calibre code. For " |
| 345 |
"example, open the file :file:`src\\\\calibre\\\\__init__.py` in your " |
| 346 |
"favorite editor and add the line::" |
| 347 |
msgstr "" |
| 348 |
|
| 349 |
#: ../../__w/calibre/calibre/manual/develop.rst:184 |
| 350 |
#: ../../__w/calibre/calibre/manual/develop.rst:258 |
| 351 |
msgid "" |
| 352 |
"near the top of the file. Now run the command :command:`calibredb`. The very" |
| 353 |
" first line of output should be ``Hello, world!``." |
| 354 |
msgstr "" |
| 355 |
|
| 356 |
#: ../../__w/calibre/calibre/manual/develop.rst:186 |
| 357 |
msgid "" |
| 358 |
"You can also setup a calibre development environment inside the free " |
| 359 |
"Microsoft Visual Studio, if you like, following the instructions `here " |
| 360 |
"<https://www.mobileread.com/forums/showthread.php?t=251201>`_." |
| 361 |
msgstr "" |
| 362 |
|
| 363 |
#: ../../__w/calibre/calibre/manual/develop.rst:190 |
| 364 |
msgid "macOS development environment" |
| 365 |
msgstr "" |
| 366 |
|
| 367 |
#: ../../__w/calibre/calibre/manual/develop.rst:194 |
| 368 |
msgid "" |
| 369 |
"Install calibre normally using the provided .dmg. Then open a Terminal and " |
| 370 |
"change to the previously checked out calibre code folder, for example::" |
| 371 |
msgstr "" |
| 372 |
|
| 373 |
#: ../../__w/calibre/calibre/manual/develop.rst:199 |
| 374 |
msgid "" |
| 375 |
"calibre is the folder that contains the src and resources sub-folders. The " |
| 376 |
"calibre command line tools are found inside the calibre app bundle, in " |
| 377 |
":file:`/Applications/calibre.app/Contents/MacOS` you should add this folder " |
| 378 |
"to your PATH environment variable, if you want to run the command line tools" |
| 379 |
" easily." |
| 380 |
msgstr "" |
| 381 |
|
| 382 |
#: ../../__w/calibre/calibre/manual/develop.rst:205 |
| 383 |
msgid "" |
| 384 |
"The next step is to create a bash script that will set the environment " |
| 385 |
"variable ``CALIBRE_DEVELOP_FROM`` to the absolute path of the src folder " |
| 386 |
"when running calibre in debug mode." |
| 387 |
msgstr "" |
| 388 |
|
| 389 |
#: ../../__w/calibre/calibre/manual/develop.rst:207 |
| 390 |
msgid "Create a plain text file::" |
| 391 |
msgstr "" |
| 392 |
|
| 393 |
#: ../../__w/calibre/calibre/manual/develop.rst:213 |
| 394 |
msgid "" |
| 395 |
"Save this file as :file:`/usr/local/bin/calibre-develop`, then set its " |
| 396 |
"permissions so that it can be executed::" |
| 397 |
msgstr "" |
| 398 |
|
| 399 |
#: ../../__w/calibre/calibre/manual/develop.rst:217 |
| 400 |
msgid "Once you have done this, run::" |
| 401 |
msgstr "" |
| 402 |
|
| 403 |
#: ../../__w/calibre/calibre/manual/develop.rst:221 |
| 404 |
msgid "" |
| 405 |
"You should see some diagnostic information in the Terminal window as calibre" |
| 406 |
" starts up, and you should see an asterisk after the version number in the " |
| 407 |
"GUI window, indicating that you are running from source." |
| 408 |
msgstr "" |
| 409 |
|
| 410 |
#: ../../__w/calibre/calibre/manual/develop.rst:226 |
| 411 |
msgid "Linux development environment" |
| 412 |
msgstr "" |
| 413 |
|
| 414 |
#: ../../__w/calibre/calibre/manual/develop.rst:230 |
| 415 |
msgid "" |
| 416 |
"calibre is primarily developed on Linux. You have two choices in setting up " |
| 417 |
"the development environment. You can install the calibre binary as normal " |
| 418 |
"and use that as a runtime environment to do your development. This approach " |
| 419 |
"is similar to that used in Windows and macOS. Alternatively, you can install" |
| 420 |
" calibre from source. Instructions for setting up a development environment " |
| 421 |
"from source are in the INSTALL file in the source tree. Here we will address" |
| 422 |
" using the binary as a runtime, which is the recommended method." |
| 423 |
msgstr "" |
| 424 |
|
| 425 |
#: ../../__w/calibre/calibre/manual/develop.rst:236 |
| 426 |
msgid "" |
| 427 |
"Install calibre using the binary installer. Then open a terminal and change " |
| 428 |
"to the previously checked out calibre code folder, for example::" |
| 429 |
msgstr "" |
| 430 |
|
| 431 |
#: ../../__w/calibre/calibre/manual/develop.rst:242 |
| 432 |
msgid "" |
| 433 |
"The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to" |
| 434 |
" the absolute path of the src folder. So, following the example above, it " |
| 435 |
"would be ``/home/kovid/work/calibre/src``. How to set environment variables " |
| 436 |
"depends on your Linux distribution and what shell you are using." |
| 437 |
msgstr "" |
| 438 |
|
| 439 |
#: ../../__w/calibre/calibre/manual/develop.rst:246 |
| 440 |
msgid "" |
| 441 |
"Once you have set the environment variable, open a new terminal and check " |
| 442 |
"that it was correctly set by using the command::" |
| 443 |
msgstr "" |
| 444 |
|
| 445 |
#: ../../__w/calibre/calibre/manual/develop.rst:253 |
| 446 |
msgid "" |
| 447 |
"That's it! You are now ready to start hacking on the calibre code. For " |
| 448 |
"example, open the file :file:`src/calibre/__init__.py` in your favorite " |
| 449 |
"editor and add the line::" |
| 450 |
msgstr "" |
| 451 |
|
| 452 |
#: ../../__w/calibre/calibre/manual/develop.rst:261 |
| 453 |
msgid "" |
| 454 |
"Having separate \"normal\" and \"development\" calibre installs on the same " |
| 455 |
"computer" |
| 456 |
msgstr "" |
| 457 |
|
| 458 |
#: ../../__w/calibre/calibre/manual/develop.rst:263 |
| 459 |
msgid "" |
| 460 |
"The calibre source tree is very stable and rarely breaks, but if you feel " |
| 461 |
"the need to run from source on a separate test library and run the released " |
| 462 |
"calibre version with your everyday library, you can achieve this easily " |
| 463 |
"using .bat files or shell scripts to launch calibre. The example below shows" |
| 464 |
" how to do this on Windows using .bat files (the instructions for other " |
| 465 |
"platforms are the same, just use a shell script instead of a .bat file)" |
| 466 |
msgstr "" |
| 467 |
|
| 468 |
#: ../../__w/calibre/calibre/manual/develop.rst:268 |
| 469 |
msgid "To launch the release version of calibre with your everyday library:" |
| 470 |
msgstr "" |
| 471 |
|
| 472 |
#: ../../__w/calibre/calibre/manual/develop.rst:270 |
| 473 |
msgid "calibre-normal.bat::" |
| 474 |
msgstr "" |
| 475 |
|
| 476 |
#: ../../__w/calibre/calibre/manual/develop.rst:274 |
| 477 |
msgid "calibre-dev.bat::" |
| 478 |
msgstr "" |
| 479 |
|
| 480 |
#: ../../__w/calibre/calibre/manual/develop.rst:281 |
| 481 |
msgid "Debugging tips" |
| 482 |
msgstr "" |
| 483 |
|
| 484 |
#: ../../__w/calibre/calibre/manual/develop.rst:283 |
| 485 |
msgid "" |
| 486 |
"Python is a dynamically typed language with excellent facilities for " |
| 487 |
"introspection. Kovid wrote the core calibre code without once using a " |
| 488 |
"debugger. There are many strategies to debug calibre code:" |
| 489 |
msgstr "" |
| 490 |
|
| 491 |
#: ../../__w/calibre/calibre/manual/develop.rst:288 |
| 492 |
msgid "Using print statements" |
| 493 |
msgstr "" |
| 494 |
|
| 495 |
#: ../../__w/calibre/calibre/manual/develop.rst:290 |
| 496 |
msgid "" |
| 497 |
"This is Kovid's favorite way to debug. Simply insert print statements at " |
| 498 |
"points of interest and run your program in the terminal. For example, you " |
| 499 |
"can start the GUI from the terminal as::" |
| 500 |
msgstr "" |
| 501 |
|
| 502 |
#: ../../__w/calibre/calibre/manual/develop.rst:295 |
| 503 |
msgid "Similarly, you can start the E-book viewer as::" |
| 504 |
msgstr "" |
| 505 |
|
| 506 |
#: ../../__w/calibre/calibre/manual/develop.rst:299 |
| 507 |
msgid "The e-book-editor can be started as::" |
| 508 |
msgstr "" |
| 509 |
|
| 510 |
#: ../../__w/calibre/calibre/manual/develop.rst:304 |
| 511 |
msgid "Using an interactive Python interpreter" |
| 512 |
msgstr "" |
| 513 |
|
| 514 |
#: ../../__w/calibre/calibre/manual/develop.rst:306 |
| 515 |
msgid "" |
| 516 |
"You can insert the following two lines of code to start an interactive " |
| 517 |
"Python session at that point::" |
| 518 |
msgstr "" |
| 519 |
|
| 520 |
#: ../../__w/calibre/calibre/manual/develop.rst:311 |
| 521 |
msgid "" |
| 522 |
"When running from the command line, this will start an interactive Python " |
| 523 |
"interpreter with access to all locally defined variables (variables in the " |
| 524 |
"local scope). The interactive prompt even has :kbd:`Tab` completion for " |
| 525 |
"object properties and you can use the various Python facilities for " |
| 526 |
"introspection, such as :func:`dir`, :func:`type`, :func:`repr`, etc." |
| 527 |
msgstr "" |
| 528 |
|
| 529 |
#: ../../__w/calibre/calibre/manual/develop.rst:317 |
| 530 |
msgid "Using the Python debugger as a remote debugger" |
| 531 |
msgstr "" |
| 532 |
|
| 533 |
#: ../../__w/calibre/calibre/manual/develop.rst:319 |
| 534 |
msgid "" |
| 535 |
"You can use the builtin Python debugger (pdb) as a remote debugger from the " |
| 536 |
"command line. First, start the remote debugger at the point in the calibre " |
| 537 |
"code you are interested in, like this::" |
| 538 |
msgstr "" |
| 539 |
|
| 540 |
#: ../../__w/calibre/calibre/manual/develop.rst:326 |
| 541 |
msgid "" |
| 542 |
"Then run calibre, either as normal, or using one of the calibre-debug " |
| 543 |
"commands described in the previous section. Once the above point in the code" |
| 544 |
" is reached, calibre will freeze, waiting for the debugger to connect." |
| 545 |
msgstr "" |
| 546 |
|
| 547 |
#: ../../__w/calibre/calibre/manual/develop.rst:330 |
| 548 |
msgid "" |
| 549 |
"Now open a terminal or command prompt and use the following command to start" |
| 550 |
" the debugging session::" |
| 551 |
msgstr "" |
| 552 |
|
| 553 |
#: ../../__w/calibre/calibre/manual/develop.rst:335 |
| 554 |
msgid "" |
| 555 |
"You can read about how to use the Python debugger in the `Python stdlib docs" |
| 556 |
" for the pdb module <https://docs.python.org/library/pdb.html#debugger-" |
| 557 |
"commands>`_." |
| 558 |
msgstr "" |
| 559 |
|
| 560 |
#: ../../__w/calibre/calibre/manual/develop.rst:339 |
| 561 |
msgid "" |
| 562 |
"By default, the remote debugger will try to connect on port 4444. You can " |
| 563 |
"change it, by passing the port parameter to both the set_trace() and the " |
| 564 |
"cli() functions above, like this: ``set_trace(port=1234)`` and " |
| 565 |
"``cli(port=1234)``." |
| 566 |
msgstr "" |
| 567 |
|
| 568 |
#: ../../__w/calibre/calibre/manual/develop.rst:345 |
| 569 |
msgid "" |
| 570 |
"The Python debugger cannot handle multiple threads, so you have to call " |
| 571 |
"set_trace once per thread, each time with a different port number." |
| 572 |
msgstr "" |
| 573 |
|
| 574 |
#: ../../__w/calibre/calibre/manual/develop.rst:349 |
| 575 |
msgid "Using the debugger in your favorite Python IDE" |
| 576 |
msgstr "" |
| 577 |
|
| 578 |
#: ../../__w/calibre/calibre/manual/develop.rst:351 |
| 579 |
msgid "" |
| 580 |
"It is possible to use the builtin debugger in your favorite Python IDE, if " |
| 581 |
"it supports remote debugging. The first step is to add the calibre src " |
| 582 |
"checkout to the ``PYTHONPATH`` in your IDE. In other words, the folder you " |
| 583 |
"set as ``CALIBRE_DEVELOP_FROM`` above, must also be in the ``PYTHONPATH`` of" |
| 584 |
" your IDE." |
| 585 |
msgstr "" |
| 586 |
|
| 587 |
#: ../../__w/calibre/calibre/manual/develop.rst:356 |
| 588 |
msgid "" |
| 589 |
"Then place the IDE's remote debugger module into the :file:`src` sub-folder " |
| 590 |
"of the calibre source code checkout. Add whatever code is needed to launch " |
| 591 |
"the remote debugger to calibre at the point of interest, for example in the " |
| 592 |
"main function. Then run calibre as normal. Your IDE should now be able to " |
| 593 |
"connect to the remote debugger running inside calibre." |
| 594 |
msgstr "" |
| 595 |
|
| 596 |
#: ../../__w/calibre/calibre/manual/develop.rst:363 |
| 597 |
msgid "Executing arbitrary scripts in the calibre Python environment" |
| 598 |
msgstr "" |
| 599 |
|
| 600 |
#: ../../__w/calibre/calibre/manual/develop.rst:365 |
| 601 |
msgid "" |
| 602 |
"The :command:`calibre-debug` command provides a couple of handy switches to " |
| 603 |
"execute your own code, with access to the calibre modules::" |
| 604 |
msgstr "" |
| 605 |
|
| 606 |
#: ../../__w/calibre/calibre/manual/develop.rst:370 |
| 607 |
msgid "" |
| 608 |
"is great for testing a little snippet of code on the command line. It works " |
| 609 |
"in the same way as the -c switch to the Python interpreter::" |
| 610 |
msgstr "" |
| 611 |
|
| 612 |
#: ../../__w/calibre/calibre/manual/develop.rst:374 |
| 613 |
msgid "" |
| 614 |
"can be used to execute your own Python script. It works in the same way as " |
| 615 |
"passing the script to the Python interpreter, except that the calibre " |
| 616 |
"environment is fully initialized, so you can use all the calibre code in " |
| 617 |
"your script. To use command line arguments with your script, use the form::" |
| 618 |
msgstr "" |
| 619 |
|
| 620 |
#: ../../__w/calibre/calibre/manual/develop.rst:379 |
| 621 |
msgid "" |
| 622 |
"The ``--`` causes all subsequent arguments to be passed to your script." |
| 623 |
msgstr "" |
| 624 |
|
| 625 |
#: ../../__w/calibre/calibre/manual/develop.rst:383 |
| 626 |
msgid "Using calibre in your projects" |
| 627 |
msgstr "" |
| 628 |
|
| 629 |
#: ../../__w/calibre/calibre/manual/develop.rst:385 |
| 630 |
msgid "" |
| 631 |
"It is possible to directly use calibre functions/code in your Python " |
| 632 |
"project. Two ways exist to do this:" |
| 633 |
msgstr "" |
| 634 |
|
| 635 |
#: ../../__w/calibre/calibre/manual/develop.rst:388 |
| 636 |
msgid "Binary install of calibre" |
| 637 |
msgstr "" |
| 638 |
|
| 639 |
#: ../../__w/calibre/calibre/manual/develop.rst:390 |
| 640 |
msgid "" |
| 641 |
"If you have a binary install of calibre, you can use the Python interpreter " |
| 642 |
"bundled with calibre, like this::" |
| 643 |
msgstr "" |
| 644 |
|
| 645 |
#: ../../__w/calibre/calibre/manual/develop.rst:395 |
| 646 |
msgid "Source install on Linux" |
| 647 |
msgstr "" |
| 648 |
|
| 649 |
#: ../../__w/calibre/calibre/manual/develop.rst:397 |
| 650 |
msgid "" |
| 651 |
"In addition to using the above technique, if you do a source install on " |
| 652 |
"Linux, you can also directly import calibre, as follows::" |
| 653 |
msgstr "" |
| 654 |
|
| 655 |
#: ../../__w/calibre/calibre/manual/develop.rst:405 |
| 656 |
msgid "" |
| 657 |
"It is essential that you import the init_calibre module before any other " |
| 658 |
"calibre modules/packages as it sets up the interpreter to run calibre code." |
| 659 |
msgstr "" |
| 660 |
|
| 661 |
#: ../../__w/calibre/calibre/manual/develop.rst:409 |
| 662 |
msgid "API documentation for various parts of calibre" |
| 663 |
msgstr "" |