~benji/+junk/prooflib-first-cut

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
# Makefile debugging hack: uncomment the two lines below and make will tell you
# more about what is happening.  The output generated is of the form
# "FILE:LINE [TARGET (DEPENDENCIES) (NEWER)]" where DEPENDENCIES are all the
# things TARGET depends on and NEWER are all the files that are newer than
# TARGET.  DEPENDENCIES will be colored green and NEWER will be blue.
#OLD_SHELL := $(SHELL)
#SHELL = $(warning [$@ ($^) ($?) ])$(OLD_SHELL)

WD := $(shell pwd)

bin/pip:
	virtualenv .

bin/python:
	virtualenv .

# We use a "canary" file to tell us if the prooflib package has been installed
# in "develop" mode.
DEVELOP_CANARY := lib/__develop_canary
develop: $(DEVELOP_CANARY)
$(DEVELOP_CANARY): | bin/python
	bin/python setup.py develop
	touch $(DEVELOP_CANARY)

build: deps bin/python bin/pip develop bin/test

clean_venv:

sysdeps:
	sudo apt-get update
	sudo apt-get install -y build-essential bzr libyaml-dev python-dev \
	    python-virtualenv 

# We use a "canary" file to tell us if the Python packages have been installed.
PYTHON_PACKAGE_CANARY := lib/python2.7/site-packages/___canary
python-deps: $(PYTHON_PACKAGE_CANARY)
$(PYTHON_PACKAGE_CANARY): requirements.txt | bin/pip
	if test -d download-cache; \
	    then : bzr up download-cache; \
	    else bzr checkout lp:~juju-jitsu/prooflib/download-cache; \
	fi
	bin/pip install --no-index --no-dependencies --find-links \
	    file:///$(WD)/download-cache/python -r requirements.txt
	touch $(PYTHON_PACKAGE_CANARY)

deps: python-deps

bin/nosetests: python-deps

bin/test: | $(INI) bin/nosetests
	ln scripts/test bin/test

test: build bin/test
	bin/test

lint: sources = setup.py charmworld
lint: build
	@find $(sources) -name '*.py' ! -path '*/migrations/*' \
	    -! -path 'charmworld/teams.py' ! -print0 | xargs -r0 \
		bin/flake8 --ignore=E125,E127

# Generate ctags for the code in the project.
tags:
	ctags --tag-relative --python-kinds=-iv -Rf tags --sort=yes --exclude=.bzr --languages=python

clean:
	find . -type f -name '*.py[co]' -print0 | xargs -r0 rm -rf
	find . -type f -name '*~' -print0 | xargs -r0 rm -rf
	rm -rf bin include lib local

define phony
  clean
  deps
  develop
  build
  lint
  tags
  test
endef

.PHONY: $(phony)

.DEFAULT_GOAL := build