| 1 |
|
| 2 |
PY = python3 |
| 3 |
VENV = venv |
| 4 |
BIN=$(VENV)/bin |
| 5 |
|
| 6 |
DOCS_SRC = docs |
| 7 |
DOCS_OUT = site |
| 8 |
|
| 9 |
ifeq ($(OS), Windows_NT) |
| 10 |
BIN=$(VENV)/Scripts |
| 11 |
PY=python |
| 12 |
endif |
| 13 |
|
| 14 |
|
| 15 |
.PHONY: all |
| 16 |
all: lint mypy test test-docs test-release |
| 17 |
|
| 18 |
$(VENV): requirements-dev.txt pyproject.toml |
| 19 |
$(PY) -m venv $(VENV) |
| 20 |
$(BIN)/pip install --upgrade -r requirements-dev.txt |
| 21 |
$(BIN)/pip install -e .['dev'] |
| 22 |
touch $(VENV) |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
.PHONY: test |
| 27 |
test: PATH := $(BIN):$(PATH) |
| 28 |
test: $(VENV) |
| 29 |
$(BIN)/pytest |
| 30 |
|
| 31 |
.PHONY: mypy |
| 32 |
mypy: $(VENV) |
| 33 |
$(BIN)/mypy |
| 34 |
|
| 35 |
.PHONY: lint |
| 36 |
lint: $(VENV) |
| 37 |
$(BIN)/ruff check . |
| 38 |
|
| 39 |
.PHONY: build |
| 40 |
build: $(VENV) |
| 41 |
rm -rf dist |
| 42 |
$(BIN)/python3 -m build |
| 43 |
|
| 44 |
.PHONY: test-release |
| 45 |
test-release: $(VENV) build |
| 46 |
$(BIN)/twine check dist/* |
| 47 |
|
| 48 |
.PHONY: release |
| 49 |
release: $(VENV) build |
| 50 |
$(BIN)/twine upload dist/* |
| 51 |
|
| 52 |
.PHONY: test-docs |
| 53 |
test-docs: $(VENV) |
| 54 |
# we try to keep the README and the docs/index.md in sync |
| 55 |
@cmp README.md docs/index.md |
| 56 |
|
| 57 |
.PHONY: docs |
| 58 |
docs: $(VENV) |
| 59 |
$(BIN)/mkdocs build |
| 60 |
|
| 61 |
VERSION = $(shell python3 -c 'from dotenv_cli import __VERSION__; print(__VERSION__)') |
| 62 |
tarball: |
| 63 |
git archive --output=../dotenv-cli_$(VERSION).orig.tar.gz HEAD |
| 64 |
|
| 65 |
.PHONY: clean |
| 66 |
clean: |
| 67 |
rm -rf build dist *.egg-info |
| 68 |
rm -rf $(VENV) |
| 69 |
rm -rf $(DOCS_OUT) |
| 70 |
find . -type f -name *.pyc -delete |
| 71 |
find . -type d -name __pycache__ -delete |
| 72 |
# coverage |
| 73 |
rm -rf htmlcov .coverage |
| 74 |
rm -rf .mypy_cache |
| 75 |
rm -rf .pytest_cache |
| 76 |
rm -rf .ruff_cache |