[Distutils] Finishing PEP 345

Ned Deily nad at acm.org
Mon Jan 11 05:52:43 CET 2010

In article 
<3734. at syd-srv02.ezyreg.com>,
 "David Lyon" <david.lyon at preisshare.net> wrote:
>Ned Deily:
>>David Lyon:
>>> Obviously, some macs have intel processors and some don't. How would 
>>> developer reasonably be expected to know which are which? and what
>>> difference does it make?
>> In practice, this is seldom an issue on OS X as Pythons supplied by
>> python.org and Apple are supplied as multi-architecture executables,
>> i.e. the same file contains binaries for both 32-bit Intel and PPC 
>> and, in some cases, 64-bit Intel and 64-bit PPC as well.  The
>> Apple-supplied build tool chain, and some code in the Python build
>> scripts and Distutils, normally takes care of everything when building
>> Python C extensions modules with no user intervention needed.  So 
>> would almost never be a case where a platform.machine test would be
>> needed for OS X. 
> I understand what you are saying and maybe you are 100% correct when you
> are talking about the Apple platform.
> PEP-345 doesn't mention platform.machine.
> However, what you are now inferring is that there is no difference between
> Apples and Windows based PCs. I'm not sure that this this is true or not.

I don't understand what you mean by that.  I neither inferred nor meant 
to imply anything about Windows-based PCs at all.
> My point, is how can a windows user be expected to know all that?
> If 'i386' means all Apple and all Windows, then that needs to be clarified.

It states in PEP 345 that "the OS and CPU for which the binary 
distribution was compiled" is described in the Supported-Platform field.  
It also says that the semantic of that field are not specified by this 
PEP.  Presumably the value returned by distutils.get_platform() would be 
used for this field and would continue to be used as is current practice 
with setuptools/Distribute to qualify binary egg names, for instance.

BTW, I should have noted that Distutils has OS/CPU-specific rules for 
forming the platform name.  For OS X, it incorporates the minimum 
acceptable OS X level for the Python instance and extensions built with 
and for it (the "OS X deployment target", essentially an ABI level) and 
a meta machine type encoding the various architectures included in a 
multi-architecture executable.  A typical example:

>>> from distutils.util import get_platform
>>> get_platform()

in this case, deployment target of OS X 10.3 or higher and "fat" is 
defined to mean 32-bit Intel and 32-bit PPC architectures are included.

It's also true, I think, that some, perhaps most, suppliers of 
distributions to PyPi no longer bother to supply binary distributions 
for OS X because there are so many variants and it is relatively 
painless to require their users to have installed the free but optional 
software development kit, Xcode, that Apple supplies with OS X releases.  
That lets Distutils take care of building C extensions with the proper 
gcc flags etc for the Python instance in use.

 Ned Deily,
 nad at acm.org

More information about the Distutils-SIG mailing list