-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (56 loc) · 3.32 KB
/
Copy pathMakefile
File metadata and controls
74 lines (56 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
PYTHON ?= $(shell if [ -x .venv/bin/python3 ]; then echo .venv/bin/python3; else echo python3; fi)
USER_BIN ?= $(HOME)/.local/bin
TASK_KNOWLEDGE_BIN := $(USER_BIN)/task-knowledge
LIVE_SKILL_ROOT ?= $(HOME)/.agents/skills/task-centric-knowledge
PYTHON_SITE ?= $(shell "$(PYTHON)" -c 'import os, site, sysconfig; purelib = sysconfig.get_path("purelib"); target = purelib if os.access(purelib, os.W_OK) else site.getusersitepackages(); print(target)')
TASK_KNOWLEDGE_PTH := $(PYTHON_SITE)/task_knowledge_local.pth
SOURCE_ROOT ?= $(LIVE_SKILL_ROOT)
PROJECT_ROOT ?= $(CURDIR)
PROFILE ?= generic
PYTHON_EXTERNALLY_MANAGED ?= $(shell "$(PYTHON)" -c 'import pathlib, sys, sysconfig; marker = pathlib.Path(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED"); in_venv = sys.prefix != getattr(sys, "base_prefix", sys.prefix); print("1" if marker.exists() and not in_venv else "0")')
PYTHON_HAS_PIP ?= $(shell "$(PYTHON)" -c 'import pip' >/dev/null 2>&1 && echo 1 || echo 0)
PYTHON_HAS_SETUPTOOLS ?= $(shell "$(PYTHON)" -c 'import setuptools' >/dev/null 2>&1 && echo 1 || echo 0)
install-local:
@if [ "$(PYTHON_EXTERNALLY_MANAGED)" = "1" ] || [ "$(PYTHON_HAS_PIP)" != "1" ] || [ "$(PYTHON_HAS_SETUPTOOLS)" != "1" ]; then \
$(MAKE) install-wrapper PYTHON="$(PYTHON)" USER_BIN="$(USER_BIN)" PYTHON_SITE="$(PYTHON_SITE)"; \
else \
"$(PYTHON)" -m pip install --user --editable . --no-build-isolation; \
fi
install-editable:
"$(PYTHON)" -m pip install --user --editable . --no-build-isolation
install-wrapper:
mkdir -p "$(USER_BIN)" "$(PYTHON_SITE)"
@if [ -L "$(TASK_KNOWLEDGE_BIN)" ]; then echo "Refusing to overwrite symlink: $(TASK_KNOWLEDGE_BIN)" >&2; exit 2; fi
@if [ -L "$(TASK_KNOWLEDGE_PTH)" ]; then echo "Refusing to overwrite symlink: $(TASK_KNOWLEDGE_PTH)" >&2; exit 2; fi
printf '%s\n' '#!/usr/bin/env bash' 'exec "$(PYTHON)" -m task_knowledge "$$@"' > "$(TASK_KNOWLEDGE_BIN)"
chmod +x "$(TASK_KNOWLEDGE_BIN)"
printf '%s\n' '$(CURDIR)/src' > "$(TASK_KNOWLEDGE_PTH)"
install-global-dry-run:
"$(PYTHON)" scripts/install_global_skill.py --mode dry-run --source-root "$(CURDIR)" --target-root "$(LIVE_SKILL_ROOT)"
install-global:
"$(PYTHON)" scripts/install_global_skill.py --mode apply --source-root "$(CURDIR)" --target-root "$(LIVE_SKILL_ROOT)" --project-root "$(CURDIR)"
verify-global-install:
"$(PYTHON)" scripts/install_global_skill.py --mode verify --source-root "$(CURDIR)" --target-root "$(LIVE_SKILL_ROOT)" --project-root "$(CURDIR)"
check:
"$(PYTHON)" -m compileall -q src tests
PYTHONPATH=src "$(PYTHON)" -m unittest discover -s tests -v
lint:
"$(PYTHON)" -m ruff check src tests
typecheck:
"$(PYTHON)" -m mypy src
check-strict: lint typecheck
docs:
mkdocs build -f mkdocs.yml -d output/docs/site/
docs-serve:
mkdocs serve -f mkdocs.yml
docs-check:
"$(PYTHON)" -m compileall -q src tests
"$(PYTHON)" scripts/check_doc_coverage.py src/
docs-coverage: docs-check
check-production: check verify-global-install
project-install-check:
task-knowledge install check --project-root "$(PROJECT_ROOT)" --source-root "$(SOURCE_ROOT)" --profile "$(PROFILE)"
project-install-apply:
task-knowledge install apply --project-root "$(PROJECT_ROOT)" --source-root "$(SOURCE_ROOT)" --profile "$(PROFILE)" --force
project-install-verify:
task-knowledge install verify-project --project-root "$(PROJECT_ROOT)" --source-root "$(SOURCE_ROOT)" --profile "$(PROFILE)" --force