-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
68 lines (49 loc) · 2.04 KB
/
Makefile
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
.PHONY: build serve setup docs docs3 publish
PYTHON=$(CURDIR)/env/bin/python
LEKTOR=$(CURDIR)/env/bin/lektor
DOC_BRANCH=master
DOC3_BRANCH=master
TRACKING_ID = $(shell jq --raw-output '.tracking_id' databags/analytics.json)
build: docs docs3
test "$$CI" = "true" || test -d build/.git \
|| git clone git@github.com:psycopg/psycopg.github.io.git build
echo 'y' | $(LEKTOR) build -O build
serve:
$(LEKTOR) serve
setup:
test -x $(PYTHON) || python3 -m venv env
test -x $(LEKTOR) || env/bin/pip install -r requirements.txt
publish:
git -C build add -A
git -C build commit -m "updated on $$(date -Iseconds)"
git -C build push
# Build psycopg2 docs
docs: psycopg2/doc/env psycopg2/doc/src/_templates/layout.html
$(MAKE) PYTHON=$(PYTHON) -C psycopg2/doc html
psycopg2/doc/env: psycopg2/README.rst
$(MAKE) PYTHON=$(PYTHON) -C psycopg2/doc env
psycopg2/README.rst:
test -d psycopg2/.git \
|| git clone -b $(DOC_BRANCH) https://github.com/psycopg/psycopg2.git
git -C psycopg2 checkout $(DOC_BRANCH)
git -C psycopg2 pull
psycopg2/doc/src/_templates/layout.html: templates/docs-layout.html databags/analytics.json
mkdir -p $(dir $@)
TRACKING_ID=${TRACKING_ID} envsubst < $< > $@
# Build psycopg3 docs
docs3: psycopg3/docs/.venv psycopg3/docs/_templates/layout.html templates/_sponsors.html
$(MAKE) SPHINXBUILD=.venv/bin/sphinx-build PSYCOPG_IMPL=python -C psycopg3/docs html
psycopg3/docs/.venv: psycopg3/README.rst
$(MAKE) PYTHON=$(PYTHON) -C psycopg3/docs env
# Drop link to the personal blog of the docs theme's author from the footer
find $@ -name page.html -exec sed -i '/https:\/\/pradyunsg.me/d' {} \;
psycopg3/README.rst:
test -d psycopg3/.git \
|| git clone -b $(DOC3_BRANCH) https://github.com/psycopg/psycopg3.git
git -C psycopg3 checkout $(DOC3_BRANCH)
git -C psycopg3 pull
psycopg3/docs/_templates/layout.html: templates/docs3-layout.html databags/analytics.json
mkdir -p $(dir $@)
TRACKING_ID=${TRACKING_ID} envsubst < $< > $@
templates/_sponsors.html: psycopg3/BACKERS.yaml tools/make_sponsors.py
$(PYTHON) tools/make_sponsors.py < $< > $@