[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

Michael Felt report at bugs.python.org
Mon Oct 31 16:34:26 EDT 2016


Michael Felt added the comment:

FYI: This is 'actual' as I am working on an implementation of a cloud-init distro for AIX and it is very difficult to figure out the correct approach for a replacement value for os.uname[4] - when comparing with "Linux" logic

I was thinking of using

platform.platform().split("-")[3]

but both are 32-bit on 64-bit hardware:

>>> platform.platform().split("-")
['AIX', '1', '00C291F54C00', 'powerpc', '32bit']
>>> platform.platform().split("-")[4]
'32bit'
>>> platform.platform().split("-")[3]
'powerpc'

>>> platform.platform().split("-")
['Linux', '3.2.0', '4', 'powerpc64', 'ppc64', 'with', 'debian', '7.8']
>>> platform.platform().split("-")[4]
'ppc64'
>>> platform.platform().split("-")[3]
'powerpc64'

This - also - seems tricky re: the placement of the -
>>> platform.platform()
'Linux-3.2.0-4-powerpc64-ppc64-with-debian-7.8'

compared with:
>>> platform.platform()
'AIX-1-00C291F54C00-powerpc-32bit'

Truely, some guidance from "the powers that be" is needed if there is ever to be uniformity. And if it 'cannot' be patched on 'old' versions, at least there will be a way to hack clarity into code (imho, a patch is better rather than hacks creating continued diversity - everyone continues to use their understanding of intent, creating new diverse wishes (aka features not benefits)) for what the code "must" do - because there are so many projects that used it this way (and others that used it that way) ....

:)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18987>
_______________________________________


More information about the Python-bugs-list mailing list