From 27e4bd5b81e320c64be482270a1f8185f080fbe7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 Nov 2015 07:25:27 +0530 Subject: [PATCH] Simplify the main() function --- setup/linux-installer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/linux-installer.py b/setup/linux-installer.py index fe1b2a9cf2..c55bd57da1 100644 --- a/setup/linux-installer.py +++ b/setup/linux-installer.py @@ -639,7 +639,7 @@ def check_version(): if calibre_version == '%version': calibre_version = urllib.urlopen('http://code.calibre-ebook.com/latest').read() -def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None): +def run_installer(install_dir, isolated, bin_dir, share_dir): destdir = os.path.abspath(os.path.expanduser(install_dir or '/opt')) if destdir == '/usr/bin': prints(destdir, 'is not a valid install location. Choose', end='') @@ -666,6 +666,9 @@ def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None): prints('Run "%s/calibre" to start calibre' % destdir) return 0 +def main(install_dir=None, isolated=False, bin_dir=None, share_dir=None): + run_installer(install_dir, isolated, bin_dir, share_dir) + try: __file__ from_file = True