Multiple apps: Default binary path by platform
Use Python's platform library to detect the operating system and use different default paths for the binary dependencies. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
8
mayan/apps/document_parsing/literals.py
Normal file
8
mayan/apps/document_parsing/literals.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import platform
|
||||
|
||||
if platform.system() == 'OpenBSD':
|
||||
DEFAULT_PDFTOTEXT_PATH = '/usr/local/bin/pdftotext'
|
||||
else:
|
||||
DEFAULT_PDFTOTEXT_PATH = '/usr/bin/pdftotext'
|
||||
@@ -4,6 +4,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings import Namespace
|
||||
|
||||
from .literals import DEFAULT_PDFTOTEXT_PATH
|
||||
|
||||
namespace = Namespace(name='document_parsing', label=_('Document parsing'))
|
||||
|
||||
setting_auto_parsing = namespace.add_setting(
|
||||
@@ -14,7 +16,7 @@ setting_auto_parsing = namespace.add_setting(
|
||||
)
|
||||
setting_pdftotext_path = namespace.add_setting(
|
||||
global_name='DOCUMENT_PARSING_PDFTOTEXT_PATH',
|
||||
default='/usr/bin/pdftotext',
|
||||
default=DEFAULT_PDFTOTEXT_PATH,
|
||||
help_text=_(
|
||||
'File path to poppler\'s pdftotext program used to extract text '
|
||||
'from PDF files.'
|
||||
|
||||
Reference in New Issue
Block a user