From 954cb38135ce0db6f4ae9174ba7bc028753f996b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Jul 2022 16:09:50 +0530 Subject: [PATCH] Linux installer: Fix glibc version check also being done when installing older versions --- setup/linux-installer.py | 15 ++++++++------- setup/linux-installer.sh | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/setup/linux-installer.py b/setup/linux-installer.py index f1eb28f023..04ec818c5a 100644 --- a/setup/linux-installer.py +++ b/setup/linux-installer.py @@ -681,12 +681,6 @@ def download_and_extract(destdir, version): extract_tarball(raw, destdir) -def check_version(): - global calibre_version - if calibre_version == '%version': - calibre_version = urlopen('http://code.calibre-ebook.com/latest').read() - - def run_installer(install_dir, isolated, bin_dir, share_dir, version): destdir = os.path.abspath(os.path.expanduser(install_dir or '/opt')) if destdir == '/usr/bin': @@ -774,7 +768,14 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_ 'You are running on a 32-bit system. The calibre binaries are only' ' available for 64-bit systems. You will have to compile from' ' source.') - check_glibc_version() + glibc_versions = { + (6, 0, 0) : {'min_required': (2, 31), 'release_date': '2020-02-01'} + } + q = tuple(map(int, version.split('.'))) if version else (999999999999, 99, 99) + for key in sorted(glibc_versions, reverse=True): + if q >= key: + check_glibc_version(**glibc_versions[key]) + break run_installer(install_dir, isolated, bin_dir, share_dir, version) diff --git a/setup/linux-installer.sh b/setup/linux-installer.sh index 9ae58b7f5c..09a4c74dae 100644 --- a/setup/linux-installer.sh +++ b/setup/linux-installer.sh @@ -730,12 +730,6 @@ def download_and_extract(destdir, version): extract_tarball(raw, destdir) -def check_version(): - global calibre_version - if calibre_version == '%version': - calibre_version = urlopen('http://code.calibre-ebook.com/latest').read() - - def run_installer(install_dir, isolated, bin_dir, share_dir, version): destdir = os.path.abspath(os.path.expanduser(install_dir or '/opt')) if destdir == '/usr/bin': @@ -823,7 +817,14 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None, ignore_ 'You are running on a 32-bit system. The calibre binaries are only' ' available for 64-bit systems. You will have to compile from' ' source.') - check_glibc_version() + glibc_versions = { + (6, 0, 0) : {'min_required': (2, 31), 'release_date': '2020-02-01'} + } + q = tuple(map(int, version.split('.'))) if version else (999999999999, 99, 99) + for key in sorted(glibc_versions, reverse=True): + if q >= key: + check_glibc_version(**glibc_versions[key]) + break run_installer(install_dir, isolated, bin_dir, share_dir, version)