summaryrefslogtreecommitdiffstats
path: root/testing/gen-languages-all
blob: eb7cd701ef08cd6f684636fe7c0a4278e69344a1 (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
#!/usr/bin/env python3
import sys

LANGUAGES = [
    'conda', 'coursier', 'docker', 'docker_image', 'dotnet', 'fail', 'golang',
    'node', 'perl', 'pygrep', 'python', 'r', 'ruby', 'rust', 'script',
    'swift', 'system',
]
FIELDS = [
    'ENVIRONMENT_DIR', 'get_default_version', 'healthy', '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__':
    exit(main())