Simplify the main() function

This commit is contained in:
Kovid Goyal 2015-11-22 07:25:27 +05:30
parent bea78ce197
commit 27e4bd5b81

View File

@ -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