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