-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (44 loc) · 1.53 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
# Copyright (c) 2020-present, The Johann Plugin Example Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE file. See the AUTHORS file for names of contributors.
.PHONY: venv build test logs dev prep clean lint safety requirements
VENV_PATH = ./venv
VENV_PYTHON = $(VENV_PATH)/bin/python3
PRE_COMMIT = $(VENV_PATH)/bin/pre-commit
SAFETY = $(VENV_PATH)/bin/safety
TWINE = $(VENV_PATH)/bin/twine
# Cleanup
clean:
$(MAKE) clean-files
clean-files:
rm -rf build dist ./*.egg-info
clean-venv:
rm -rf venv
clean-all: clean clean-venv
# Johann development - linting
lint:
@if [ ! -f $(PRE_COMMIT) ]; then $(MAKE) dev-setup; fi
$(PRE_COMMIT) run check-ast
$(PRE_COMMIT) run --show-diff-on-failure
lint-all:
@if [ ! -f $(PRE_COMMIT) ]; then $(MAKE) dev-setup; fi
$(PRE_COMMIT) run -a check-ast
$(PRE_COMMIT) run -a --show-diff-on-failure
safety:
@if [ ! -f $(SAFETY) ]; then $(MAKE) dev-setup; fi
$(SAFETY) check
# Johann development - other
dev-setup: dev-venv
$(PRE_COMMIT) install --install-hooks -t pre-commit -t commit-msg -t pre-push
requirements:
@if [ ! -f $(PRE_COMMIT) ]; then $(MAKE) dev-setup; fi
-$(PRE_COMMIT) run -a --show-diff-on-failure pip-compile
dev-venv:
rm -rf venv
python3 -m venv $(VENV_PATH)
$(VENV_PYTHON) -m pip install 'wheel>=0.33.6'
$(VENV_PYTHON) -m pip install -r requirements.txt -r requirements-dev.txt
package:
@if [ ! -f $(TWINE) ]; then $(MAKE) dev-setup; fi
$(VENV_PYTHON) setup.py sdist bdist_wheel
$(TWINE) check dist/*