Browse code

Compile Horizon message catalogs during stack.sh

Backporting patch from master to stable/juno branch
https://review.openstack.org/#/c/128601/

Change-Id: I7f61e80bd7f26a7d99474618f773a737afcfbef3
Closes-Bug: 1409587

Tarun Jain authored on 2015/01/12 16:05:49
Showing 3 changed files
... ...
@@ -27,3 +27,4 @@ bc
27 27
 libyaml-dev
28 28
 libffi-dev
29 29
 libssl-dev # for pyOpenSSL
30
+gettext  # used for compiling message catalogs
... ...
@@ -26,6 +26,7 @@ wget
26 26
 which
27 27
 bc
28 28
 libyaml-devel
29
+gettext  # used for compiling message catalogs
29 30
 
30 31
 # [1] : some of installed tools have unversioned dependencies on this,
31 32
 # but others have versioned (<=0.7).  So if a later version (0.7.1)
... ...
@@ -85,6 +85,12 @@ function cleanup_horizon {
85 85
 # configure_horizon() - Set config files, create data dirs, etc
86 86
 function configure_horizon {
87 87
     setup_develop $HORIZON_DIR
88
+
89
+    # Compile message catalogs.
90
+    # Horizon is installed as develop mode, so we can compile here.
91
+    # Message catalog compilation is handled by Django admin script,
92
+    # so compiling them after the installation avoids Django installation twice.
93
+    (cd $HORIZON_DIR; ./run_tests.sh -N --compilemessages)
88 94
 }
89 95
 
90 96
 # init_horizon() - Initialize databases, etc.
... ...
@@ -141,6 +147,9 @@ function install_django_openstack_auth {
141 141
     if use_library_from_git "django_openstack_auth"; then
142 142
         local dir=${GITDIR["django_openstack_auth"]}
143 143
         git_clone_by_name "django_openstack_auth"
144
+        # Compile message catalogs before installation
145
+        _prepare_message_catalog_compilation
146
+        (cd $dir; python setup.py compile_catalog)
144 147
         setup_dev_lib "django_openstack_auth"
145 148
     fi
146 149
     # if we aren't using this library from git, then we just let it
... ...
@@ -166,6 +175,12 @@ function stop_horizon {
166 166
     stop_apache_server
167 167
 }
168 168
 
169
+# NOTE: It can be moved to common functions, but it is only used by compilation
170
+# of django_openstack_auth catalogs at the moment.
171
+function _prepare_message_catalog_compilation {
172
+    local babel_package=$(grep ^Babel $REQUIREMENTS_DIR/global-requirements.txt)
173
+    pip_install "$babel_package"
174
+}
169 175
 
170 176
 # Restore xtrace
171 177
 $XTRACE