| 1 |
NAME := asciinema |
| 2 |
VERSION := $(shell python3 -c "import asciinema; print(asciinema.__version__)") |
| 3 |
|
| 4 |
VIRTUAL_ENV ?= .venv |
| 5 |
|
| 6 |
.PHONY: test |
| 7 |
test: test.unit test.integration |
| 8 |
|
| 9 |
.PHONY: test.unit |
| 10 |
test.unit: |
| •11 |
pytest-3 |
| 12 |
|
| 13 |
.PHONY: test.integration |
| 14 |
test.integration: |
| 15 |
tests/integration.sh |
| 16 |
|
| 17 |
.PHONY: test.distros |
| 18 |
test.distros: |
| 19 |
tests/distros.sh |
| 20 |
|
| 21 |
.PHONY: release |
| 22 |
release: test tag push |
| 23 |
|
| 24 |
.PHONY: release.test |
| 25 |
release.test: test push.test |
| 26 |
|
| 27 |
.PHONY: .tag.exists |
| 28 |
.tag.exists: |
| 29 |
@git tag \ |
| 30 |
| grep -q "v$(VERSION)" \ |
| 31 |
&& echo "Tag v$(VERSION) exists" \ |
| 32 |
&& exit 1 |
| 33 |
|
| 34 |
.PHONY: tag |
| 35 |
tag: .tag.exists |
| 36 |
git tag -s -m "Releasing $(VERSION)" v$(VERSION) |
| 37 |
git push origin v$(VERSION) |
| 38 |
|
| 39 |
.PHONY: .venv |
| 40 |
.venv: |
| 41 |
python3 -m venv $(VIRTUAL_ENV) |
| 42 |
|
| 43 |
.PHONY: .pip |
| 44 |
.pip: .venv |
| 45 |
. $(VIRTUAL_ENV)/bin/activate \ |
| 46 |
&& python3 -m pip install --upgrade build twine |
| 47 |
|
| 48 |
build: .pip |
| 49 |
. $(VIRTUAL_ENV)/bin/activate \ |
| 50 |
&& python3 -m build . |
| 51 |
|
| 52 |
install: build |
| 53 |
. $(VIRTUAL_ENV)/bin/activate \ |
| 54 |
&& python3 -m pip install . |
| 55 |
|
| 56 |
.PHONY: push |
| 57 |
push: .pip build |
| 58 |
. $(VIRTUAL_ENV)/bin/activate \ |
| 59 |
&& python3 -m twine upload dist/* |
| 60 |
|
| 61 |
.PHONY: push.test |
| 62 |
push.test: .pip build |
| 63 |
. $(VIRTUAL_ENV)/bin/activate \ |
| 64 |
&& python3 -m twine upload --repository testpypi dist/* |
| 65 |
|
| 66 |
|
| 67 |
.PHONY: clean |
| 68 |
clean: |
| 69 |
rm -rf dist *.egg-info |
| 70 |
|
| 71 |
clean.all: clean |
| 72 |
find . \ |
| 73 |
-type d \ |
| 74 |
-name __pycache__ \ |
| 75 |
-o -name .pytest_cache \ |
| 76 |
-o -name .mypy_cache \ |
| 77 |
-exec rm -r "{}" + |