mirror of
https://github.com/ceph/ceph
synced 2025-02-19 08:57:27 +00:00
Merge pull request #4856 from ceph/wip-install-deps-11869
install-deps.sh: create virtualenv only if necessary Reviewed-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
commit
1957c88c81
@ -84,14 +84,34 @@ CentOS|Fedora|RedHatEnterpriseServer)
|
||||
;;
|
||||
esac
|
||||
|
||||
function get_pip_and_wheel() {
|
||||
function populate_wheelhouse() {
|
||||
local install=$1
|
||||
shift
|
||||
|
||||
# Ubuntu-12.04 and Python 2.7.3 require this line
|
||||
pip --timeout 300 $install 'distribute >= 0.7.3' || return 1
|
||||
# although pip comes with virtualenv, having a recent version
|
||||
# of pip matters when it comes to using wheel packages
|
||||
pip --timeout 300 $install 'setuptools >= 0.8' 'pip >= 7.0' 'wheel >= 0.24' || return 1
|
||||
if test $# != 0 ; then
|
||||
pip --timeout 300 $install $@ || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function activate_virtualenv() {
|
||||
local top_srcdir=$1
|
||||
local interpreter=$2
|
||||
local env_dir=$top_srcdir/install-deps-$interpreter
|
||||
|
||||
if ! test -d $env_dir ; then
|
||||
virtualenv --python $interpreter $env_dir
|
||||
. $env_dir/bin/activate
|
||||
if ! populate_wheelhouse install ; then
|
||||
rm -rf $env_dir
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
. $env_dir/bin/activate
|
||||
}
|
||||
|
||||
# use pip cache if possible but do not store it outside of the source
|
||||
@ -100,19 +120,11 @@ function get_pip_and_wheel() {
|
||||
mkdir -p install-deps-cache
|
||||
top_srcdir=$(pwd)
|
||||
export XDG_CACHE_HOME=$top_srcdir/install-deps-cache
|
||||
wip_wheelhouse=wheelhouse-wip
|
||||
|
||||
#
|
||||
# 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
|
||||
if ! test -d install-deps-$interpreter ; then
|
||||
virtualenv --python $interpreter install-deps-$interpreter
|
||||
. install-deps-$interpreter/bin/activate
|
||||
get_pip_and_wheel install || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
find . -name tox.ini | while read ini ; do
|
||||
(
|
||||
cd $(dirname $ini)
|
||||
@ -120,10 +132,10 @@ find . -name tox.ini | while read ini ; do
|
||||
if test "$require" && ! test -d wheelhouse ; then
|
||||
for interpreter in python2.7 python3 ; do
|
||||
type $interpreter > /dev/null 2>&1 || continue
|
||||
. $top_srcdir/install-deps-$interpreter/bin/activate
|
||||
get_pip_and_wheel wheel || exit 1
|
||||
pip --timeout 300 wheel $require || exit 1
|
||||
activate_virtualenv $top_srcdir $interpreter || exit 1
|
||||
populate_wheelhouse "wheel -w $wip_wheelhouse" $require || exit 1
|
||||
done
|
||||
mv $wip_wheelhouse wheelhouse
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
2
src/ceph-detect-init/.gitignore
vendored
2
src/ceph-detect-init/.gitignore
vendored
@ -7,7 +7,7 @@
|
||||
*.egg
|
||||
dist
|
||||
build
|
||||
wheelhouse
|
||||
wheelhouse*
|
||||
*.log
|
||||
*.trs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user