mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Simplify the main() function
This commit is contained in:
parent
bea78ce197
commit
27e4bd5b81
@ -639,7 +639,7 @@ def check_version():
|
|||||||
if calibre_version == '%version':
|
if calibre_version == '%version':
|
||||||
calibre_version = urllib.urlopen('http://code.calibre-ebook.com/latest').read()
|
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'))
|
destdir = os.path.abspath(os.path.expanduser(install_dir or '/opt'))
|
||||||
if destdir == '/usr/bin':
|
if destdir == '/usr/bin':
|
||||||
prints(destdir, 'is not a valid install location. Choose', end='')
|
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)
|
prints('Run "%s/calibre" to start calibre' % destdir)
|
||||||
return 0
|
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:
|
try:
|
||||||
__file__
|
__file__
|
||||||
from_file = True
|
from_file = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user