Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this includes pdfjs-to-text in .env/bin so that it's available as an … #1822

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import string
import subprocess
import tempfile
from datetime import date, datetime
from functools import wraps

import martor.utils
from django.conf import settings
from django.utils.translation import get_language_from_request
from languages_plus.models import Language

Expand Down Expand Up @@ -46,7 +46,7 @@ def pdfjs_to_text(fname):
"""Extract text from fname using pdfjs-compatible script."""
with tempfile.NamedTemporaryFile(suffix=".txt") as outf:
cmd = [
os.path.join(os.path.dirname(__file__), "..", "bin", "pdfjs-to-text"),
settings.PEACHJAM["PDFJS_TO_TEXT"],
fname,
outf.name,
]
Expand Down
1 change: 1 addition & 0 deletions peachjam/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"SEARCH_JURISDICTION_FILTER": False,
"MULTIPLE_JURISDICTIONS": False,
"MULTIPLE_LOCALITIES": False,
"PDFJS_TO_TEXT": "bin/pdfjs-to-text",
}

PEACHJAM["ES_INDEX"] = os.environ.get("ES_INDEX", slugify(PEACHJAM["APP_NAME"]))
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ dependencies = [
"sentry-sdk>=1.16.0",
"whitenoise>=6.0.0",
]

[tool.setuptools.data-files]
"bin" = ["bin/pdfjs-to-text"]
Loading