Merge lp:~cjwatson/turnip/turnipcake-virtualenv into lp:~canonical-launchpad-branches/turnip/turnipcake

Proposed by Colin Watson
Status: Merged
Merged at revision: 24
Proposed branch: lp:~cjwatson/turnip/turnipcake-virtualenv
Merge into: lp:~canonical-launchpad-branches/turnip/turnipcake
Diff against target: 140 lines (+81/-15)
4 files modified
.bzrignore (+4/-1)
Makefile (+72/-14)
bootstrap-requirements.txt (+2/-0)
deploy-requirements.txt (+3/-0)
To merge this branch: bzr merge lp:~cjwatson/turnip/turnipcake-virtualenv
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+275466@code.launchpad.net

Commit message

Add targets to build a virtualenv and to build a tarball with included pip cache.

Description of the change

Add targets to build a virtualenv and to build a tarball with included pip cache.

This parallels https://code.launchpad.net/~cjwatson/turnip/virtualenv/+merge/274701, and takes basically the same approach. While we only need this for development, it greatly simplifies updating the Mojo spec if we can treat both turnip and turnipcake more or less the same way.

To post a comment you must log in.
28. By Colin Watson

Fix turnip dependencies URL.

29. By Colin Watson

Move PIP_SOURCE_DIR check from build-tarball to $(ENV).

Revision history for this message
Colin Watson (cjwatson) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2015-02-10 21:22:55 +0000
+++ .bzrignore 2015-10-29 11:00:49 +0000
@@ -1,4 +1,7 @@
1__pycache__1__pycache__
2*.egg-info2*.egg-info
3*.db3*.db
4*.venv
5\ No newline at end of file4\ No newline at end of file
5*.venv
6build
7env
8pip-cache
69
=== modified file 'Makefile'
--- Makefile 2015-03-26 01:07:54 +0000
+++ Makefile 2015-10-29 11:00:49 +0000
@@ -1,21 +1,59 @@
1# Copyright 2005-2015 Canonical Ltd. This software is licensed under the1# Copyright 2005-2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4PYTHON=python4ENV = $(CURDIR)/env
5PSERVE=pserve5PIP_CACHE = $(CURDIR)/pip-cache
6FLAKE8=flake86
7ALEMBIC=alembic7PYTHON = $(ENV)/bin/python
88PSERVE = $(ENV)/bin/pserve
9check:9FLAKE8 = $(ENV)/bin/flake8
10ALEMBIC = $(ENV)/bin/alembic
11
12PIP_CACHE_ARGS := -q --no-use-wheel
13ifneq ($(PIP_SOURCE_DIR),)
14PIP_CACHE_ARGS += --no-index --find-links=file://$(realpath $(PIP_SOURCE_DIR))/
15endif
16
17# Create archives in labelled directories (e.g.
18# <rev-id>/$(PROJECT_NAME).tar.gz)
19TARBALL_BUILD_LABEL ?= $(shell bzr log -rlast: --show-ids | sed -n 's/^revision-id: //p')
20TARBALL_FILE_NAME = turnipcake.tar.gz
21TARBALL_BUILDS_DIR ?= build
22TARBALL_BUILD_DIR = $(TARBALL_BUILDS_DIR)/$(TARBALL_BUILD_LABEL)
23TARBALL_BUILD_PATH = $(TARBALL_BUILD_DIR)/$(TARBALL_FILE_NAME)
24
25build: $(ENV)
26
27$(ENV):
28ifeq ($(PIP_SOURCE_DIR),)
29 @echo "Set PIP_SOURCE_DIR to the path of a checkout of" >&2
30 @echo "lp:~canonical-launchpad-branches/turnip/dependencies." >&2
31 @exit 1
32endif
33 mkdir -p $(ENV)
34 (echo '[easy_install]'; \
35 echo "allow_hosts = ''"; \
36 echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \
37 >$(ENV)/.pydistutils.cfg
38 virtualenv $(ENV)
39 $(ENV)/bin/pip install $(PIP_CACHE_ARGS) \
40 -r bootstrap-requirements.txt
41 $(ENV)/bin/pip install $(PIP_CACHE_ARGS) \
42 -r requirements.txt \
43 -r deploy-requirements.txt \
44 -e .
45
46check: $(ENV)
10 $(PYTHON) -m unittest discover turnipcake47 $(PYTHON) -m unittest discover turnipcake
1148
12clean:49clean:
13 @find turnipcake -name '*.py[co]' -exec rm '{}' \;50 find turnipcake -name '*.py[co]' -exec rm '{}' \;
14 @find . -depth -name '__pycache__' -exec rm -rf '{}' \; 51 find . -depth -name '__pycache__' -exec rm -rf '{}' \;
15 @rm -f .coverage52 rm -f .coverage
53 rm -rf $(ENV) $(PIP_CACHE)
1654
17dist:55dist:
18 $(PYTHON) ./setup.py sdist56 python ./setup.py sdist
1957
20TAGS:58TAGS:
21 ctags -e -R turnipcake59 ctags -e -R turnipcake
@@ -23,13 +61,33 @@
23tags:61tags:
24 ctags -R turnipcake62 ctags -R turnipcake
2563
26lint:64lint: $(ENV)
27 @$(FLAKE8) turnipcake65 @$(FLAKE8) turnipcake
2866
29run:67run: $(ENV)
30 $(PSERVE) turnipcake.ini --reload68 $(PSERVE) turnipcake.ini --reload
3169
32migrate:70migrate: $(ENV)
33 $(ALEMBIC) -c turnipcake.ini upgrade head71 $(ALEMBIC) -c turnipcake.ini upgrade head
3472
35.PHONY: check clean dist lint run73$(PIP_CACHE): $(ENV)
74 mkdir -p $(PIP_CACHE)
75 $(ENV)/bin/pip install $(PIP_CACHE_ARGS) -d $(PIP_CACHE) \
76 -r bootstrap-requirements.txt \
77 -r requirements.txt \
78 -r deploy-requirements.txt
79
80# XXX cjwatson 2015-10-20: limit to only interesting files
81build-tarball:
82 @echo "Creating deployment tarball at $(TARBALL_BUILD_PATH)"
83 rm -rf $(PIP_CACHE)
84 $(MAKE) $(PIP_CACHE)
85 mkdir -p $(TARBALL_BUILD_DIR)
86 tar -czf $(TARBALL_BUILD_PATH) \
87 --exclude-vcs \
88 --exclude build \
89 --exclude dist \
90 --exclude env \
91 ./
92
93.PHONY: build check clean dist lint run migrate build-tarball
3694
=== added file 'bootstrap-requirements.txt'
--- bootstrap-requirements.txt 1970-01-01 00:00:00 +0000
+++ bootstrap-requirements.txt 2015-10-29 11:00:49 +0000
@@ -0,0 +1,2 @@
1pip==7.1.2
2setuptools==18.4
03
=== added file 'deploy-requirements.txt'
--- deploy-requirements.txt 1970-01-01 00:00:00 +0000
+++ deploy-requirements.txt 2015-10-29 11:00:49 +0000
@@ -0,0 +1,3 @@
1# This will be merged into requirements.txt once the turnipcake charm uses
2# the new tarball construction code.
3gunicorn==19.3.0

Subscribers

People subscribed via source and target branches

to all changes: