Skip to content

Commit 4d26c4a

Browse files
Use pip and pex cache dirs to speed up build. 'make clean' to wipe out caches (in tmp dir)
1 parent 10a822c commit 4d26c4a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
bin
22
build
33
rpmbuild
4-
pex
4+
tmp
55
*.pyc
66
.idea

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ rpm: clean
3434
rpmbuild -D "_topdir $(PWD)/rpmbuild" -D "version $(VERSION)" -bb rpmbuild/SPECS/$(NAME).spec
3535

3636
clean:
37-
rm -rf bin build rpmbuild $(NAME).egg-info pex 2>/dev/null
37+
rm -rf bin build rpmbuild $(NAME).egg-info tmp 2>/dev/null

scripts/build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ rootdir=$(readlink -f $(dirname $0)/..)
88
srcdir=${rootdir}/${mod_name}
99
bindir=${rootdir}/bin
1010
builddir=${rootdir}/build
11-
cachedir=${rootdir}/cache
12-
pexcachedir=${cachedir}/cache/pex
11+
tmpdir=${rootdir}/tmp
12+
pexdir=${tmpdir}/pex
13+
pipdir=${tmpdir}/pip
1314
venvdir=${builddir}/venv
1415
output_file=${bindir}/${name}
1516
require_file=${builddir}/requirements.txt
@@ -88,15 +89,16 @@ if [ -d ${srcdir} ]; then
8889
fi
8990
source ${venvdir}/bin/activate
9091

91-
${venvdir}/bin/python2.7 ${venvdir}/bin/pip install pex requests
92+
[ ! -d ${pipdir} ] && mkdir -p ${pipdir}
93+
${venvdir}/bin/python2.7 ${venvdir}/bin/pip install --download-cache=${pipdir} pex requests
9294
if [ $? -gt 0 ]; then
9395
echo "Failed to install pex utility for building!"
9496
exit 1
9597
fi
9698

9799
[ ! -d ${bindir} ] && mkdir -p ${bindir}
98-
[ ! -d ${pexcachedir} ] && mkdir -p ${pexcachedir}
99-
${venvdir}/bin/python2.7 ${venvdir}/bin/pex --cache-root ${pexcachedir} -o ${output_file} -m ${mod_name} -r ${require_file} ${builddir}
100+
[ ! -d ${pexdir} ] && mkdir -p ${pexdir}
101+
${venvdir}/bin/python2.7 ${venvdir}/bin/pex -o ${output_file} -m ${mod_name} -r ${require_file} --pex-root=${pexdir} ${builddir}
100102
if [ $? -lt 1 ] && [ -x ${output_file} ]; then
101103
echo "pex executable written to '$output_file'"
102104
else

0 commit comments

Comments
 (0)