[Distutils] Explicitly constructing SOABI for Python 2.7

Nick Coghlan ncoghlan at gmail.com
Tue Jan 28 11:40:31 CET 2014


Currently, bdist_wheel doesn't set the ABI tag properly on Python 2.x
- the SOABI symbol it expects to find isn't present. PEP 425 also
disclaims dealing with the problem.

However, PEP 3149 (which defined SOABI) explains how to define that
based on 3 other syconfig flags: Py_DEBUG, Py_UNICODE_SIZE and
WITH_PYMALLOC

>>> sysconfig.get_config_var("SOABI")
>>> sysconfig.get_config_var("Py_DEBUG")
0
>>> sysconfig.get_config_var("Py_UNICODE_SIZE")
4
>>> sysconfig.get_config_var("WITH_PYMALLOC")
1

With those settings and the platform module (to get the current
implementation), it is possible to figure out that the wheel ABI tag
should be:

    cp27mu

If Py_DEBUG was true, then it would be "cp27dmu"
If WITH_PYMALLOC was false for some reason: "cp27u"
And for a narrow Unicode build: "cp27m"

That way, the ABI tagging would work properly in 2.x as well, rather
than people getting the impression that wheels can't mark the ABI
compatibility requirements properly.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list