calibre-debug: support execution of a directory containing a __main__.py file

This commit is contained in:
Kovid Goyal 2014-10-17 12:50:08 +05:30
parent bf5c3f9be1
commit 048c26fdce

View File

@ -278,6 +278,9 @@ def main(args=sys.argv):
inspect_mobi(path)
else:
print ('Cannot dump unknown filetype: %s' % path)
elif len(args) >= 2 and os.path.exists(os.path.join(args[1], '__main__.py')):
sys.path.insert(0, args[1])
run_script(os.path.join(args[1], '__main__.py'), args[2:])
else:
from calibre import ipython
ipython()