autohelp-wrapper: build one venv per project

To make sure that projects don't import and expose configuration options
that belong to other project we now build a virtual environment for each
project.

The script execution takes more time but the result is more accurate.

Change-Id: Ied1524de7282bca560883c3503d36a86098309b8
This commit is contained in:
Gauvain Pocentek 2015-04-23 17:53:03 +02:00
parent 11b7494d90
commit 906d27c9f6
1 changed files with 22 additions and 8 deletions

View File

@ -43,10 +43,19 @@ usage() {
}
setup_venv() {
if [ ! -e $VENVDIR/bin/activate ]; then
virtualenv $VENVDIR
project=$1
if [ ! -e $VENVDIR/$project/bin/activate ]; then
mkdir -p $VENVDIR/$project
virtualenv $VENVDIR/$project
fi
. $VENVDIR/bin/activate
activate_venv $project
}
activate_venv() {
project=$1
. $VENVDIR/$project/bin/activate
}
get_project() {
@ -62,9 +71,6 @@ get_project() {
}
setup_tools() {
get_project oslo-incubator
get_project openstack-manuals
(cd $SOURCESDIR/oslo-incubator && python setup.py install)
pip install "GitPython>=0.3.2.RC1"
@ -75,6 +81,9 @@ setup_tools() {
# packages pre-installed
pip install setuptools pbr
# For autohelp.py
pip install lxml
# Some projects don't have explicit dependencies on some less used packages.
# Without these packages installed some modules can't be imported and
# configuration options are not discovered. We install these packages to
@ -145,11 +154,13 @@ fi
[ $# != 0 ] && PROJECTS="$*"
setup_venv
if [ "$FAST" -eq 0 ] ; then
setup_tools
get_project oslo-incubator
get_project openstack-manuals
for project in $PROJECTS; do
setup_venv $project
setup_tools
get_project $project
(
@ -161,12 +172,15 @@ if [ "$FAST" -eq 0 ] ; then
else
git checkout -b $BRANCH remotes/origin/$BRANCH
fi
pip install -rrequirements.txt -rtest-requirements.txt
python setup.py install
)
done
fi
for project in $PROJECTS; do
echo "Working on $project..."
activate_venv $project
if [ "$ACTION" = "setup" ]; then
break
fi