For a couple projects I’m working on, I need to be able to identify binary extension files and extract the names of the modules they provide.
importlib.machinery.EXTENSION_SUFFIXES only gives me what I need for the current Python and the machine it’s running on, whereas I need to work with extension files for any Python. There doesn’t seem to be a library for this already, so I’ve had to investigate this on my own, and I’ve come to you to double-check my findings.
What I’ve determined so far:
Linux/manylinux binary extension modules have names of the form
gnupart vary, or is that attached to
macOS binary extension modules have names of the form
Windows binary extension modules have names of the form
win32(or other values?). Example:
Certain Linux & macOS extension modules (ones built for Python 2?) have names simply of the form
Is there anything important I’ve missed? Would
r'(?:\.[-A-Za-z0-9_]+\.(?:pyd|so)|\.so)\Z' be an appropriate regex for matching any & all binary extension module file extensions?