mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2026-03-20 04:58:56 +00:00
Bugfixes in standalone code for Calibre < 5 / Python 2
This commit is contained in:
14
DeDRM_plugin/__calibre_compat_code.py
Normal file
14
DeDRM_plugin/__calibre_compat_code.py
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#@@CALIBRE_COMPAT_CODE_START@@
|
||||
import sys, os
|
||||
|
||||
# Explicitly allow importing the parent folder
|
||||
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__))))
|
||||
|
||||
# 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"))
|
||||
#@@CALIBRE_COMPAT_CODE_END@@
|
||||
Reference in New Issue
Block a user