Compile Horizon message catalogs during stack.sh

Recently compiled message catalogs (mo files) were removed
in Horizon and django_openstack_auth repositories.
We need to compile message catalogs to make translations
available for Horizon users. It is useful for developers too.

Change-Id: I0831e8308205c116d8e3bb8b43be7f0dd6fa0c0a
This commit is contained in:
Akihiro Motoki 2014-10-15 17:26:59 +09:00
parent 56d4919a1a
commit 6518c0b88e
3 changed files with 24 additions and 0 deletions

View File

@ -27,3 +27,4 @@ bc
libyaml-dev libyaml-dev
libffi-dev libffi-dev
libssl-dev # for pyOpenSSL libssl-dev # for pyOpenSSL
gettext # used for compiling message catalogs

View File

@ -26,6 +26,7 @@ wget
which which
bc bc
libyaml-devel libyaml-devel
gettext # used for compiling message catalogs
# [1] : some of installed tools have unversioned dependencies on this, # [1] : some of installed tools have unversioned dependencies on this,
# but others have versioned (<=0.7). So if a later version (0.7.1) # but others have versioned (<=0.7). So if a later version (0.7.1)

View File

@ -84,6 +84,14 @@ function cleanup_horizon {
# configure_horizon() - Set config files, create data dirs, etc # configure_horizon() - Set config files, create data dirs, etc
function configure_horizon { function configure_horizon {
setup_develop $HORIZON_DIR setup_develop $HORIZON_DIR
# Compile message catalogs.
# Horizon is installed as develop mode, so we can compile here.
# Message catalog compilation is handled by Django admin script,
# so compiling them after the installation avoids Django installation twice.
cd $HORIZON_DIR
./run_tests.sh -N --compilemessages
cd -
} }
# init_horizon() - Initialize databases, etc. # init_horizon() - Initialize databases, etc.
@ -138,6 +146,13 @@ function init_horizon {
# install_django_openstack_auth() - Collect source and prepare # install_django_openstack_auth() - Collect source and prepare
function install_django_openstack_auth { function install_django_openstack_auth {
git_clone $HORIZONAUTH_REPO $HORIZONAUTH_DIR $HORIZONAUTH_BRANCH git_clone $HORIZONAUTH_REPO $HORIZONAUTH_DIR $HORIZONAUTH_BRANCH
# Compile message catalogs before installation
_prepare_message_catalog_compilation
cd $HORIZONAUTH_DIR
python setup.py compile_catalog
cd -
setup_install $HORIZONAUTH_DIR setup_install $HORIZONAUTH_DIR
} }
@ -160,6 +175,13 @@ function stop_horizon {
stop_apache_server stop_apache_server
} }
# NOTE: It can be moved to common functions, but it is only used by compilation
# of django_openstack_auth catalogs at the moment.
function _prepare_message_catalog_compilation {
local babel_package=$(grep ^Babel $REQUIREMENTS_DIR/global-requirements.txt)
pip_install "$babel_package"
}
# Restore xtrace # Restore xtrace
$XTRACE $XTRACE