mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Linux installer: Useful error message if glibc is too old
This commit is contained in:
parent
bd63a4514f
commit
d92c5ccf87
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# vim:fileencoding=utf-8
|
# vim:fileencoding=utf-8
|
||||||
# License: GPLv3 Copyright: 2009, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2009, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -742,6 +742,24 @@ def check_umask():
|
|||||||
raise SystemExit('The system umask is unsuitable, aborting')
|
raise SystemExit('The system umask is unsuitable, aborting')
|
||||||
|
|
||||||
|
|
||||||
|
def check_glibc_version(min_required=(2, 31), release_date='2020-02-01'):
|
||||||
|
# See https://sourceware.org/glibc/wiki/Glibc%20Timeline
|
||||||
|
import ctypes
|
||||||
|
libc = ctypes.CDLL(None)
|
||||||
|
try:
|
||||||
|
f = libc.gnu_get_libc_version
|
||||||
|
except AttributeError:
|
||||||
|
raise SystemExit('Your system is not based on GNU libc. The calibre binaries require GNU libc')
|
||||||
|
f.restype = ctypes.c_char_p
|
||||||
|
ver = f().decode('ascii')
|
||||||
|
q = tuple(map(int, ver.split('.')))
|
||||||
|
if q < min_required:
|
||||||
|
raise SystemExit(
|
||||||
|
('Your system has GNU libc version {}. The calibre binaries require at least'
|
||||||
|
' version: {} (released on {}). Update your system.'
|
||||||
|
).format(ver, '.'.join(map(str, min_required)), release_date))
|
||||||
|
|
||||||
|
|
||||||
def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_umask=False, version=None):
|
def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_umask=False, version=None):
|
||||||
if not ignore_umask and not isolated:
|
if not ignore_umask and not isolated:
|
||||||
check_umask()
|
check_umask()
|
||||||
@ -751,6 +769,7 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_
|
|||||||
'You are running on an ARM system. The calibre binaries are only'
|
'You are running on an ARM system. The calibre binaries are only'
|
||||||
' available for x86 systems. You will have to compile from'
|
' available for x86 systems. You will have to compile from'
|
||||||
' source.')
|
' source.')
|
||||||
|
check_glibc_version()
|
||||||
run_installer(install_dir, isolated, bin_dir, share_dir, version)
|
run_installer(install_dir, isolated, bin_dir, share_dir, version)
|
||||||
|
|
||||||
|
|
||||||
|
@ -791,6 +791,24 @@ def check_umask():
|
|||||||
raise SystemExit('The system umask is unsuitable, aborting')
|
raise SystemExit('The system umask is unsuitable, aborting')
|
||||||
|
|
||||||
|
|
||||||
|
def check_glibc_version(min_required=(2, 31), release_date='2020-02-01'):
|
||||||
|
# See https://sourceware.org/glibc/wiki/Glibc%20Timeline
|
||||||
|
import ctypes
|
||||||
|
libc = ctypes.CDLL(None)
|
||||||
|
try:
|
||||||
|
f = libc.gnu_get_libc_version
|
||||||
|
except AttributeError:
|
||||||
|
raise SystemExit('Your system is not based on GNU libc. The calibre binaries require GNU libc')
|
||||||
|
f.restype = ctypes.c_char_p
|
||||||
|
ver = f().decode('ascii')
|
||||||
|
q = tuple(map(int, ver.split('.')))
|
||||||
|
if q < min_required:
|
||||||
|
raise SystemExit(
|
||||||
|
('Your system has GNU libc version {}. The calibre binaries require at least'
|
||||||
|
' version: {} (released on {}). Update your system.'
|
||||||
|
).format(ver, '.'.join(map(str, min_required)), release_date))
|
||||||
|
|
||||||
|
|
||||||
def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_umask=False, version=None):
|
def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_umask=False, version=None):
|
||||||
if not ignore_umask and not isolated:
|
if not ignore_umask and not isolated:
|
||||||
check_umask()
|
check_umask()
|
||||||
@ -800,6 +818,7 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_
|
|||||||
'You are running on an ARM system. The calibre binaries are only'
|
'You are running on an ARM system. The calibre binaries are only'
|
||||||
' available for x86 systems. You will have to compile from'
|
' available for x86 systems. You will have to compile from'
|
||||||
' source.')
|
' source.')
|
||||||
|
check_glibc_version()
|
||||||
run_installer(install_dir, isolated, bin_dir, share_dir, version)
|
run_installer(install_dir, isolated, bin_dir, share_dir, version)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user