PEP 3149: Resolve uses of the default role (#3401)

This commit is contained in:
Adam Turner 2023-09-01 20:27:45 +01:00 committed by GitHub
parent 96480c49e4
commit 76159afb05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 14 deletions

View File

@ -30,8 +30,8 @@ Background
:pep:`3147` defined the file system layout for a pure-Python package, :pep:`3147` defined the file system layout for a pure-Python package,
where multiple versions of Python are available on the system. For where multiple versions of Python are available on the system. For
example, where the `alpha` package containing source modules `one.py` example, where the ``alpha`` package containing source modules ``one.py``
and `two.py` exist on a system with Python 3.2 and 3.3, the post-byte and ``two.py`` exist on a system with Python 3.2 and 3.3, the post-byte
compilation file system layout would be:: compilation file system layout would be::
alpha/ alpha/
@ -69,18 +69,18 @@ with Python 2.6 being the default.
In order to share as much as possible between the available Python In order to share as much as possible between the available Python
versions, these distributions install third party package modules versions, these distributions install third party package modules
(``.pyc`` and ``.so`` files) into `/usr/share/pyshared` and symlink to (``.pyc`` and ``.so`` files) into ``/usr/share/pyshared`` and symlink to
them from `/usr/lib/pythonX.Y/dist-packages`. The symlinks exist them from ``/usr/lib/pythonX.Y/dist-packages``. The symlinks exist
because in a pre-:pep:`3147` world (i.e < Python 3.2), the `.pyc` files because in a pre-:pep:`3147` world (i.e < Python 3.2), the ``.pyc`` files
resulting from byte compilation by the various installed Pythons will resulting from byte compilation by the various installed Pythons will
name collide with each other. For Python versions >= 3.2, all name collide with each other. For Python versions >= 3.2, all
pure-Python packages can be shared, because the `.pyc` files will no pure-Python packages can be shared, because the ``.pyc`` files will no
longer cause file system naming conflicts. Eliminating these symlinks longer cause file system naming conflicts. Eliminating these symlinks
makes for a simpler, more robust Python distribution. makes for a simpler, more robust Python distribution.
A similar situation arises with shared library extensions. Because A similar situation arises with shared library extensions. Because
extension modules are typically named `foo.so` for a `foo` extension extension modules are typically named ``foo.so`` for a ``foo`` extension
module, these would also name collide if `foo` was provided for more module, these would also name collide if ``foo`` was provided for more
than one Python version. than one Python version.
In addition, because different configuration/compilation options for In addition, because different configuration/compilation options for
@ -93,7 +93,7 @@ module files.
PyPy [5]_ can also benefit from this PEP, allowing it to avoid name PyPy [5]_ can also benefit from this PEP, allowing it to avoid name
collisions in extension modules built for its API, but with a collisions in extension modules built for its API, but with a
different `.so` tag. different ``.so`` tag.
Proposal Proposal
@ -139,7 +139,7 @@ Note that ``$SOABI`` contains just the tag, while ``$EXT_SUFFIX`` includes the
platform extension for shared library files, and is the exact suffix platform extension for shared library files, and is the exact suffix
added to the extension module name. added to the extension module name.
For an arbitrary package `foo`, you might see these files when the For an arbitrary package ``foo``, you might see these files when the
distribution package was installed:: distribution package was installed::
/usr/lib/python/foo.cpython-32m.so /usr/lib/python/foo.cpython-32m.so
@ -159,7 +159,7 @@ This shared library tag would be used globally for all distutils-based
extension modules, regardless of where on the file system they are extension modules, regardless of where on the file system they are
built. Extension modules built by means other than distutils would built. Extension modules built by means other than distutils would
either have to calculate the tag manually, or fallback to the either have to calculate the tag manually, or fallback to the
non-tagged `.so` file name. non-tagged ``.so`` file name.
Proven approach Proven approach
@ -170,7 +170,7 @@ and Ubuntu system where different extensions are used for debug builds
of Python and extension modules. Debug builds on Windows also already of Python and extension modules. Debug builds on Windows also already
use a different file extension for dynamic libraries, and in fact use a different file extension for dynamic libraries, and in fact
encoded (in a different way than proposed in this PEP) the Python encoded (in a different way than proposed in this PEP) the Python
major and minor version in the `.dll` file name. major and minor version in the ``.dll`` file name.
Windows Windows
@ -207,7 +207,7 @@ its name. The prefix ``abi`` is reserved for Python's use.
Thus, an initial implementation of :pep:`384`, when Python is configured Thus, an initial implementation of :pep:`384`, when Python is configured
with the default set of flags, would search for the following file with the default set of flags, would search for the following file
names when extension module `foo` is imported (in this order):: names when extension module ``foo`` is imported (in this order)::
foo.cpython-XYm.so foo.cpython-XYm.so
foo.abi3.so foo.abi3.so
@ -271,7 +271,7 @@ If a pure-Python package is shared in one version, should it suddenly
be not-shared if the next release adds an extension module for speed? be not-shared if the next release adds an extension module for speed?
Also, even though all extension shared libraries will be compiled and Also, even though all extension shared libraries will be compiled and
distributed once for every supported Python, there's a big difference distributed once for every supported Python, there's a big difference
between duplicating the `.so` files and duplicating all `.py` files. between duplicating the ``.so`` files and duplicating all ``.py`` files.
The extra size increases the download time for such packages, and more The extra size increases the download time for such packages, and more
immediately, increases the space pressures on already constrained immediately, increases the space pressures on already constrained
distribution CD-ROMs. distribution CD-ROMs.