As far as I know, there is no truly reliable way other than to examine the executable files themselves to see which architectures have been lipo
-ed together, in other words, what file
does. While the distutils.util.get_platform()
noted elsewhere probably comes the closest, it is based on configuration information at Python build time and the criteria used has changed between releases and even among distributions of the same release.
For example, if you built a Python 2.6 on OS X 10.6 with the 4-way universal option (ppc
, ppc64
, i386
, x86_64
), get_platform()
should report macosx-10.6-universal
. However, the Apple-suppled Python 2.6 in OS X 10.6 reports the same string even though it is only a 3-way build (no ppc64
). EDIT: That may not be the best example since, come to think of it, you probably couldn't build a ppc64
variant with the 10.6 SDK. However, the point still holds that the platform string is too context dependent to be totally reliable. It may be reliable enough for some needs, though. Otherwise, calling out to file
or otool
etc is likely the best way to go.