Commit 93c42890 authored by Michal Čihař's avatar Michal Čihař

Hook scripts are executed with environment variables descriping current component.

Issue #790
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 9031a43e
...@@ -227,6 +227,19 @@ which has been changed. ...@@ -227,6 +227,19 @@ which has been changed.
The script is executed with the current directory set to root of VCS repository The script is executed with the current directory set to root of VCS repository
for given component. for given component.
Additionally following environment variables are available:
``WL_VCS``
Used version control system.
``WL_REPO``
Upstream repository URL.
``WL_PATH``
Absolute path to VCS repository.
``WL_FILEMASK``
File mask for current component.
``WL_FILE_FORMAT``
File format used in current component.
.. seealso:: .. seealso::
:setting:`POST_UPDATE_SCRIPTS`, :setting:`POST_UPDATE_SCRIPTS`,
......
...@@ -15,6 +15,7 @@ Released on ? 2015. ...@@ -15,6 +15,7 @@ Released on ? 2015.
* Tigher control on fuzzy strings on translation upload. * Tigher control on fuzzy strings on translation upload.
* Several URLs have changed, you might have to update your bookmarks. * Several URLs have changed, you might have to update your bookmarks.
* Hook scripts are executed with VCS root as current directory. * Hook scripts are executed with VCS root as current directory.
* Hook scripts are executed with environment variables descriping current component.
weblate 2.3 weblate 2.3
----------- -----------
......
...@@ -1505,6 +1505,15 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin): ...@@ -1505,6 +1505,15 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
if args: if args:
command.extend(args) command.extend(args)
environment = get_clean_env() environment = get_clean_env()
if self.is_repo_link:
target = self.linked_subproject
else:
target = self
environment['WL_VCS'] = target.vcs
environment['WL_REPO'] = target.repo
environment['WL_PATH'] = target.get_path()
environment['WL_FILEMASK'] = self.filemask
environment['WL_FILE_FORMAT'] = self.file_format
try: try:
subprocess.check_call( subprocess.check_call(
command, command,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment