summaryrefslogtreecommitdiff
path: root/pkg/tools/filter-bitmask-deps
blob: 9808d3948395a30bbffa201d43c487671b898bb1 (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
#!/usr/bin/env python

"""
Filter bitmask dependencies.

Usage: pipdeptree | filter-bitmask-deps
"""
import fileinput

TARGET = "leap.bitmask"


def get_bitmask_deps(dep_lines):
    res = []
    begin = False
    for dep in dep_lines:
        if dep.startswith(TARGET):
            begin = True
            res.append(dep)
            continue
        elif dep.startswith(' ') and begin:
            res.append(dep)
            continue
        if begin:
            return res


if __name__ == "__main__":
    lines = []
    for line in fileinput.input():
        lines.append(line)

    bitmask_deps = get_bitmask_deps(lines)
    for line in bitmask_deps:
        print line[:-1]