~lazr-developers/txpkgupload/trunk

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
# Copyright 2005-2015 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

ENV = $(CURDIR)/env

PIP_ARGS := \
	-q \
	--no-index \
	--find-links=file://$(CURDIR)/download-cache/dist/

PYTHON = $(ENV)/bin/python
TWISTD = $(ENV)/bin/twistd


default: check


compile: $(ENV)


check: $(ENV)
	$(PYTHON) -m unittest discover src


dist:
	python setup.py sdist


TAGS:
	ctags -e -R src


tags:
	ctags -R src


download-cache:
ifeq ($(PIP_SOURCE_DIR),)
	@echo "Set PIP_SOURCE_DIR to the path of a checkout of" >&2
	@echo "lp:lp-source-dependencies." >&2
	@exit 1
endif
	ln -nsf $(PIP_SOURCE_DIR) download-cache


$(ENV): download-cache
	mkdir -p $(ENV)
	(echo '[easy_install]'; \
	 echo "allow_hosts = ''"; \
	 echo 'find_links = file://$(CURDIR)/download-cache/dist/') \
		>$(ENV)/.pydistutils.cfg
	VIRTUALENV_SETUPTOOLS=1 virtualenv --never-download $(ENV)
	$(ENV)/bin/pip install $(PIP_ARGS) -r bootstrap-requirements.txt
	$(ENV)/bin/pip install $(PIP_ARGS) -c requirements.txt -e '.[test]'
	$(ENV)/bin/python -m compileall -q src
	ln -nsf $(ENV)/bin bin


clean_pip:
	$(RM) -r bin
	$(RM) -r $(ENV)
	$(RM) -r dist


clean: clean_pip
	find src -name '*.py[co]' -print0 | xargs -r0 $(RM)


.PHONY: compile check clean clean_pip default dist