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

samuel.ferencik at barclays.com samuel.ferencik at barclays.com
Tue Aug 20 18:00:48 CEST 2013

> -----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(
                                        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.

>> 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.)


>> That get_platform() should return "32-bit" for a 32-bit process
>> running on a 64-bit system.
> yes, it should.
>> TBH, I was expecting the opposite; to me, "platform"
>> means the OS, which would mean that Linux does well to derive the return value
>> from the OS's architecture.
> except what would be the utility of that? this is a call made within
> python, and it's part of distutils, so what the caller wants to know
> is the platform that this particular python was build for, NOT the
> platform is happens to be running on. i.e. what platform do I want to
> build binary extensions for, and/or what platform do I want to
> download binary wheels for.
> So I'm pretty sure that currently Windows and OS-X have it right, and
> Linux is broken. I'm guessing running 32 bit python on a 64 bit LInux
> is not that common, however. (and it's less common to download
> binaries...)
> To add complexity, if I run  the Apple-supplied python2.7.1 (which is
> 32_64 bit universal, but runs 64 bit on my machine), I get:
> >>> distutils.util.get_platform()
> 'macosx-10.7-intel'
> Which is more useful than it may look at first -- "intel" means "both
> intel platforms", i.e. i386 and x86_64. and 10.7 means -- built for
> OS-X 10.7 and above.
> so I think it's doing the right thing.
> -Chris


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