Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dependencies.py - gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eede7362c8bf8cf5cbb9973a4bdb563ca8deb0bb (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
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3

# Parse Cargo.toml files for each plugin to collect their external dependencies.
# Meson will lookup those dependencies using pkg-config to be able to link
# static Rust plugins into gst-full.

from argparse import ArgumentParser
from pathlib import Path
import sys


try:
    # Python11 stdlib
    import tomllib
except ImportError:
    import tomli as tomllib


PARSER = ArgumentParser()
PARSER.add_argument('src_dir', type=Path)
PARSER.add_argument('plugins', nargs='*')


# Map plugin name to directory name, for those that does not match.
RENAMES = {
    'rsaudiofx': 'audiofx',
    'rsfile': 'file',
    'rsflv': 'flavors',
    'rstextwrap': 'wrap',
    'rsjson': 'json',
    'rsregex': 'regex',
    'rswebp': 'webp',
    'textahead': 'ahead',
    'rsonvif': 'onvif',
    'rstracers': 'tracers',
    'rsclosedcaption': 'closedcaption',
    'rsdav1d': 'dav1d',
    'webrtchttp': 'webrtc-http',
    'rswebrtc': 'webrtc',
}


if __name__ == "__main__":
    opts = PARSER.parse_args()

    with (opts.src_dir / 'Cargo.toml').open('rb') as f:
        crates = tomllib.load(f)['workspace']['members']
    deps = set()
    for p in opts.plugins:
        assert p.startswith('gst')
        name = p[3:]
        name = RENAMES.get(name, name)
        crate_path = None
        for crate in crates:
            if Path(crate).name == name:
                crate_path = opts.src_dir / crate / 'Cargo.toml'
        assert crate_path
        with crate_path.open('rb') as f:
            data = tomllib.load(f)
            try:
                requires = data['package']['metadata']['capi']['pkg_config']['requires_private']
            except KeyError:
                continue
            deps.update([i.strip().replace('>', "|>").replace('<', "|<").replace("==", "|==") for i in requires.split(',')])
    print(','.join(deps))