install-deps.sh: pip wheel for python dependencies

For all tox.ini in the source tree which also have requirement.txt
files, create a wheelhouse with the dependencies. This allows tox to
setup test environment with no access to the network with something
like (in tox.ini):

        deps =
          --use-wheel
          --find-links={toxinidir}/wheelhouse
          -r{toxinidir}/requirements.txt
          -r{toxinidir}/test-requirements.txt

Signed-off-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
Loic Dachary 2015-05-02 15:59:12 +02:00
parent 5c9e9da879
commit 8b7953affc

View File

@ -2,7 +2,7 @@
#
# Ceph distributed storage system
#
# Copyright (C) 2014 Red Hat <contact@redhat.com>
# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
#
# Author: Loic Dachary <loic@dachary.org>
#
@ -83,3 +83,26 @@ CentOS|Fedora|RedHatEnterpriseServer)
echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
;;
esac
#
# preload python modules so that tox can run without network access
#
for interpreter in python2.7 python3 ; do
type $interpreter > /dev/null 2>&1 || continue
rm -fr install-deps
virtualenv --python $interpreter install-deps
. install-deps/bin/activate
pip install wheel
find . -name tox.ini | while read ini ; do
(
cd $(dirname $ini)
require=$(ls *requirements.txt 2>/dev/null | sed -e 's/^/-r /')
if test "$require" ; then
# although pip comes with virtualenv, having a recent version
# of pip matters when it comes to using wheel packages
pip wheel $require 'distribute >= 0.7' 'pip >= 6.1'
fi
)
done
done
rm -fr install-deps