-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
90 lines (74 loc) · 2.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
lint_files=setup.py src/flake8_aaa tests
rst_files=README.rst CHANGELOG.rst
# --- Tox recipes ---
.PHONY: lint
lint:
@echo "=== flake8 ==="
flake8 $(lint_files)
@echo "=== mypy ==="
mypy src/flake8_aaa tests
@echo "=== isort ==="
isort --check --diff $(lint_files)
@echo "=== yapf ==="
yapf --recursive --diff $(lint_files)
@echo "=== rst ==="
restructuredtext-lint $(rst_files)
# --- Disabling for now, will move to pyproject.toml in #228
# @echo "=== setup.py ==="
# python setup.py check --metadata --strict
.PHONY: lintexamples
lintexamples:
@echo "=== flake8 ==="
flake8 examples/good examples/bad | sort > flake8.out
diff examples/bad/flake8_expected.out flake8.out
@echo "=== mypy ==="
mypy examples/conftest.py examples/good --ignore-missing-imports --exclude examples/black/ --no-incremental
mypy examples/bad --ignore-missing-imports
@echo "=== black ==="
black --check --diff --verbose examples/black
.PHONY: docs
docs:
tox run -e py310-docs
# --- Local dev: Building / Publishing ---
# Generate version signature used in README.rst
.PHONY: signature
signature:
tox exec -e py312-meta_plugin_dogfood -- flake8 --version
.PHONY: clean
clean:
rm -rf dist build .tox .pytest_cache src/flake8_aaa.egg-info docs/_build/
find . -name '*.pyc' -delete
find src/ examples/ tests/ -name __pycache__ -type d -delete
.PHONY: sdist
sdist:
python setup.py sdist
.PHONY: bdist_wheel
bdist_wheel:
pip install wheel
python setup.py bdist_wheel
.PHONY: testpypi
testpypi: clean sdist bdist_wheel
twine upload --username=__token__ --repository-url https://test.pypi.org/legacy/ dist/*
.PHONY: pypi
pypi: sdist bdist_wheel
twine upload --username=__token__ --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: on_master
on_master:
./on_master.sh
.PHONY: tag
tag: on_master
git tag -a v$$(grep -E "^__version__ = .*" -- src/flake8_aaa/__about__.py | grep -Eo '[0-9\.]*')
.PHONY: fixlint
fixlint:
@echo "=== fixing isort ==="
isort --quiet --recursive $(lint_files)
@echo "=== fixing yapf ==="
yapf --recursive --in-place $(lint_files)
.PHONY: fixlintexamples
fixlintexamples:
@echo "=== Fixing black using tox env ==="
tox e -e py38-lint_examples -- black examples/black
# Trigger a new copy of Black-formatted examples to be generated
.PHONY: black_examples
black_examples:
$(MAKE) -C examples clean all