Debian Codegraph @

Makefile

raw
1 PYTHON := python
2 project:=mergedeep
3 version:=$(shell $(PYTHON) -c 'import sys, os; sys.path.insert(0, os.path.abspath(".")); print(__import__("${project}").__version__)')
4
5 .PHONY: list
6 list help:
7 @make -pq | awk -F':' '/^[a-zA-Z0-9][^$$#\/\t=]*:([^=]|$$)/ {split($$1,A,/ /);for(i in A)print A[i]}' | sed '/Makefile/d' | sort
8
9 .PHONY: format
10 format:
11 @$(PYTHON) -m black *.py ./mergedeep/*.py -l 120
12
13 .PHONY: build
14 build: clean
15 @rm -rf ./dist/*
16 @$(PYTHON) setup.py sdist bdist_wheel
17
18 .PHONY: test-setup
19 test-setup:
20 @pyenv install -s 3.6.10
21 @pyenv install -s 3.7.7
22 @pyenv install -s 3.8.2
23 @pyenv install -s 3.9.1
24
25 .PHONY: test
26 test: test-setup
27 @pyenv local 3.6.10 3.7.7 3.8.2 3.9.1
28 @$(PYTHON) -m tox
29
30 .PHONY: clean
31 clean:
32 @rm -rf ./dist ./build ./*.egg-info ./htmlcov
33 @find . -name '*.pyc' -delete
34 @find . -name '__pycache__' -delete
35
36 .PHONY: check
37 check:
38 @twine check dist/*
39
40 .PHONY: upload-test
41 upload-test: test clean build check
42 @twine upload --repository-url https://test.pypi.org/legacy/ dist/*
43
44 .PHONY: tag
45 tag:
46 ifeq (,$(shell git tag --list | grep "${version}"))
47 @git tag "v${version}"
48 endif
49
50 .PHONY: release
51 release: tag
52 ifdef version
53 @curl -XPOST \
54 -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" \
55 -H "Content-Type: application/json" \
56 "https://api.github.com/repos/clarketm/${project}/releases" \
57 --data "{\"tag_name\": \"v${version}\",\"target_commitish\": \"master\",\"name\": \"v${version}\",\"draft\": false,\"prerelease\": false}"
58 endif
59
60 .PHONY: upload
61 publish upload: test clean build check
62 @twine upload dist/*
63