[Distutils] Platform naming standardization

Nate Coraor nate at psu.edu
Tue Jan 12 19:08:09 CET 2010


I'm involved with a software project that makes extensive use of third 
party modules with C extensions.  To ease installation, we pre-build 
them for some popular platforms and provide a distribution system for 
the app to fetch them.

setuptools uses distutils.util.get_platform() to decide whether an egg 
found on the path is compatible, with some special extra magic added in 
for Mac OS X.  Unfortunately, get_platform() as implemented does not 
provide enough information to ensure binary compatibility.

Among the platforms we use, these are the issues:

1) On all platforms, interpreters compiled with UCS2 and UCS4 are binary 
incompatible, so modules compiled on one will fail to import on the 
other.  We work around this by appending -ucsX to the platform string, 
based on the value of sys.maxunicode.

2) On OS X, the modification to the value returned by 
pkg_resources.get_platform() isn't correct for fat version of Python 
2.5, as detailed in setuptools issue 19.  To solve that, we're using the 
patch I submitted to the issue (with a couple recent changes).

3) On Solaris (and likely other UNIXes where 32 and 64 bit user spaces 
coexist), no distinction is made between a 32 bit and 64 bit 
interpreter, and they are not binary compatible.  We work around this by 
checking sys.maxint, and right now in testing I'm appending -32 or -64 
to the platform string (but before -ucsX).  I haven't settled on this, 
though, since I have a feeling maybe it should be part of the arch 
(sun4u_32, i86pc_64, etc.) or something like 'solaris32' and 'solaris64' 
instead of 'solaris'.

4) Also on Solaris, the OS is binary compatible with older releases, so 
Solaris binary distributors will often build on the oldest reasonable 
release.  This is not possible with setuptools now, although extending 
pkg_resources.compatible_platforms() in pretty much the same manner as 
is done for OS X solves this (and I can provide a patch).

It's not even crucial to me that these be fixed, but before I continue 
to hack up the platform string, I wanted to ask the SIG to address these 
issues and hopefully decide on a standard.  That way, I can at least 
implement patches in my app that will be compatible with whatever (if 
anything) is decided.


More information about the Distutils-SIG mailing list