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