mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Allow importing calibre_plugins in the interactive debug shell
This commit is contained in:
parent
8ccd911822
commit
23e2dbae65
@ -230,12 +230,15 @@ def run_debug_gui(logpath):
|
|||||||
calibre(['__CALIBRE_GUI_DEBUG__', logpath])
|
calibre(['__CALIBRE_GUI_DEBUG__', logpath])
|
||||||
|
|
||||||
|
|
||||||
def run_script(path, args):
|
def load_user_plugins():
|
||||||
# Load all user defined plugins so the script can import from the
|
# Load all user defined plugins so the script can import from the
|
||||||
# calibre_plugins namespace
|
# calibre_plugins namespace
|
||||||
import calibre.customize.ui as dummy
|
import calibre.customize.ui as dummy
|
||||||
dummy
|
return dummy
|
||||||
|
|
||||||
|
|
||||||
|
def run_script(path, args):
|
||||||
|
load_user_plugins()
|
||||||
sys.argv = [path] + args
|
sys.argv = [path] + args
|
||||||
ef = os.path.abspath(path)
|
ef = os.path.abspath(path)
|
||||||
if '/src/calibre/' not in ef.replace(os.pathsep, '/'):
|
if '/src/calibre/' not in ef.replace(os.pathsep, '/'):
|
||||||
@ -347,6 +350,7 @@ def main(args=sys.argv):
|
|||||||
sys.path.insert(0, args[1])
|
sys.path.insert(0, args[1])
|
||||||
run_script(os.path.join(args[1], '__main__.py'), args[2:])
|
run_script(os.path.join(args[1], '__main__.py'), args[2:])
|
||||||
else:
|
else:
|
||||||
|
load_user_plugins()
|
||||||
from calibre import ipython
|
from calibre import ipython
|
||||||
ipython()
|
ipython()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user