Merge ~cjwatson/turnip:use-pip-cache into turnip:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ca8e6ac76b22772a402bb4d29c55b8122e173f09
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/turnip:use-pip-cache
Merge into: turnip:master
Diff against target: 45 lines (+13/-6)
1 file modified
Makefile (+13/-6)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+399717@code.launchpad.net

Commit message

Actually use pip cache at build time

Description of the change

turnip's Makefile was building a pip cache, but inexplicably not actually using it at build time. On my laptop, using the pip cache takes the build time on my laptop (removing ~/.cache/pip/ before each test) from 8m3s to 31s.

In the process, I switched to configuring pip using environment variables; this is more reliable, as environment variables are passed through to pip processes run by setuptools when handling setup_requires.

I suspect this is a large part of why turnip code asset deployments have been so slow.

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index e0362ee..26bf506 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -16,10 +16,17 @@ VENV_ARGS := -p python3
6 DEPENDENCIES_URL := https://git.launchpad.net/~canonical-launchpad-branches/turnip/+git/dependencies
7 PIP_SOURCE_DIR := dependencies
8
9-PIP_ARGS ?= --quiet
10+# virtualenv and pip fail if setlocale fails, so force a valid locale.
11+PIP_ENV := LC_ALL=C.UTF-8
12+# "make PIP_QUIET=0" causes pip to be verbose.
13+PIP_QUIET := 1
14+PIP_ENV += PIP_QUIET=$(PIP_QUIET)
15+PIP_FIND_LINKS := file://$(PIP_CACHE)/
16 ifneq ($(PIP_SOURCE_DIR),)
17-override PIP_ARGS += --no-index --find-links=file://$(shell readlink -f $(PIP_SOURCE_DIR))/
18+PIP_ENV += PIP_NO_INDEX=1
19+PIP_FIND_LINKS += file://$(shell readlink -f $(PIP_SOURCE_DIR))/
20 endif
21+PIP_ENV += PIP_FIND_LINKS="$(PIP_FIND_LINKS)"
22
23 # Create archives in labelled directories (e.g.
24 # <rev-id>/$(PROJECT_NAME).tar.gz)
25@@ -60,9 +67,9 @@ endif
26 (echo '[easy_install]'; \
27 echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \
28 >$(ENV)/.pydistutils.cfg
29- $(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)
30- $(PIP) install $(PIP_ARGS) -r bootstrap-requirements.txt
31- $(PIP) install $(PIP_ARGS) -c requirements.txt \
32+ $(PIP_ENV) $(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)
33+ $(PIP_ENV) $(PIP) install -r bootstrap-requirements.txt
34+ $(PIP_ENV) $(PIP) install -c requirements.txt \
35 -e '.[test,deploy]'
36
37 bootstrap-test: PATH := /usr/sbin:/sbin:$(PATH)
38@@ -131,7 +138,7 @@ stop:
39
40 $(PIP_CACHE): $(ENV)
41 mkdir -p $(PIP_CACHE)
42- $(PIP) install $(PIP_ARGS) -d $(PIP_CACHE) \
43+ $(PIP_ENV) $(PIP) install -d $(PIP_CACHE) \
44 -r bootstrap-requirements.txt \
45 -r requirements.txt
46

Subscribers

People subscribed via source and target branches