forked from Nextdoor/ndscheduler
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
34 lines (28 loc) · 971 Bytes
/
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
SHELL:=/bin/bash
PYTHON=.venv/bin/python
PIP=.venv/bin/pip
SOURCE_VENV=. .venv/bin/activate
FLAKE8_CHECKING=$(SOURCE_VENV) && flake8 ndscheduler --max-line-length 120
all: test
init:
@echo "Initialize dev environment for ndscheduler ..."
@echo "Install pre-commit hook for git."
@echo "$(FLAKE8_CHECKING)" > .git/hooks/pre-commit && chmod 755 .git/hooks/pre-commit
@echo "Setup python virtual environment."
if [ ! -d ".venv" ]; then python3 -m venv .venv; fi
$(SOURCE_VENV) && $(PIP) install flake8
@echo "All Done."
test:
make install
make flake8
# Hacky way to ensure mock is installed before running setup.py
$(SOURCE_VENV) && pip install -r test_requirements.txt && $(PYTHON) setup.py test
install:
make init
$(SOURCE_VENV) && $(PYTHON) setup.py install
flake8:
if [ ! -d ".venv" ]; then make init; fi
$(SOURCE_VENV) && $(FLAKE8_CHECKING)
clean:
@($(SOURCE_VENV) && $(PYTHON) setup.py clean) >& /dev/null || python setup.py clean
@echo "Done."