This repository has been archived by the owner on Oct 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
94 lines (72 loc) · 1.96 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
NAME = $(notdir $(CURDIR))
# Release
GPG_ID ?= 92126B54
# Git
GIT := /usr/bin/git
GIT_TAG = $(GIT) tag -au $(GPG_ID)
FIND = /usr/bin/find
MAKE = /usr/bin/make
MKDIR = /usr/bin/mkdir
# Python
SYSTEM_PYTHON = /usr/bin/python2
PYTHON_VERSION = 2.7.8
PIP = pip
PEP8_OPTIONS = --max-line-length=120
VIRTUALENV_VERSION = 13.1.2
SETUP = setup.py
INSTALL_OPTIONS := -O2
UPLOAD_OPTIONS = --sign --identity=$(GPG_ID)
ONLINE = true
build_directory = build
distribution_directory = dist
.PHONY: all
all: build
.PHONY: test-dependencies
test-dependencies: virtualenv
if $(ONLINE); then \
. virtualenv/bin/activate && $(PIP) install --requirement python-test-requirements.txt || exit $$?; \
fi
.PHONY: test
test: test-dependencies
. virtualenv/bin/activate && \
$(MAKE) METHOD=git python-pep8 && \
coverage run $(SETUP) test && \
coverage report --include='$(NAME)/*' --fail-under=67
.PHONY: build
build: test virtualenv
$(MKDIR) -p $@
. virtualenv/bin/activate && \
python $(SETUP) build
.PHONY: install
install: virtualenv
$(SYSTEM_PYTHON) $(SETUP) install $(INSTALL_OPTIONS)
.PHONY: register
register: virtualenv
. virtualenv/bin/activate && python $(SETUP) register
.PHONY: release
release: build register
. virtualenv/bin/activate && \
python $(SETUP) sdist upload $(UPLOAD_OPTIONS) && \
$(GIT_TAG) -m 'PyPI release' v$(shell python version.py)
@echo 'Remember to `git push --tags`'
.PHONY: clean
clean: clean-build clean-dist clean-test
.PHONY: clean-build
clean-build: clean-build-third-party clean-build-local
.PHONY: clean-build-third-party
clean-build-third-party:
-$(RM) -r $(build_directory)
.PHONY: clean-build-local
clean-build-local:
-$(RM) -r $(NAME).egg-info
-$(FIND) . -type d -name '__pycache__' -delete
-$(FIND) . -type f -name '*.pyc' -delete
.PHONY: clean-dist
clean-dist:
-$(RM) -r $(distribution_directory)
.PHONY: clean-test
clean-test:
-$(RM) .coverage
-$(RM) virtualenv
include make-includes/python.mk
include make-includes/variables.mk