-
Notifications
You must be signed in to change notification settings - Fork 182
/
Makefile
130 lines (113 loc) · 4.22 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
unexport LANG
unexport LC_ADDRESS
unexport LC_COLLATE
unexport LC_CTYPE
unexport LC_IDENTIFICATION
unexport LC_MEASUREMENT
unexport LC_MESSAGES
unexport LC_MONETARY
unexport LC_NAME
unexport LC_NUMERIC
unexport LC_PAPER
unexport LC_TELEPHONE
unexport LC_TIME
PANDOC_VERSION := $(shell pandoc --version)
PROTOC_VERSION := $(shell protoc --version)
PROJDIR := $(realpath $(CURDIR))
DOCSRC := $(PROJDIR)/docsrc
DOCTREES := $(DOCSRC)/doctrees
DOCSDIR := $(PROJDIR)/docs
PYPI_REPOSITORY ?= pypi
all: lint test
.PHONY: lint
lint:
$(PROJDIR)/.runner lint
.PHONY: docs
docs:
sphinx-build -b html -d $(DOCTREES) $(DOCSRC) $(DOCSDIR)
@echo "The HTML pages are in $(DOCSDIR)"
.PHONY: pb_clean
pb_clean:
@echo "==> Python (clean)"
@rm -rf riak/pb/*_pb2.py riak/pb/*.pyc riak/pb/__pycache__ __pycache__ py-build
.PHONY: pb_compile
pb_compile: pb_clean
ifeq ($(PROTOC_VERSION),)
$(error The protoc command is required to parse proto files)
endif
ifneq ($(PROTOC_VERSION),libprotoc 2.5.0)
$(error protoc must be version 2.5.0)
endif
@echo "==> Python (compile)"
@protoc -Iriak_pb/src --python_out=riak/pb riak_pb/src/*.proto
@python setup.py build_messages
.PHONY: test_sdist
test_sdist:
@python setup.py sdist
.PHONY: release_sdist
release_sdist:
ifeq ($(VERSION),)
$(error VERSION must be set to build a release and deploy this package)
endif
ifeq ($(PANDOC_VERSION),)
$(error The pandoc command is required to correctly convert README.md to rst format)
endif
ifeq ($(RELEASE_GPG_KEYNAME),)
$(error RELEASE_GPG_KEYNAME must be set to build a release and deploy this package)
endif
ifeq ("$(wildcard $(PROJDIR)/.python-version)","")
$(error expected $(PROJDIR)/.python-version to exist. Run $(PROJDIR)/build/pyenv-setup)
endif
@python -c 'import pypandoc'
@echo "==> Python tagging version $(VERSION)"
@$(PROJDIR)/build/publish $(VERSION) validate
@git tag --sign -a "$(VERSION)" -m "riak-python-client $(VERSION)" --local-user "$(RELEASE_GPG_KEYNAME)"
@git push --tags
@echo "==> pypi repository: $(PYPI_REPOSITORY)"
@echo "==> Python (sdist)"
@python setup.py sdist upload --repository $(PYPI_REPOSITORY) --show-response --sign --identity $(RELEASE_GPG_KEYNAME)
@$(PROJDIR)/build/publish $(VERSION)
.PHONY: release
release: release_sdist
ifeq ($(RELEASE_GPG_KEYNAME),)
$(error RELEASE_GPG_KEYNAME must be set to build a release and deploy this package)
endif
ifeq ("$(wildcard $(PROJDIR)/.python-version)","")
$(error expected $(PROJDIR)/.python-version to exist. Run $(PROJDIR)/build/pyenv-setup)
endif
@echo "==> pypi repository: $(PYPI_REPOSITORY)"
@echo "==> Python 2.7 (bdist_egg)"
@python2.7 setup.py build --build-base=py-build/2.7 bdist_egg upload --repository $(PYPI_REPOSITORY) --show-response --sign --identity $(RELEASE_GPG_KEYNAME)
@echo "==> Python 3.3 (bdist_egg)"
@python3.3 setup.py build --build-base=py-build/3.3 bdist_egg upload --repository $(PYPI_REPOSITORY) --show-response --sign --identity $(RELEASE_GPG_KEYNAME)
@echo "==> Python 3.4 (bdist_egg)"
@python3.4 setup.py build --build-base=py-build/3.4 bdist_egg upload --repository $(PYPI_REPOSITORY) --show-response --sign --identity $(RELEASE_GPG_KEYNAME)
@echo "==> Python 3.5 (bdist_egg)"
@python3.5 setup.py build --build-base=py-build/3.5 bdist_egg upload --repository $(PYPI_REPOSITORY) --show-response --sign --identity $(RELEASE_GPG_KEYNAME)
.PHONY: unit-test
unit-test:
@$(PROJDIR)/.runner unit-test
.PHONY: integration-test
integration-test:
@$(PROJDIR)/.runner integration-test
.PHONY: security-test
security-test:
@$(PROJDIR)/.runner security-test
.PHONY: timeseries-test
timeseries-test:
@$(PROJDIR)/.runner timeseries-test
.PHONY: test
test: integration-test
.PHONY: help
help:
@echo ''
@echo ' Targets:
@echo ' ------------------------------------------------------------'
@echo ' lint - Run linter (flake8) '
@echo ' test - Run all tests '
@echo ' unit-test - Run unit tests '
@echo ' integration-test - Run integration tests '
@echo ' security-test - Run integration tests (security enabled) '
@echo ' timeseries-test - Run timeseries integration tests '
@echo ' ------------------------------------------------------------'
@echo ''