-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
94 lines (78 loc) · 2.77 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
##############################
# ENV
#
SHELL := /bin/bash
.PHONY: pre-check
pre-check:
@command -v virtualenv >/dev/null 2>&1 || { echo >&2 "$$DEPS_TEXT Missing package: virtualenv"; exit 1; }
@command -v curl-config --version >/dev/null 2>&1 || { echo >&2 "$$DEPS_TEXT Missing package: libcurl"; exit 1; }
@echo "int main(){}" | gcc -o /dev/null -x c - -lncurses 2>/dev/null || { echo >&2 "$$DEPS_TEXT Missing package: libncurses"; exit 1; }
.PHONY: deps
deps: pre-check venv/bin/activate .git/hooks/pre-commit
@source venv/bin/activate && ./scripts/apsw_install.sh
.PHONY: venv
venv: venv/bin/activate
venv/bin/activate: requirements.txt
test -d venv || virtualenv venv
. venv/bin/activate; easy_install readline
. venv/bin/activate; pip install -r requirements.txt
touch venv/bin/activate
.git/hooks/pre-commit: .pre-commit
@cp .pre-commit .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
##############################
# HELPERS
#
.PHONY: todo
todo:
@ag "TODO" --ignore Makefile
.PHONY: flake8
flake8:
source venv/bin/activate; flake8 --config=.flake8 .
.PHONY: console
console:
source venv/bin/activate; ipython -i scripts/ipython.py
.PHONY: cloc
cloc:
cloc --by-file-by-lang bin memsql_loader setup.py
##############################
# BUILD
#
MEMSQL_LOADER_VERSION := $(shell python -c "import memsql_loader; print memsql_loader.__version__")
export MEMSQL_LOADER_VERSION
.PHONY: version
version:
@echo $(MEMSQL_LOADER_VERSION)
.PHONY: clean
clean:
-make -C distribution clean
rm -f logdict2.7.4.final*
rm -rf *.egg memsql_loader.egg-info dist build
python setup.py clean --all
for _kill_path in $$(find . -type f -name "*.pyc"); do rm -f $$_kill_path; done
for _kill_path in $$(find . -name "__pycache__"); do rm -rf $$_kill_path; done
distribution/dist/memsql-loader.tar.gz: distribution/memsql_loader.spec
make -C distribution build
.PHONY: build
build: clean distribution/dist/memsql-loader.tar.gz
.PHONY: release
release: distribution/dist/memsql-loader.tar.gz
git tag -f "$(MEMSQL_LOADER_VERSION)" && git push --tags -f
@sleep 1
-github-release info -u memsql -r memsql-loader
-github-release delete -u memsql -r memsql-loader \
--tag "$(MEMSQL_LOADER_VERSION)"
github-release release -u memsql -r memsql-loader \
--tag "$(MEMSQL_LOADER_VERSION)" \
--name "MemSQL Loader $(MEMSQL_LOADER_VERSION)" \
--description "$$(./scripts/latest_changes.py)" \
--draft
github-release upload -u memsql -r memsql-loader \
--tag "$(MEMSQL_LOADER_VERSION)" \
--name "memsql-loader.tar.gz" \
--file "distribution/dist/memsql-loader.tar.gz"
@echo "The release has been uploaded as a draft. View/Edit/Delete it here:"
@echo "https://github.com/memsql/memsql-loader/releases"
.PHONY: release-pypi
release-pypi: clean
@source venv/bin/activate && python setup.py sdist upload