summaryrefslogtreecommitdiff
path: root/utils/gen-formats.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/gen-formats.py')
0 files changed, 0 insertions, 0 deletions
rmat&id=6984f07c0ea8a2ccff349c8fc1890d0b290cc4a6'>py/libcamera/gen-py-formats.py
blob: 0ff1d12acab0302d40bac71da132755c6c4b3908 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Generate Python format definitions from YAML

import argparse
import string
import sys
import yaml


def generate(formats):
    fmts = []

    for format in formats:
        name, format = format.popitem()
        fmts.append(f'\t\t.def_readonly_static("{name}", &libcamera::formats::{name})')

    return {'formats': '\n'.join(fmts)}


def fill_template(template, data):
    with open(template, encoding='utf-8') as f:
        template = f.read()