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
diff --git a/Makefile b/Makefile
index e0362ee..26bf506 100644
--- a/Makefile
+++ b/Makefile
@@ -16,10 +16,17 @@ VENV_ARGS := -p python3
16DEPENDENCIES_URL := https://git.launchpad.net/~canonical-launchpad-branches/turnip/+git/dependencies16DEPENDENCIES_URL := https://git.launchpad.net/~canonical-launchpad-branches/turnip/+git/dependencies
17PIP_SOURCE_DIR := dependencies17PIP_SOURCE_DIR := dependencies
1818
19PIP_ARGS ?= --quiet19# virtualenv and pip fail if setlocale fails, so force a valid locale.
20PIP_ENV := LC_ALL=C.UTF-8
21# "make PIP_QUIET=0" causes pip to be verbose.
22PIP_QUIET := 1
23PIP_ENV += PIP_QUIET=$(PIP_QUIET)
24PIP_FIND_LINKS := file://$(PIP_CACHE)/
20ifneq ($(PIP_SOURCE_DIR),)25ifneq ($(PIP_SOURCE_DIR),)
21override PIP_ARGS += --no-index --find-links=file://$(shell readlink -f $(PIP_SOURCE_DIR))/26PIP_ENV += PIP_NO_INDEX=1
27PIP_FIND_LINKS += file://$(shell readlink -f $(PIP_SOURCE_DIR))/
22endif28endif
29PIP_ENV += PIP_FIND_LINKS="$(PIP_FIND_LINKS)"
2330
24# Create archives in labelled directories (e.g.31# Create archives in labelled directories (e.g.
25# <rev-id>/$(PROJECT_NAME).tar.gz)32# <rev-id>/$(PROJECT_NAME).tar.gz)
@@ -60,9 +67,9 @@ endif
60 (echo '[easy_install]'; \67 (echo '[easy_install]'; \
61 echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \68 echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \
62 >$(ENV)/.pydistutils.cfg69 >$(ENV)/.pydistutils.cfg
63 $(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)70 $(PIP_ENV) $(VIRTUALENV) $(VENV_ARGS) --never-download $(ENV)
64 $(PIP) install $(PIP_ARGS) -r bootstrap-requirements.txt71 $(PIP_ENV) $(PIP) install -r bootstrap-requirements.txt
65 $(PIP) install $(PIP_ARGS) -c requirements.txt \72 $(PIP_ENV) $(PIP) install -c requirements.txt \
66 -e '.[test,deploy]'73 -e '.[test,deploy]'
6774
68bootstrap-test: PATH := /usr/sbin:/sbin:$(PATH)75bootstrap-test: PATH := /usr/sbin:/sbin:$(PATH)
@@ -131,7 +138,7 @@ stop:
131138
132$(PIP_CACHE): $(ENV)139$(PIP_CACHE): $(ENV)
133 mkdir -p $(PIP_CACHE)140 mkdir -p $(PIP_CACHE)
134 $(PIP) install $(PIP_ARGS) -d $(PIP_CACHE) \141 $(PIP_ENV) $(PIP) install -d $(PIP_CACHE) \
135 -r bootstrap-requirements.txt \142 -r bootstrap-requirements.txt \
136 -r requirements.txt143 -r requirements.txt
137144

Subscribers

People subscribed via source and target branches