PYTHON_EXT_SUFFIX value for shared libraries, pyc files and others

From: Michael Zhilin <mizhka_at_gmail.com>
Date: Tue, 10 Jan 2023 21:01:43 UTC
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.

For instance, port gobject-introspection contains pyc files like:

/usr/local/lib/gobject-introspection/giscanner/__pycache__/testcodegen.cpython-39.pyc
and shared library like:
   /usr/local/lib/gobject-introspection/giscanner/_giscanner.cpython-39d.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.

Any thoughts?

Thanks,
Michael.