summaryrefslogtreecommitdiffstats
path: root/testing/gen-languages-all
blob: 05f892956daea91c18888f54b29a5519103c80ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
from __future__ import annotations

import sys

LANGUAGES = (
    'conda', 'coursier', 'dart', 'docker', 'docker_image', 'dotnet', 'fail',
    'golang', 'lua', 'node', 'perl', 'pygrep', 'python', 'r', 'ruby', 'rust',
    'script', 'swift', 'system',
)
FIELDS = (
    'ENVIRONMENT_DIR', 'get_default_version', 'health_check',
    'install_environment', 'run_hook',
)


def main() -> int:
    print(f'    # BEGIN GENERATED ({sys.argv[0]})')
    for lang in LANGUAGES:
        parts = [f'    {lang!r}: Language(name={lang!r}']
        for k in FIELDS:
            parts.append(f', {k}={lang}.{k}')
        parts.append('),  # noqa: E501')
        print(''.join(parts))
    print('    # END GENERATED')
    return 0


if __name__ == '__main__':
    raise SystemExit(main())