Use TESSDATA_PREFIX if explicitly passed

Our logic for detecting the appropriate Tesseract data directory should
also take into account the canonical envvar, if explicitly passed.
This commit is contained in:
Alex Pyrgiotis 2024-06-10 18:32:40 +03:00
parent 277b1675ca
commit cf9a545c1a
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -14,7 +14,9 @@ def running_on_qubes() -> bool:
def get_tessdata_dir() -> str:
if running_on_qubes():
if os.environ.get("TESSDATA_PREFIX"):
return os.environ["TESSDATA_PREFIX"]
elif running_on_qubes():
return "/usr/share/tesseract/tessdata/"
else:
return "/usr/share/tessdata/"