mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Add an import preference for vendored packages
Prefer importing packages from ./dangerzone/vendor, if there is one there, instead of using the system ones.
This commit is contained in:
parent
266d6c70a7
commit
91fbc466c5
1 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,19 @@
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
try:
|
||||
from . import vendor # type: ignore [attr-defined]
|
||||
|
||||
vendor_path: str = vendor.__path__[0]
|
||||
logger.debug(f"Using vendored PyMuPDF libraries from '{vendor_path}'")
|
||||
sys.path.insert(0, vendor_path)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if "DANGERZONE_MODE" in os.environ:
|
||||
mode = os.environ["DANGERZONE_MODE"]
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue