|
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: Python Packaging User Guide \n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | | -"POT-Creation-Date: 2021-07-03 21:32+0800\n" |
| 11 | +"POT-Creation-Date: 2021-07-06 12:35+0800\n" |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
@@ -3306,180 +3306,184 @@ msgid "The approaches described below don't simplify the distribution case at al |
3306 | 3306 | msgstr "" |
3307 | 3307 |
|
3308 | 3308 | #: ../source/guides/packaging-binary-extensions.rst:162 |
3309 | | -msgid "In addition to being useful for the creation of accelerator modules, `Cython <http://cython.org/>`__ is also useful for creating wrapper modules. It still involves wrapping the interfaces by hand, however, so may not be a good choice for wrapping large APIs." |
| 3309 | +msgid "In addition to being useful for the creation of accelerator modules, `Cython <http://cython.org/>`__ is also useful for creating wrapper modules for C or C++. It still involves wrapping the interfaces by hand, however, and is very repetitive, so may not be a good choice for wrapping large APIs." |
3310 | 3310 | msgstr "" |
3311 | 3311 |
|
3312 | | -#: ../source/guides/packaging-binary-extensions.rst:167 |
| 3312 | +#: ../source/guides/packaging-binary-extensions.rst:168 |
| 3313 | +msgid "`pybind11 <https://pybind11.readthedocs.io>`__ is a pure C++11 library that provides a clean C++ interface to the CPython (and PyPy) C API. It does not require a pre-processing step; it is written entirely in templated C++. Helpers are included for Setuptools or CMake builds. It was based on `Boost.Python <https://www.boost.org/doc/libs/1_76_0/libs/python/doc/html/index.html>`__, but doesn't require the Boost libraries or BJam." |
| 3314 | +msgstr "" |
| 3315 | + |
| 3316 | +#: ../source/guides/packaging-binary-extensions.rst:175 |
3313 | 3317 | msgid "`cffi <https://cffi.readthedocs.io/>`__ is a project created by some of the PyPy developers to make it straightforward for developers that already know both Python and C to expose their C modules to Python applications. It also makes it relatively straightforward to wrap a C module based on its header files, even if you don't know C yourself." |
3314 | 3318 | msgstr "" |
3315 | 3319 |
|
3316 | | -#: ../source/guides/packaging-binary-extensions.rst:173 |
| 3320 | +#: ../source/guides/packaging-binary-extensions.rst:181 |
3317 | 3321 | msgid "One of the key advantages of ``cffi`` is that it is compatible with the PyPy JIT, allowing CFFI wrapper modules to participate fully in PyPy's tracing JIT optimisations." |
3318 | 3322 | msgstr "" |
3319 | 3323 |
|
3320 | | -#: ../source/guides/packaging-binary-extensions.rst:177 |
3321 | | -msgid "`SWIG <http://www.swig.org/>`__ is a wrapper interface generator that allows a variety of programming languages, including Python, to interface with C *and C++* code." |
| 3324 | +#: ../source/guides/packaging-binary-extensions.rst:185 |
| 3325 | +msgid "`SWIG <http://www.swig.org/>`__ is a wrapper interface generator that allows a variety of programming languages, including Python, to interface with C and C++ code." |
3322 | 3326 | msgstr "" |
3323 | 3327 |
|
3324 | | -#: ../source/guides/packaging-binary-extensions.rst:181 |
| 3328 | +#: ../source/guides/packaging-binary-extensions.rst:189 |
3325 | 3329 | msgid "The standard library's ``ctypes`` module, while useful for getting access to C level interfaces when header information isn't available, suffers from the fact that it operates solely at the C ABI level, and thus has no automatic consistency checking between the interface actually being exported by the library and the one declared in the Python code. By contrast, the above alternatives are all able to operate at the C *API* level, using C header files to ensure consistency between the interface exported by the library being wrapped and the one expected by the Python wrapper module. While ``cffi`` *can* operate directly at the C ABI level, it suffers from the same interface inconsistency problems as ``ctypes`` when it is used that way." |
3326 | 3330 | msgstr "" |
3327 | 3331 |
|
3328 | | -#: ../source/guides/packaging-binary-extensions.rst:195 |
| 3332 | +#: ../source/guides/packaging-binary-extensions.rst:203 |
3329 | 3333 | msgid "Alternatives for low level system access" |
3330 | 3334 | msgstr "" |
3331 | 3335 |
|
3332 | | -#: ../source/guides/packaging-binary-extensions.rst:197 |
| 3336 | +#: ../source/guides/packaging-binary-extensions.rst:205 |
3333 | 3337 | msgid "For applications that need low level system access (regardless of the reason), a binary extension module often *is* the best way to go about it. This is particularly true for low level access to the CPython runtime itself, since some operations (like releasing the Global Interpreter Lock) are simply invalid when the interpreter is running code, even if a module like ``ctypes`` or ``cffi`` is used to obtain access to the relevant C API interfaces." |
3334 | 3338 | msgstr "" |
3335 | 3339 |
|
3336 | | -#: ../source/guides/packaging-binary-extensions.rst:205 |
| 3340 | +#: ../source/guides/packaging-binary-extensions.rst:213 |
3337 | 3341 | msgid "For cases where the extension module is manipulating the underlying operating system or hardware (rather than the CPython runtime), it may sometimes be better to just write an ordinary C library (or a library in another systems programming language like C++ or Rust that can export a C compatible ABI), and then use one of the wrapping techniques described above to make the interface available as an importable Python module." |
3338 | 3342 | msgstr "" |
3339 | 3343 |
|
3340 | | -#: ../source/guides/packaging-binary-extensions.rst:214 |
| 3344 | +#: ../source/guides/packaging-binary-extensions.rst:222 |
3341 | 3345 | msgid "Implementing binary extensions" |
3342 | 3346 | msgstr "" |
3343 | 3347 |
|
3344 | | -#: ../source/guides/packaging-binary-extensions.rst:216 |
| 3348 | +#: ../source/guides/packaging-binary-extensions.rst:224 |
3345 | 3349 | msgid "The CPython `Extending and Embedding <https://docs.python.org/3/extending/>`_ guide includes an introduction to writing a `custom extension module in C <https://docs.python.org/3/extending/extending.html>`_." |
3346 | 3350 | msgstr "" |
3347 | 3351 |
|
3348 | | -#: ../source/guides/packaging-binary-extensions.rst:233 |
| 3352 | +#: ../source/guides/packaging-binary-extensions.rst:241 |
3349 | 3353 | msgid "Building binary extensions" |
3350 | 3354 | msgstr "" |
3351 | 3355 |
|
3352 | | -#: ../source/guides/packaging-binary-extensions.rst:236 |
| 3356 | +#: ../source/guides/packaging-binary-extensions.rst:244 |
3353 | 3357 | msgid "Building extensions for multiple platforms" |
3354 | 3358 | msgstr "" |
3355 | 3359 |
|
3356 | | -#: ../source/guides/packaging-binary-extensions.rst:238 |
| 3360 | +#: ../source/guides/packaging-binary-extensions.rst:246 |
3357 | 3361 | msgid "If you plan to distribute your extension, you should provide :term:`wheels <Wheel>` for all the platforms you intend to support. For most extensions, this is at least one package per Python version times the number of OS and architectures you support. These are usually built on continuous integration (CI) systems. There are tools to help you build highly redistributable binaries from CI; these include :ref:`cibuildwheel` and :ref:`multibuild`." |
3358 | 3362 | msgstr "" |
3359 | 3363 |
|
3360 | | -#: ../source/guides/packaging-binary-extensions.rst:248 |
| 3364 | +#: ../source/guides/packaging-binary-extensions.rst:256 |
3361 | 3365 | msgid "Binary extensions for Windows" |
3362 | 3366 | msgstr "" |
3363 | 3367 |
|
3364 | | -#: ../source/guides/packaging-binary-extensions.rst:250 |
| 3368 | +#: ../source/guides/packaging-binary-extensions.rst:258 |
3365 | 3369 | msgid "Before it is possible to build a binary extension, it is necessary to ensure that you have a suitable compiler available. On Windows, Visual C is used to build the official CPython interpreter, and should be used to build compatible binary extensions." |
3366 | 3370 | msgstr "" |
3367 | 3371 |
|
3368 | | -#: ../source/guides/packaging-binary-extensions.rst:255 |
| 3372 | +#: ../source/guides/packaging-binary-extensions.rst:263 |
3369 | 3373 | msgid "Python 2.7 used Visual Studio 2008, Python 3.3 and 3.4 used Visual Studio 2010, and Python 3.5+ uses Visual Studio 2015 or later. Unfortunately, older versions of Visual Studio are no longer easily available from Microsoft, so for versions of Python prior to 3.5, the compilers must be obtained differently if you do not already have a copy of the relevant version of Visual Studio." |
3370 | 3374 | msgstr "" |
3371 | 3375 |
|
3372 | | -#: ../source/guides/packaging-binary-extensions.rst:261 |
| 3376 | +#: ../source/guides/packaging-binary-extensions.rst:269 |
3373 | 3377 | msgid "To set up a build environment for binary extensions, the steps are as follows:" |
3374 | 3378 | msgstr "" |
3375 | 3379 |
|
3376 | | -#: ../source/guides/packaging-binary-extensions.rst:263 |
| 3380 | +#: ../source/guides/packaging-binary-extensions.rst:271 |
3377 | 3381 | msgid "For Python 2.7" |
3378 | 3382 | msgstr "" |
3379 | 3383 |
|
3380 | | -#: ../source/guides/packaging-binary-extensions.rst:265 |
| 3384 | +#: ../source/guides/packaging-binary-extensions.rst:273 |
3381 | 3385 | msgid "Install \"Visual C++ Compiler Package for Python 2.7\", which is available from `Microsoft's website <https://www.microsoft.com/en-gb/download/details.aspx?id=44266>`__." |
3382 | 3386 | msgstr "" |
3383 | 3387 |
|
3384 | | -#: ../source/guides/packaging-binary-extensions.rst:268 |
| 3388 | +#: ../source/guides/packaging-binary-extensions.rst:276 |
3385 | 3389 | msgid "Use (a recent version of) setuptools in your setup.py (pip will do this for you, in any case)." |
3386 | 3390 | msgstr "" |
3387 | 3391 |
|
3388 | | -#: ../source/guides/packaging-binary-extensions.rst:270 |
3389 | | -#: ../source/guides/packaging-binary-extensions.rst:280 |
3390 | | -#: ../source/guides/packaging-binary-extensions.rst:287 |
| 3392 | +#: ../source/guides/packaging-binary-extensions.rst:278 |
| 3393 | +#: ../source/guides/packaging-binary-extensions.rst:288 |
| 3394 | +#: ../source/guides/packaging-binary-extensions.rst:295 |
3391 | 3395 | msgid "Done." |
3392 | 3396 | msgstr "" |
3393 | 3397 |
|
3394 | | -#: ../source/guides/packaging-binary-extensions.rst:272 |
| 3398 | +#: ../source/guides/packaging-binary-extensions.rst:280 |
3395 | 3399 | msgid "For Python 3.4" |
3396 | 3400 | msgstr "" |
3397 | 3401 |
|
3398 | | -#: ../source/guides/packaging-binary-extensions.rst:274 |
| 3402 | +#: ../source/guides/packaging-binary-extensions.rst:282 |
3399 | 3403 | msgid "Install \"Windows SDK for Windows 7 and .NET Framework 4\" (v7.1), which is available from `Microsoft's website <https://www.microsoft.com/en-gb/download/details.aspx?id=8279>`__." |
3400 | 3404 | msgstr "" |
3401 | 3405 |
|
3402 | | -#: ../source/guides/packaging-binary-extensions.rst:277 |
| 3406 | +#: ../source/guides/packaging-binary-extensions.rst:285 |
3403 | 3407 | msgid "Work from an SDK command prompt (with the environment variables set, and the SDK on PATH)." |
3404 | 3408 | msgstr "" |
3405 | 3409 |
|
3406 | | -#: ../source/guides/packaging-binary-extensions.rst:279 |
| 3410 | +#: ../source/guides/packaging-binary-extensions.rst:287 |
3407 | 3411 | msgid "Set DISTUTILS_USE_SDK=1" |
3408 | 3412 | msgstr "" |
3409 | 3413 |
|
3410 | | -#: ../source/guides/packaging-binary-extensions.rst:282 |
| 3414 | +#: ../source/guides/packaging-binary-extensions.rst:290 |
3411 | 3415 | msgid "For Python 3.5" |
3412 | 3416 | msgstr "" |
3413 | 3417 |
|
3414 | | -#: ../source/guides/packaging-binary-extensions.rst:284 |
| 3418 | +#: ../source/guides/packaging-binary-extensions.rst:292 |
3415 | 3419 | msgid "Install `Visual Studio 2015 Community Edition <https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx>`__ (or any later version, when these are released)." |
3416 | 3420 | msgstr "" |
3417 | 3421 |
|
3418 | | -#: ../source/guides/packaging-binary-extensions.rst:289 |
| 3422 | +#: ../source/guides/packaging-binary-extensions.rst:297 |
3419 | 3423 | msgid "Note that from Python 3.5 onwards, Visual Studio works in a backward compatible way, which means that any future version of Visual Studio will be able to build Python extensions for all Python versions from 3.5 onwards." |
3420 | 3424 | msgstr "" |
3421 | 3425 |
|
3422 | | -#: ../source/guides/packaging-binary-extensions.rst:293 |
| 3426 | +#: ../source/guides/packaging-binary-extensions.rst:301 |
3423 | 3427 | msgid "Building with the recommended compiler on Windows ensures that a compatible C library is used throughout the Python process." |
3424 | 3428 | msgstr "" |
3425 | 3429 |
|
3426 | | -#: ../source/guides/packaging-binary-extensions.rst:297 |
| 3430 | +#: ../source/guides/packaging-binary-extensions.rst:305 |
3427 | 3431 | msgid "Binary extensions for Linux" |
3428 | 3432 | msgstr "" |
3429 | 3433 |
|
3430 | | -#: ../source/guides/packaging-binary-extensions.rst:299 |
| 3434 | +#: ../source/guides/packaging-binary-extensions.rst:307 |
3431 | 3435 | msgid "Linux binaries must use a sufficiently old glibc to be compatible with older distributions. The `manylinux <https://github.com/pypa/manylinux>`_ Docker images provide a build environment with a glibc old enough to support most current Linux distributions on common architectures." |
3432 | 3436 | msgstr "" |
3433 | 3437 |
|
3434 | | -#: ../source/guides/packaging-binary-extensions.rst:305 |
| 3438 | +#: ../source/guides/packaging-binary-extensions.rst:313 |
3435 | 3439 | msgid "Binary extensions for macOS" |
3436 | 3440 | msgstr "" |
3437 | 3441 |
|
3438 | | -#: ../source/guides/packaging-binary-extensions.rst:307 |
| 3442 | +#: ../source/guides/packaging-binary-extensions.rst:315 |
3439 | 3443 | msgid "Binary compatibility on macOS is determined by the target minimum deployment system, e.g. *10.9*, which is often specified with the ``MACOSX_DEPLOYMENT_TARGET`` environmental variable when building binaries on macOS. When building with setuptools / distutils, the deployment target is specified with the flag ``--plat-name``, e.g. ``macosx-10.9-x86_64``. For common deployment targets for macOS Python distributions, see the `MacPython Spinning Wheels wiki <https://github.com/MacPython/wiki/wiki/Spinning-wheels>`_." |
3440 | 3444 | msgstr "" |
3441 | 3445 |
|
3442 | | -#: ../source/guides/packaging-binary-extensions.rst:317 |
| 3446 | +#: ../source/guides/packaging-binary-extensions.rst:325 |
3443 | 3447 | msgid "Publishing binary extensions" |
3444 | 3448 | msgstr "" |
3445 | 3449 |
|
3446 | | -#: ../source/guides/packaging-binary-extensions.rst:319 |
| 3450 | +#: ../source/guides/packaging-binary-extensions.rst:327 |
3447 | 3451 | msgid "For interim guidance on this topic, see the discussion in `this issue <https://github.com/pypa/python-packaging-user-guide/issues/284>`_." |
3448 | 3452 | msgstr "" |
3449 | 3453 |
|
3450 | | -#: ../source/guides/packaging-binary-extensions.rst:335 |
| 3454 | +#: ../source/guides/packaging-binary-extensions.rst:343 |
3451 | 3455 | msgid "Additional resources" |
3452 | 3456 | msgstr "" |
3453 | 3457 |
|
3454 | | -#: ../source/guides/packaging-binary-extensions.rst:337 |
| 3458 | +#: ../source/guides/packaging-binary-extensions.rst:345 |
3455 | 3459 | msgid "Cross-platform development and distribution of extension modules is a complex topic, so this guide focuses primarily on providing pointers to various tools that automate dealing with the underlying technical challenges. The additional resources in this section are instead intended for developers looking to understand more about the underlying binary interfaces that those systems rely on at runtime." |
3456 | 3460 | msgstr "" |
3457 | 3461 |
|
3458 | | -#: ../source/guides/packaging-binary-extensions.rst:344 |
| 3462 | +#: ../source/guides/packaging-binary-extensions.rst:352 |
3459 | 3463 | msgid "Cross-platform wheel generation with scikit-build" |
3460 | 3464 | msgstr "" |
3461 | 3465 |
|
3462 | | -#: ../source/guides/packaging-binary-extensions.rst:346 |
| 3466 | +#: ../source/guides/packaging-binary-extensions.rst:354 |
3463 | 3467 | msgid "The `scikit-build <https://scikit-build.readthedocs.io/en/latest/>`_ package helps abstract cross-platform build operations and provides additional capabilities when creating binary extension packages. Additional documentation is also available on the `C runtime, compiler, and build system generator <https://scikit-build.readthedocs.io/en/latest/generators.html>`_ for Python binary extension modules." |
3464 | 3468 | msgstr "" |
3465 | 3469 |
|
3466 | | -#: ../source/guides/packaging-binary-extensions.rst:354 |
| 3470 | +#: ../source/guides/packaging-binary-extensions.rst:362 |
3467 | 3471 | msgid "Introduction to C/C++ extension modules" |
3468 | 3472 | msgstr "" |
3469 | 3473 |
|
3470 | | -#: ../source/guides/packaging-binary-extensions.rst:356 |
| 3474 | +#: ../source/guides/packaging-binary-extensions.rst:364 |
3471 | 3475 | msgid "For a more in depth explanation of how extension modules are used by CPython on a Debian system, see the following articles:" |
3472 | 3476 | msgstr "" |
3473 | 3477 |
|
3474 | | -#: ../source/guides/packaging-binary-extensions.rst:359 |
| 3478 | +#: ../source/guides/packaging-binary-extensions.rst:367 |
3475 | 3479 | msgid "`What are (c)python extension modules? <https://thomasnyberg.com/what_are_extension_modules.html>`_" |
3476 | 3480 | msgstr "" |
3477 | 3481 |
|
3478 | | -#: ../source/guides/packaging-binary-extensions.rst:360 |
| 3482 | +#: ../source/guides/packaging-binary-extensions.rst:368 |
3479 | 3483 | msgid "`Releasing the gil <https://thomasnyberg.com/releasing_the_gil.html>`_" |
3480 | 3484 | msgstr "" |
3481 | 3485 |
|
3482 | | -#: ../source/guides/packaging-binary-extensions.rst:361 |
| 3486 | +#: ../source/guides/packaging-binary-extensions.rst:369 |
3483 | 3487 | msgid "`Writing cpython extension modules using C++ <https://thomasnyberg.com/cpp_extension_modules.html>`_" |
3484 | 3488 | msgstr "" |
3485 | 3489 |
|
|
0 commit comments