Message137891
Yes, you should check the Mac OS X version at runtime (as you should check the Linux kernel at runtime). platform.mac_ver() uses something like:
sysv = _gestalt.gestalt('sysv')
if sysv:
major = (sysv & 0xFF00) >> 8
minor = (sysv & 0x00F0) >> 4
patch = (sysv & 0x000F)
Note: patch is not reliable with 'sysv', you have to use ('sys1','sys2','sys3').
So if you would like to check that you have Mac OS 10.7 or later, you can do something like:
sysv = _gestalt.gestalt('sysv')
__MAC_10_7 = (sysv and (sysv >> 4) >= 0x0a7)
In C, it should be something like:
-------
const OSType SYSV = 0x73797376U; /* 'sysv' in big endian */
SInt32 response;
OSErr iErr;
iErr = Gestalt(SYSV, &response);
if (iErr == 0 && (response >> 4) >= 0x0a7)
/* have Mac OS >= 10.7 */
-------
I'm not sure of 0x73797376, I used hex(struct.unpack('!I', 'sysv')[0]). |
|
Date |
User |
Action |
Args |
2011-06-07 22:37:55 | vstinner | set | recipients:
+ vstinner, ixokai, pitrou, nadeem.vawda, ned.deily, skrah, neologix, sdaoden, python-dev |
2011-06-07 22:37:54 | vstinner | set | messageid: <1307486274.97.0.303163251011.issue11277@psf.upfronthosting.co.za> |
2011-06-07 22:37:54 | vstinner | link | issue11277 messages |
2011-06-07 22:37:54 | vstinner | create | |
|