diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-13 15:38:41 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-13 15:38:41 -0500 |
| commit | 762b2b0a5c72f008f8f2a2f5b2882b618a0447f8 (patch) | |
| tree | 298d0ef0e73e24bc3c03b13259f8e9ab167d7dd2 | |
| parent | 159d55a33476df828a49c705940855c4ec38e8ba (diff) | |
| download | rulesets-762b2b0a5c72f008f8f2a2f5b2882b618a0447f8.tar.gz rulesets-762b2b0a5c72f008f8f2a2f5b2882b618a0447f8.zip | |
build(deps): install pdftools so every project can edit PDFs
poppler (pdftoppm/pdftotext) plus a dedicated Python venv at ~/.local/venvs/pdftools with pypdf, reportlab, and pillow. Every project session can now stamp checkboxes, dates, and text overlays onto flattened PDFs through that venv, without each project re-wiring the toolchain.
The package name for poppler diverges across distros (poppler-utils on Debian/Ubuntu, poppler on Arch and Homebrew), so the install branch handles each manager inline rather than going through install_pkg. PDFTOOLS_VENV is overridable via env if a machine needs a different path.
| -rw-r--r-- | Makefile | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -14,6 +14,7 @@ OPTIN_HOOKS := hooks/destructive-bash-confirm.py DEFAULT_HOOKS := $(filter-out $(OPTIN_HOOKS),$(HOOKS)) CLAUDE_CONFIG := $(wildcard .claude/*.json) $(wildcard .claude/.*.json) LANGUAGES := $(notdir $(wildcard languages/*)) +PDFTOOLS_VENV ?= $(HOME)/.local/venvs/pdftools # LANG is also the standard POSIX locale env var. Make inherits env vars into # its variable namespace, so $(LANG) would silently expand to "en_US.UTF-8" (or @@ -74,7 +75,7 @@ help: ## Show this help ##@ Dependencies -deps: ## Install required tools (claude, node, jq, fzf, ripgrep, emacs, playwright) +deps: ## Install required tools (claude, node, jq, fzf, ripgrep, emacs, playwright, pdftools) @echo "Checking dependencies..." @command -v claude >/dev/null 2>&1 && echo " claude: installed" || \ { echo " claude: installing via npm..."; npm install -g @anthropic-ai/claude-code; } @@ -99,6 +100,24 @@ deps: ## Install required tools (claude, node, jq, fzf, ripgrep, emacs, playwrig && uv run --quiet --with textstat python -c "" >/dev/null 2>&1 \ && echo " textstat: cached (scripts/readability)" \ || echo " textstat: skipped (uv missing or offline)" + @# pdftools: poppler (pdftoppm for coordinate-finding) plus a venv with + @# pypdf/reportlab/pillow for overlay/stamp edits on flattened PDFs — + @# the use case is court forms and the like with no AcroForm fields. + @command -v pdftoppm >/dev/null 2>&1 && echo " poppler: installed" || { \ + echo " poppler: installing..."; \ + if command -v brew >/dev/null 2>&1; then brew install poppler; \ + elif command -v apt-get >/dev/null 2>&1; then sudo apt-get install -y poppler-utils; \ + elif command -v pacman >/dev/null 2>&1; then sudo pacman -S --noconfirm poppler; \ + else echo " poppler: ERROR — no supported package manager (brew/apt-get/pacman)"; exit 1; \ + fi; \ + } + @if [ -d "$(PDFTOOLS_VENV)" ]; then \ + echo " pdftools: installed ($(PDFTOOLS_VENV))"; \ + else \ + echo " pdftools: creating venv + installing pypdf/reportlab/pillow..."; \ + python3 -m venv "$(PDFTOOLS_VENV)"; \ + "$(PDFTOOLS_VENV)/bin/pip" install --quiet --upgrade pip pypdf reportlab pillow; \ + fi @if [ -d "$(CURDIR)/playwright-js" ]; then \ if [ -d "$(CURDIR)/playwright-js/node_modules/playwright" ]; then \ echo " playwright (js): installed (skill node_modules present)"; \ |
