tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Python's SOABI tag vs PLISTs
Hi,
So I fell into a bit of a rabbit hole trying to fix PLIST issues in
some python extensions.
When a module does not use the "limited" ABI (abi3) it may install it's
module named according to EXTENSION_SUFFIXES[0] which leads to PLIST
problems.
>>> import importlib
# NetBSD
>>> importlib.machinery.EXTENSION_SUFFIXES
['.cpython-312.so', '.abi3.so', '.so']
# Linux (x86_64)
>>> importlib.machinery.EXTENSION_SUFFIXES
['.cpython-312-x86_64-linux-gnu.so', '.abi3.so', '.so']
# macOS
>>> importlib.machinery.EXTENSION_SUFFIXES
['.cpython-312-darwin.so', '.abi3.so', '.so']
As we can see, NetBSD does not encode the platform name or architecture
into the suffix. This is the pattern PLISTs are generally based on so
it breaks on other platforms.
EXTENSION_SUFFIXES[0] is in turn derived from SOABI ...
>>> sysconfig.get_config_var('SOABI')
'cpython-312-darwin'
... which is set by Python's configure script and is derived from
PLATFORM_TRIPLET. Due to a bug in the configure check for this triplet
it becomes an empty string on NetBSD. Everything still works
on NetBSD by coincidence but those PLISTs break everywhere else.
Linux:
| configure:6758: checking for the platform triplet based on compiler characteristics
| configure:6947: result: x86_64-linux-gnu
NetBSD:
| configure:6758: checking for the platform triplet based on compiler characteristics
| configure:6950: result: none
I can think of a couple of different ways to fix this problem.
1a: repair the configure check so NetBSD gets a triplet. The
consequence is we need to create a new platform mapping table like
MACHINE_GNU_PLATFORM under lang/python to handle PLIST substitutions.
1b: we also change the affected packages to use EXTENSION_SUFFIXES[2]
(".so") instead so all PLIST become cross-platform consistent and we
can drop the PYVERS from the filename. We're still in versioned
sitelib directories so the version suffix is not needed.
2: patch the configure check so all platforms have an empty triplet
like the NetBSD case. This changes nothing for NetBSD and we don't
need to change any packages.
Your thoughts and opinions are appreciated.
Kind regards,
-Tobias
Home |
Main Index |
Thread Index |
Old Index