-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
141 lines (110 loc) · 4.55 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
131
132
133
134
135
136
137
138
139
140
141
ENV = virtualenv
WHEELS_DIR = ./wheels
WHEELS_BRANCH = lp:~ubuntuone-hackers/conn-check/wheels
WHEELS_BRANCH_DIR = /tmp/conn-check-wheels
CONN_CHECK_REVNO = $(shell bzr revno)
CONN_CHECK_VERSION = $(shell cat conn_check/version.txt)
CONN_CHECK_PPA = ppa:wesmason/conn-check
DEBIAN_PYTHON_CACHE_DIR = debian/pythoncache
DEBIAN_PYTHON_PACKAGES_FILTER = Twisted txAMQP pyOpenSSL pyasn1 PyYAML psycopg2 requests cffi pycparser six setuptools zope.interface pymongo
HERE = $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
DOCS_DIR = $(HERE)/docs
$(ENV):
virtualenv $(ENV)
build: $(ENV)
$(ENV)/bin/pip install -r devel-requirements.txt
$(ENV)/bin/python setup.py develop
test: $(ENV)
$(ENV)/bin/nosetests
clean-wheels:
-rm -r $(WHEELS_DIR)
-rm -r $(WHEELS_BRANCH_DIR)
clean-docs:
-rm -r $(DOCS_DIR)/_build
clean: clean-wheels clean-docs
-rm -r $(ENV)
-rm -r dist
-rm -r $(DEBIAN_PYTHON_CACHE_DIR)
-rm -r conn_check.egg-info
find . -name "*.pyc" -delete
install-debs:
sudo xargs --arg-file deb-dependencies.txt apt-get install -y
install-deb-pkg-debs: install-debs
sudo apt-get install -y build-essential packaging-dev dh-make
$(ENV)/bin/pip2tgz: $(ENV)
$(ENV)/bin/pip install pip2pi
build-deb-pip-cache: $(ENV)/bin/pip2tgz
mkdir -p $(DEBIAN_PYTHON_CACHE_DIR)
ls *requirements.txt | grep -vw 'devel\|test' | xargs -I{} \
cat {} | sort | uniq > debian-requirements-filtered.txt
@echo '$(DEBIAN_PYTHON_PACKAGES_FILTER)' \
| tr " " "\n" \
| xargs -L 1 -I{} \
sed -i '/^{}/d' debian-requirements-filtered.txt
$(ENV)/bin/pip2tgz $(DEBIAN_PYTHON_CACHE_DIR) -r debian-requirements-filtered.txt
-rm debian-requirements-filtered.txt
@echo 'Removing upstream Debian python-* packages from cache..'
@echo '$(DEBIAN_PYTHON_PACKAGES_FILTER)' \
| tr " " "\n" \
| xargs -L 1 -I{} find $(DEBIAN_PYTHON_CACHE_DIR) -maxdepth 2 -name '{}*' \
| xargs rm -r
$(ENV)/bin/dir2pi $(DEBIAN_PYTHON_CACHE_DIR)
sed -i '/pythoncache/d' debian/source/include-binaries
find debian/pythoncache -path "*.html" -prune -o -print >> debian/source/include-binaries
../conn-check_$(CONN_CHECK_VERSION).orig.tar.gz:
$(ENV)/bin/python setup.py sdist
cp dist/conn-check-$(CONN_CHECK_VERSION).tar.gz ../conn-check_$(CONN_CHECK_VERSION).orig.tar.gz
check-deb-version:
@(grep -F '($(CONN_CHECK_VERSION)-' debian/changelog) || \
(echo 'ERROR: $(CONN_CHECK_VERSION) not found in debian/changelog, have you added it?' && exit 1)
build-deb: check-deb-version build-deb-pip-cache ../conn-check_$(CONN_CHECK_VERSION).orig.tar.gz
-rm ../conn-check_$(CONN_CHECK_VERSION)-*
debuild -S -sa
test-build-deb: build-deb
debuild
update-ppa:
cd .. && dput $(CONN_CHECK_PPA) conn-check_$(CONN_CHECK_VERSION)-*_source.changes
cmd:
@echo $(ENV)/bin/conn-check
fw-cmd:
@echo $(ENV)/bin/conn-check-export-fw
fw-convert-cmd:
@echo $(ENV)/bin/conn-check-convert-fw
pip-wheel: $(ENV)
@$(ENV)/bin/pip install wheel
$(WHEELS_DIR):
mkdir $(WHEELS_DIR)
build-wheels: pip-wheel $(WHEELS_DIR) $(ENV)
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELS_DIR) .
build-wheels-extra: pip-wheel $(WHEELS_DIR) $(ENV)
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELS_DIR) -r ${EXTRA}-requirements.txt
build-wheels-all-extras: pip-wheel $(WHEELS_DIR) $(ENV)
ls *-requirements.txt | grep -vw 'devel\|test' | xargs -L 1 \
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELS_DIR) -r
test-wheels: build-wheels build-wheels-all-extras
$(ENV)/bin/pip install -r test-requirements.txt
$(ENV)/bin/pip install --upgrade --no-index --find-links $(WHEELS_DIR) -r requirements.txt
ls *-requirements.txt | grep -vw 'devel\|test' | xargs -L 1 \
$(ENV)/bin/pip install --ignore-installed --no-index --find-links $(WHEELS_DIR) -r
$(MAKE) test
$(WHEELS_BRANCH_DIR):
bzr checkout --lightweight $(WHEELS_BRANCH) $(WHEELS_BRANCH_DIR)
update-wheel-branch: clean-wheels $(WHEELS_BRANCH_DIR)
@$(ENV)/bin/pip install --upgrade setuptools
@$(ENV)/bin/pip install --upgrade pip
WHEELS_BRANCH=$(WHEELS_BRANCH) \
WHEELS_BRANCH_DIR=$(WHEELS_BRANCH_DIR) \
CONN_CHECK_REVNO=$(CONN_CHECK_REVNO) \
WHEELS_DIR=$(WHEELS_DIR) \
$(PWD)/build_scripts/update_wheels_branch.sh
upload: build test pip-wheel
$(ENV)/bin/python setup.py sdist bdist_wheel upload
@echo
@echo "Don't forget: bzr tag $(CONN_CHECK_VERSION) && bzr push"
docs: TYPE=html
docs:
cd $(DOCS_DIR) && $(MAKE) $(TYPE)
update-rtd:
-curl -X POST http://readthedocs.org/build/conn-check
.PHONY: test build pip-wheel build-wheels build-wheels-extra build-wheels-all test-wheels install-debs clean cmd upload install-build-debs build-deb-pip-cache test-build-deb docs clean-docs update-rtd check-deb-version
.DEFAULT_GOAL := test