A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Added checks for expected binaries in the PATH
Daniel Quinn75884285cf7d
diff --git a/src/paperless/__init__.py b/src/paperless/__init__.pyindex c8c4b305b..0789cc963 100644--- a/src/paperless/__init__.py+++ b/src/paperless/__init__.py@@ -1 +1 @@-from .checks import paths_check+from .checks import paths_check, binaries_checkdiff --git a/src/paperless/checks.py b/src/paperless/checks.pyindex a85d94e0b..f57a838bb 100644--- a/src/paperless/checks.py+++ b/src/paperless/checks.py@@ -1,10 +1,15 @@import os+import shutil+from django.conf import settingsfrom django.core.checks import Error, register, Warning@register()def paths_check(app_configs, **kwargs):+ """+ Check the various paths for existence, readability and writeability+ """check_messages = []@@ -45,3 +50,23 @@ def paths_check(app_configs, **kwargs):))return check_messages+++@register()+def binaries_check(app_configs, **kwargs):+ """+ Paperless requires the existence of a few binaries, so we do some checks+ for those here.+ """++ error = "Paperless can't find {}. Without it, consumption is impossible."+ hint = "Either it's not in your ${PATH} or it's not installed."++ binaries = (settings.CONVERT_BINARY, settings.UNPAPER_BINARY, "tesseract")++ check_messages = []+ for binary in binaries:+ if shutil.which(binary) is None:+ check_messages.append(Warning(error.format(binary), hint))++ return check_messages