-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (93 loc) · 3.87 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
ENV=virtualenv
WHEELSDIR=./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
$(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 $(WHEELSDIR)
clean: clean-wheels
-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
build-deb: 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
pip-wheel: $(ENV)
@$(ENV)/bin/pip install wheel
$(WHEELSDIR):
mkdir $(WHEELSDIR)
build-wheels: pip-wheel $(WHEELSDIR) $(ENV)
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELSDIR) .
build-wheels-extra: pip-wheel $(WHEELSDIR) $(ENV)
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELSDIR) -r ${EXTRA}-requirements.txt
build-wheels-all-extras: pip-wheel $(WHEELSDIR) $(ENV)
ls *-requirements.txt | grep -vw 'devel\|test' | xargs -L 1 \
$(ENV)/bin/pip wheel --wheel-dir=$(WHEELSDIR) -r
test-wheels: build-wheels build-wheels-all-extras
$(ENV)/bin/pip install -r test-requirements.txt
$(ENV)/bin/pip install --ignore-installed --no-index --find-links $(WHEELSDIR) -r requirements.txt
ls *-requirements.txt | grep -vw 'devel\|test' | xargs -L 1 \
$(ENV)/bin/pip install --ignore-installed --no-index --find-links $(WHEELSDIR) -r
$(MAKE) test
$(WHEELS_BRANCH_DIR):
bzr branch $(WHEELS_BRANCH) $(WHEELS_BRANCH_DIR)
update-wheel-branch: $(WHEELS_BRANCH_DIR)
@$(ENV)/bin/pip install --upgrade setuptools
@$(ENV)/bin/pip install --upgrade pip
bzr pull -d $(WHEELS_BRANCH_DIR)
WHEELS_BRANCH=$(WHEELS_BRANCH) \
WHEELS_BRANCH_DIR=$(WHEELS_BRANCH_DIR) \
CONN_CHECK_REVNO=$(CONN_CHECK_REVNO) \
$(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"
.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
.DEFAULT_GOAL := test