This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ixokai, nadeem.vawda, ned.deily, neologix, pitrou, python-dev, sdaoden, skrah, vstinner
Date 2011-06-07.22:37:54
SpamBayes Score 0.0022036612
Marked as misclassified No
Message-id <1307486274.97.0.303163251011.issue11277@psf.upfronthosting.co.za>
In-reply-to
Content
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]).
History
Date User Action Args
2011-06-07 22:37:55vstinnersetrecipients: + vstinner, ixokai, pitrou, nadeem.vawda, ned.deily, skrah, neologix, sdaoden, python-dev
2011-06-07 22:37:54vstinnersetmessageid: <1307486274.97.0.303163251011.issue11277@psf.upfronthosting.co.za>
2011-06-07 22:37:54vstinnerlinkissue11277 messages
2011-06-07 22:37:54vstinnercreate