-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (43 loc) · 1.42 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
prj-dir := $(shell pwd)
src-dir := $(prj-dir)
venv-dir := $(prj-dir)/venv
python-native := python3
python := $(venv-dir)/bin/python
pytest := $(venv-dir)/bin/pytest
pip := $(venv-dir)/bin/pip
pip-compile := $(venv-dir)/bin/pip-compile
define get_site_dir
$(shell $(python) -c "import sysconfig; print(sysconfig.get_path(\"purelib\"))")
endef
prepare-dev: create-env create-dirs install-build-tools install-dev-deps set-path
prepare-prod: create-env create-dirs install-build-tools install-prod-deps set-path
create-env:
$(python-native) -m venv $(venv-dir)
create-dirs:
mkdir -p log
install-build-tools:
$(pip) install --upgrade pip
$(pip) install pip-tools
install-prod-deps:
$(pip-compile) --strip-extras -v
$(pip) install -r requirements.txt
install-dev-deps:
$(pip-compile) --strip-extras -v
$(pip) install -e .[test]
set-path:
echo $(src-dir) > $(call get_site_dir)/my.pth
run:
$(python) $(filter-out $@, $(MAKECMDGOALS))
pytest:
$(pytest) --cov=./ test/
publish:
$(python) -m build && twine check dist/* && twine upload -r pypi dist/*
publish-test:
$(python) -m build && twine check dist/* && twine upload -r pypitest dist/*
clean:
rm -rf $(venv-dir)
rm -rf $(prj-dir)/build $(prj-dir)/dist ${prj-dir}/maxwell/maxwell_service.egg-info
rm -rf $(prj-dir)/examples/__pycache__
rm -rf $(prj-dir)/maxwell/__pycache__ $(prj-dir)/maxwell/service/__pycache__
rm -rf $(prj-dir)/test/__pycache__
rm -rf $(prj-dir)/.pytest_cache