More work on standalone version, fix plugin

This commit is contained in:
NoDRM
2022-01-01 14:09:56 +01:00
parent 5ace15e912
commit a275d5d819
11 changed files with 456 additions and 32 deletions

View File

@@ -2,13 +2,19 @@
#@@CALIBRE_COMPAT_CODE_START@@
import sys, os
# Explicitly allow importing the parent folder
# Explicitly allow importing everything ...
if os.path.dirname(os.path.dirname(os.path.abspath(__file__))) not in sys.path:
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if os.path.dirname(os.path.abspath(__file__)) not in sys.path:
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# Bugfix for Calibre < 5:
if "calibre" in sys.modules and sys.version_info[0] == 2:
from calibre.utils.config import config_dir
if os.path.join(config_dir, "plugins", "DeDRM.zip") not in sys.path:
sys.path.insert(0, os.path.join(config_dir, "plugins", "DeDRM.zip"))
# Explicitly set the package identifier so we are allowed to import stuff ...
#__package__ = "DeDRM_plugin"
#@@CALIBRE_COMPAT_CODE_END@@