-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (34 loc) · 990 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
35
36
37
38
39
40
41
42
43
44
# shell used by make
SHELL=/bin/bash
# global variables
PYTHON_VERSION = 3.8
SRC_NAME = src
VENV_NAME = venv
PYTHON = $(VENV_NAME)/bin/python
EGG = $(SRC_NAME).egg-info
all: setup lint
lint: setup
$(VENV_NAME)/bin/pre-commit run --all-files
clean:
find . -type d | grep "__pycache__" | xargs -n1 rm -rf
find . -type f -path "*/*.pyc" -delete
find . -type f -path "*/*.pyo" -delete
rm -rf .pytest_cache
rm -rf .pytype
# Project setup
.PHONY: setup
setup: $(EGG)
$(EGG): $(PYTHON) setup.py requirements.txt
$(PYTHON) -m pip install -U pip setuptools wheel
$(PYTHON) -m pip install -Ue .
$(VENV_NAME)/bin/pre-commit install
$(PYTHON):
python$(PYTHON_VERSION) -m pip install virtualenv
python$(PYTHON_VERSION) -m virtualenv $(VENV_NAME)
# Careful!
# useful e.g. after modifying __init__.py files
destroy-setup: confirm-destroy
rm -rf $(EGG)
rm -rf $(VENV_NAME)
confirm-destroy:
@( read -p "Destroy env? [y/n]: " sure && case "$$sure" in [yY]) true;; *) false;; esac )