Re: PYTHON_EXT_SUFFIX value for shared libraries, pyc files and others
Date: Wed, 11 Jan 2023 06:45:54 UTC
Michael Zhilin wrote:
> Hi,
>
> I have a problem with PYTHON_EXT_SUFFIX when I try to build ports
> (including python) with the option WITH_DEBUG.
>
> I want to build subset of ports with WITH_DEBUG by poudriere, but
> several python package builds have failed on phase "package" due to
> missing artifacts. The root cause of failure is that ports uses same
> macro PYTHON_EXT_SUFFIX for shared libraries and pyc files, but actual
> file names have different suffixes:
> - pyc files have the suffix ".cpython-39" as expected.
> - so files have the suffix ".cpython-39d".
>
> The "d" is ${PYTHON_ABIVER} and actual ABI flags of Python build.
> According to Python specifications, all pyc files must have a suffix
> without ABI flags. Shared libraries have suffixes with ABI flags, but I
> didn't find any spec about it.
>
PEP-3147 for byte compilation files (.pyc) and PEP-3149 for extension
module files (.so).
> The first idea came to me is to add an extra suffix PYTHON_EXTSO_SUFFIX
> with value ".cpython-${PYTHON_SUFFIX}${PYTHON_ABIVER}". It's easy to add
> it and replace all occurrences in pkg-plist and Makefile, but it may be
> hard to maintain it in future.
>
Looks like some unfinished business from PR 252057. In theory, should be
able to append ${PYTHON_ABIVER} directly to ${PYTHON_EXT_SUFFIX}, since
${PYTHON_CMD}-config --abiflags returns the correct flags even if empty.
Because the ABI changes when you build Python itself under
--with-pydebug (WITH_DEBUG or DEBUG option), you cannot build only a
subset of Python ports under WITH_DEBUG; it's an all-or-nothing situation.
Byte compilation files are not compiled or installed when the port is
built under PEP-517. Compiling and installing byte compilation files
with distutils/setuptools at build/stage-time will be deprecated. A new
install-time hook is under development to replace this functionality,
which has the added benefit of less pkg-plist churn and framework
maintenance.
--
Charlie Li
…nope, still don't have an exit line.