File: droppable-union.py

package info (click to toggle)
botch 0.24-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,084,624 kB
  • sloc: xml: 11,924,892; ml: 4,489; python: 3,890; sh: 1,268; makefile: 334
file content (30 lines) | stat: -rwxr-xr-x 940 bytes parent folder | download | duplicates (4)
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 print_function
import sys

sys.path.append("/usr/share/botch")
from util import read_reduced_deps

if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(
        description=(
            "Calculate the set union "
            + "of two files of "
            + "droppable build "
            + "dependencies"
        )
    )
    parser.add_argument("droppable1", type=read_reduced_deps, help="file 1")
    parser.add_argument("droppable2", type=read_reduced_deps, help="file 2")
    parser.add_argument("-v", "--verbose", action="store_true", help="be verbose")
    args = parser.parse_args()

    together = set(args.droppable1.keys()) | set(args.droppable2.keys())

    for srcpkg in sorted(together):
        d1 = args.droppable1.get(srcpkg, set())
        d2 = args.droppable2.get(srcpkg, set())
        print("%s %s" % (srcpkg, " ".join(sorted(d1 | d2))))