Repair patch state blob reuse
[stgit.git] / Makefile
blob4175d493088d57e2a3c65662a6331f127c8ab855
1 prefix ?= $(HOME)/.local
2 DESTDIR ?= /
3 PYTHON ?= python3
4 DEFAULT_TEST_TARGET ?= test
5 STG_PROVE_OPTS ?=
7 export DESTDIR PYTHON
9 TEST_PATCHES ?= ..
11 all: build
13 build:
14 $(PYTHON) setup.py build
16 dist:
17 $(PYTHON) setup.py sdist
19 install:
20 $(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR) --force
22 install-completion:
23 $(MAKE) -C completion install
25 .PHONY: all build dist install install-completion
27 doc:
28 $(MAKE) -C Documentation all
30 install-doc:
31 $(MAKE) -C Documentation install
33 install-html:
34 $(MAKE) -C Documentation install-html
36 .PHONY: doc install-doc install-html
38 lint: lint-black lint-isort lint-flake8 lint-t
40 lint-black:
41 $(PYTHON) -m black --check --quiet --diff .
43 lint-isort:
44 $(PYTHON) -m isort --check-only --quiet --diff .
46 lint-flake8:
47 $(PYTHON) -m flake8 .
49 lint-t:
50 $(MAKE) -C t test-lint
52 .PHONY: lint lint-black lint-isort lint-flake8 lint-t
54 format:
55 $(PYTHON) -m black .
56 $(PYTHON) -m isort --quiet .
58 test: build
59 $(MAKE) -C t all
61 test-patches:
62 for patch in $$($(PYTHON) -m stgit.main series --noprefix $(TEST_PATCHES)); do \
63 $(PYTHON) -m stgit.main goto $$patch && $(MAKE) test || break; \
64 done
66 .PHONY: format test test-patches
68 coverage:
69 $(MAKE) coverage-test
70 $(MAKE) coverage-report
72 coverage-test:
73 rm -f .coverage
74 $(MAKE) .coverage
76 .coverage:
77 rm -rf build
78 -mkdir .cov-files
79 COVERAGE_RCFILE=$(CURDIR)/pyproject.toml \
80 COVERAGE_FILE=$(CURDIR)/.cov-files/.coverage \
81 $(PYTHON) -m coverage run --context=setup setup.py build
82 COVERAGE_RCFILE=$(CURDIR)/pyproject.toml \
83 COVERAGE_FILE=$(CURDIR)/.cov-files/.coverage \
84 $(MAKE) -C t all
85 COVERAGE_PROCESS_START=$(CURDIR)/pyproject.toml \
86 COVERAGE_RCFILE=$(CURDIR)/pyproject.toml \
87 COVERAGE_FILE=$(CURDIR)/.cov-files/.coverage \
88 $(MAKE) -C Documentation build-txt man
89 $(PYTHON) -m coverage combine .cov-files/.coverage.*
90 rm -r .cov-files
92 coverage-report: .coverage
93 $(PYTHON) -m coverage html
94 $(PYTHON) -m coverage report
95 @echo "HTML coverage report: file://$(CURDIR)/htmlcov/index.html"
97 .PHONY: coverage coverage-test coverage-report
99 dev-env:
100 $(PYTHON) -m pip install -U pip setuptools wheel
101 $(PYTHON) -m pip install coverage[toml] black flake8 flake8-bugbear isort
102 .PHONY: dev-env
104 clean:
105 for dir in Documentation t; do \
106 $(MAKE) -C $$dir clean; \
107 done
108 rm -rf build
109 rm -rf dist
110 rm -f stgit/*.pyc
111 rm -rf stgit/__pycache__
112 rm -f stgit/builtin_version.py
113 rm -f stgit/commands/*.pyc
114 rm -rf stgit/commands/__pycache__
115 rm -f stgit/commands/cmdlist.py
116 rm -f stgit/completion/*.pyc
117 rm -rf stgit/completion/__pycache__
118 rm -f stgit/lib/*.pyc
119 rm -rf stgit/lib/__pycache__
120 rm -f stgit/lib/git/*.pyc
121 rm -rf stgit/lib/git/__pycache__
122 rm -f TAGS tags
123 rm -f MANIFEST
124 rm -f completion/stg.fish
125 rm -f completion/stgit.bash
126 rm -f .coverage
127 rm -rf .cov-files
128 rm -rf htmlcov
130 tags:
131 ctags -R stgit/*
133 TAGS:
134 ctags -e -R stgit/*
136 .PHONY: clean tags TAGS