osx - Finding the architectures that Python was built for, but from within Python itself -


Basically I am looking for a way to find the following, but without running the system commands from within Python: < / P>

  $ file `which python2.7` / library /.../2.7/bin/python2.7: 2 architecture with Mac-O universal binary / library /.../2.7/ Bin / python2.7 (for architecture i386): Mac-o Executable i386 / library /.../2.7/bin/python2.7 (x86_64 for architecture): Mac OS 64-bit executable x86_64  

Something like this:

  & gt; & Gt; & Gt; Get_mac_python_archs () ['i386', 'x86_64'] & gt; & Gt; & Gt;  

Possible?

As far as I know, in other words, the file Does not, in addition to checking executable files together to see the architecture, is not truly reliable. Although distutils.util.get_platform () comes somewhere nearby, it is based on the configuration information on the Python Build time and the criteria used to be used are between release and distribution of the same release Has changed between also.

For example, if you have a Python 2.6 with 4-way universal option ( PPC , ppc64 , i386) on OS X 10.6 Created , x86_64 ), get_platform () should report macosx-10.6-universal . However, Python 2.6, written by Apple in OS X 10.6, reports the same string, although this is not just a 3-way build (no ppc64 ). EDIT: This is not the best example, to think about it, maybe you could not build a ppc64 version with 10.6 SDK. However, this issue still believes that the platform string also depends entirely on being reliable. However it may be reliable for the requirement of some , however. Otherwise, calling for a file or otoli etc. is probably the best way.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -