[Distutils] Binary Wheels and "universal" builds on OS-X

Ronald Oussoren ronaldoussoren at mac.com
Tue Jun 4 18:55:06 CEST 2013


On 4 Jun, 2013, at 18:35, Chris Barker - NOAA Federal <chris.barker at noaa.gov> wrote:

> On Mon, Jun 3, 2013 at 3:47 PM, Daniel Holth <dholth at gmail.com> wrote:
> 
>> That would make sense. Can you come up with code to detect that a
>> newly compiled extension is universal, and that a Python is?
> 
> It looks like distutils.util.get_platform() now does the right thing
> for knowing what the currently running pyton is (see Ronald's message)

Correct. Barring installation errors, such as with some older releases of OSX, distutils.util.get_platform() already returns the correct information (both the supported architectures and the deployment target). 
> 
> For determining the status of a newly compiled extension, I usually
> simple run the "file" command line utility on it:
> 
> $ file python
> python: Mach-O universal binary with 2 architectures
> python (for architecture ppc):	Mach-O executable ppc
> python (for architecture i386):	Mach-O executable i386
> 
> (works for *.so, too...)
> 
> that could easily be parsed out, but we would still want to know the
> deployment target, which maybe you could get by parsing otool output:
> 
> $ otool -L python
> python (architecture ppc):
> 	/Library/Frameworks/Python.framework/Versions/2.7/Python
> (compatibility version 2.7.0, current version 2.7.0)
> 	/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 88.3.10)
> python (architecture i386):
> 	/Library/Frameworks/Python.framework/Versions/2.7/Python
> (compatibility version 2.7.0, current version 2.7.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 88.3.10)
> 
> (compatibility version of libSystem???)
> 
> But I imagine there is a cleaner way -- Ronald??

The output of 'otool -l' lists (amongst others) the value of LC_VERSION_MIN_MACOSX which is the deployment target.

Both can also be found using macholib ;-)

Ronald




More information about the Distutils-SIG mailing list