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.

作者 vstinner
收信人 ixokai, nadeem.vawda, ned.deily, neologix, pitrou, python-dev, sdaoden, skrah, vstinner
日期 2011-06-07.22:37:54
SpamBayes Score 0.0022036612
Marked as misclassified
Message-id <1307486274.97.0.303163251011.issue11277@psf.upfronthosting.co.za>
In-reply-to
内容
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]).
历史
日期 用户 动作 参数
2011-06-07 22:37:55vstinner修改recipients: + vstinner, ixokai, pitrou, nadeem.vawda, ned.deily, skrah, neologix, sdaoden, python-dev
2011-06-07 22:37:54vstinner修改messageid: <1307486274.97.0.303163251011.issue11277@psf.upfronthosting.co.za>
2011-06-07 22:37:54vstinner链接issue11277 messages
2011-06-07 22:37:54vstinner创建