-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (36 loc) · 1.16 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
SHELL := /bin/bash
SRC := lifeomic_logging
PYTHONPATH := .
VENV := .venv
NOSE := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/nosetests
FLAKE8 := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/flake8
PYTHON := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/python
BLACK := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/black
PIP := $(VENV)/bin/pip3
VERSION := $(shell python -c "from $(SRC).version import __version__; print(__version__)")
REQUIREMENTS := -r requirements-dev.txt
default: clean test
clean:
rm -rf build
rm -rf dist
rm -rf phc.egg-info
venv: $(VENV)/bin/activate
$(VENV)/bin/activate: requirements-dev.txt
test -d $(VENV) || virtualenv -p python3 $(VENV)
$(PIP) install -q $(REQUIREMENTS);
touch $(VENV)/bin/activate
lint: venv
$(FLAKE8) $(SRC)
format: venv
$(BLACK) $(SRC)
test: lint
$(NOSE) -v tests
package: venv
$(PYTHON) setup.py sdist bdist_wheel
deploy: venv
if [[ "$(shell $(PIP) index versions $(SRC))" == *$(VERSION)* ]]; then \
echo "Version $(VERSION) is already published, exiting"; \
else \
echo "Now publishing version $(VERSION)" && $(PYTHON) -m twine upload dist/*; \
fi
.PHONY: default venv requirements bootstrap lint test check package deploy