Skip to content

Commit

Permalink
Fix the exercise configure field in multilingual courses
Browse files Browse the repository at this point in the history
If multilingual courses used different file paths in the exercise
configure files settings for different languages, then
a-plus-rst-tools could not build the course correctly.
A-plus-rst-tools used to output errors about inconsistent language
versions.

This commit combines the contents of configure.files from all languages.
The yaml output looks like this:

```
configure:
    url: http://grader/configure
    files:
        "exercises/ex_clubpoints/fi": "exercises/ex_clubpoints/fi"
        "exercises/ex_clubpoints/en": "exercises/ex_clubpoints/en"
```

Fixes #149
  • Loading branch information
markkuriekkinen committed Jun 28, 2022
1 parent bf53980 commit 889ac0c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/toc_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ def join_children(self, path, lang1, c1_list, lang2, c2_list):
c[k] = self.join_children(c_path, lang1, v, lang2, c2.get(k, []))
elif k in INTERNAL_KEYS_TO_JOIN:
c[k + '|i18n'] = join_values(lang1, v, lang2, c2.get(k, v))
elif k == 'configure':
# Combine the configure files from all languages to a single dictionary.
# Do not add any language codes or the |i18n suffix to the keys.
# Check that the urls are identical.
if v.get('url') != c2.get(k, v).get('url'):
self.raise_unequal(c_path, lang2, 'configure.url')
else:
configure = c2.get(k, v).copy()
files = configure.get('files')
if files:
files = files.copy()
files.update(v.get('files', {}))
configure['files'] = files
else:
configure['files'] = v.get('files', {})
c[k] = configure
elif deep_equals(v, c2.get(k, v)):
c[k] = v
else:
Expand Down

0 comments on commit 889ac0c

Please sign in to comment.