-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (52 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
60
61
62
63
64
65
66
# system python interpreter. used only to create virtual environment
PY = python
VENV = ./venv
BIN = $(VENV)/bin
PACKAGE_NAME = es_odm
# colors
BLACK = "\033[30;1m"
RED = "\033[31;1m"
GREEN = "\033[32;1m"
YELLOW = "\033[33;1m"
BLUE = "\033[34;1m"
PURPLE = "\033[35;1m"
CYAN = "\033[36;1m"
WHITE = "\033[37;1m"
COLOR_END = "\033[0m"
# make it work on windows too
ifeq ($(OS), Windows_NT)
BIN=$(VENV)/Scripts
PY=python
endif
.PHONY: build
build: $(VENV)
# delete dist dir > build package > delete build and egg-info dir
rm -rf dist && \
$(BIN)/$(PY) setup.py sdist bdist_wheel && \
rm -rf build && rm -rf $(PACKAGE_NAME).egg-info
echo -e $(YELLOW)"build $(PACKAGE_NAME) package done!"$(COLOR_END)
# push package to pypi
.PHONY: push
push: $(VENV)
rm -rf dist && \
$(BIN)/$(PY) setup.py sdist bdist_wheel && \
twine upload dist/* -r pypi && \
rm -rf build && rm -rf $(PACKAGE_NAME).egg-info && \
echo -e $(YELLOW)"push $(PACKAGE_NAME) package to pypi done!"$(COLOR_END)
# release to pypi,auto incr version
.PHONY: release
release: $(VENV)
rm -rf dist && \
$(BIN)/$(PY) version_inc.py && \
$(BIN)/$(PY) setup.py sdist bdist_wheel && \
twine upload dist/* -r pypi && \
rm -rf build && rm -rf $(PACKAGE_NAME).egg-info && \
echo -e $(YELLOW)"release $(PACKAGE_NAME) done!"$(COLOR_END)
.PHONY: clean
clean: $(VENV)
rm -rf build && rm -rf $(PACKAGE_NAME).egg-info && \
echo -e $(YELLOW)"clean done!"$(COLOR_END)
# clean:
# rm -rf $(VENV)
# find . -type f -name *.pyc -delete
# find . -type d -name __pycache__ -delete