mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add function to get OS X version
This commit is contained in:
parent
9262ceea75
commit
bfe4f5c8b1
@ -44,6 +44,19 @@ winerror = importlib.import_module('winerror') if iswindows else None
|
||||
win32api = importlib.import_module('win32api') if iswindows else None
|
||||
fcntl = None if iswindows else importlib.import_module('fcntl')
|
||||
|
||||
_osx_ver = None
|
||||
def get_osx_version():
|
||||
global _osx_ver
|
||||
if _osx_ver is None:
|
||||
import platform
|
||||
from collections import namedtuple
|
||||
OSX = namedtuple('OSX', 'major minor tertiary')
|
||||
try:
|
||||
_osx_ver = OSX(*(map(int, platform.mac_ver()[0].split('.'))))
|
||||
except:
|
||||
_osx_ver = OSX(0, 0, 0)
|
||||
return _osx_ver
|
||||
|
||||
filesystem_encoding = sys.getfilesystemencoding()
|
||||
if filesystem_encoding is None: filesystem_encoding = 'utf-8'
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user