[Distutils] distutils.util.get_platform() - Linux vs Windows

samuel.ferencik at barclays.com samuel.ferencik at barclays.com
Thu Aug 22 12:27:52 CEST 2013

> -----Original Message-----
> From: Ronald Oussoren [mailto:ronaldoussoren at mac.com] 
> Sent: Thursday, August 22, 2013 12:21 PM
> To: Ferencik, Samuel: Markets (PRG)
> Cc: chris.barker at noaa.gov; distutils-sig at python.org
> Subject: Re: [Distutils] distutils.util.get_platform() - Linux vs Windows
> On 20 Aug, 2013, at 18:00, samuel.ferencik at barclays.com wrote:
>>> -----Original Message-----
>>> From: Chris Barker - NOAA Federal [mailto:chris.barker at noaa.gov] 
>>> Sent: Tuesday, August 20, 2013 5:47 PM
>>> To: Ferencik, Samuel: Markets (PRG)
>>> Cc: distutils-sig at python.org
>>> Subject: Re: [Distutils] distutils.util.get_platform() - Linux vs Windows
>>> On Mon, Aug 19, 2013 at 11:15 PM,  <samuel.ferencik at barclays.com> wrote:
>>>> What does your 'uname -m' return?
>>> x86_64
>>>> Is it possible you're really running a 32-bit
>>>> Python on a *32-bit* OS X kernel? [http://superuser.com/q/161195]
>>> nope -- I am quite deliberately running a 32 bit Python on my 64 bit
>>> OS (I have some custom code C++ I"m using that is not yet 64 bit
>>> safe).
>> That's strange. I'm on Python 3.3.1, and it seems to me that get_platform()
>> derives the value from uname for OS X, similar to Linux.
>>    (osname, host, release, version, machine) = os.uname()
>>    ...
>>    elif osname[:6] == "darwin":
>>        import _osx_support, distutils.sysconfig
>>        osname, release, machine = _osx_support.get_platform_osx(
>>                                        distutils.sysconfig.get_config_vars(),
>>                                        osname, release, machine)
>>    return "%s-%s-%s" % (osname, release, machine)
>> so I would expect "uname -m" to be in line with get_plaform(). But maybe I'm
>> misreading that... Also, I don't have access to the _osx_support source code.
> _osx_support is a pure python module in the stdlib, the source is in the usual 
> location.

Of course it is. I don't know where I was looking.

Basically, get_platform_osx() overrides the value of 'machine' passed in. So in
distutils.util.get_platform() it looks like it's doing a similar thing as for
Linux (uname) but it then throws it away and lets
_osx_support.get_platform_osx() do its own thing.

> The behavior on OSX is quite intentional and ensures that disutils binary archive
> names correctly reflect the use of fat binaries and the minimal supported OSX release.
> The only thing that might need change is the name of the supported architectures,
> the wheel spec has a better way to indicate multiple executable architectures than
> making up names for every set of architectures that we care to support, but to be
> honest I haven't had time yet to fully ingest the spec and work out if is completely
> useful for fat binaries on OSX.
>>>> return value is wrong on Linux and correct on
>>>> Windows, right?
>>> no -- I'm saying that it's right on Windows (and OS-X), but wrong on Linux.
>> I think you have misread my sentence, and we actually agree here.
>> What's the next action? Report a Python bug? (That's a cultural question; I'm
>> new to Python.)
> http://bugs.python.org/

Thanks, I'll report one.


This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.


More information about the Distutils-SIG mailing list