mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
8b5fbe73b3
commit
e841b4c94d
@ -29,11 +29,21 @@ def renice(niceness):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def macos_viewer_bundle_path():
|
||||||
|
base = os.path.dirname(sys.executables_location)
|
||||||
|
return os.path.join(base, 'ebook-viewer.app/Contents/MacOS/')
|
||||||
|
|
||||||
|
|
||||||
def macos_edit_book_bundle_path():
|
def macos_edit_book_bundle_path():
|
||||||
base = os.path.dirname(sys.executables_location)
|
base = os.path.dirname(sys.executables_location)
|
||||||
return os.path.join(base, 'ebook-viewer.app/Contents/ebook-edit.app/Contents/MacOS/')
|
return os.path.join(base, 'ebook-viewer.app/Contents/ebook-edit.app/Contents/MacOS/')
|
||||||
|
|
||||||
|
|
||||||
|
def macos_headless_bundle_path():
|
||||||
|
base = os.path.dirname(sys.executables_location)
|
||||||
|
return os.path.join(base, 'ebook-viewer.app/Contents/ebook-edit.app/Contents/headless.app/Contents/MacOS/')
|
||||||
|
|
||||||
|
|
||||||
def exe_path(exe_name):
|
def exe_path(exe_name):
|
||||||
if hasattr(sys, 'running_from_setup'):
|
if hasattr(sys, 'running_from_setup'):
|
||||||
return [sys.executable, os.path.join(sys.setup_dir, 'run-calibre-worker.py')]
|
return [sys.executable, os.path.join(sys.setup_dir, 'run-calibre-worker.py')]
|
||||||
@ -74,16 +84,14 @@ class Worker:
|
|||||||
@property
|
@property
|
||||||
def executable(self):
|
def executable(self):
|
||||||
if ismacos and not hasattr(sys, 'running_from_setup'):
|
if ismacos and not hasattr(sys, 'running_from_setup'):
|
||||||
base = os.path.dirname(sys.executables_location)
|
return os.path.join(macos_headless_bundle_path(), self.exe_name)
|
||||||
return os.path.join(base, 'ebook-viewer.app/Contents/ebook-edit.app/Contents/headless.app/Contents/MacOS', self.exe_name)
|
|
||||||
return exe_path(self.exe_name)
|
return exe_path(self.exe_name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gui_executable(self):
|
def gui_executable(self):
|
||||||
if ismacos and not hasattr(sys, 'running_from_setup'):
|
if ismacos and not hasattr(sys, 'running_from_setup'):
|
||||||
if self.job_name == 'ebook-viewer':
|
if self.job_name == 'ebook-viewer':
|
||||||
base = os.path.dirname(sys.executables_location)
|
return os.path.join(macos_viewer_bundle_path(), self.exe_name)
|
||||||
return os.path.join(base, 'ebook-viewer.app/Contents/MacOS/', self.exe_name)
|
|
||||||
if self.job_name == 'ebook-edit':
|
if self.job_name == 'ebook-edit':
|
||||||
return os.path.join(macos_edit_book_bundle_path(), self.exe_name)
|
return os.path.join(macos_edit_book_bundle_path(), self.exe_name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user