aboutsummaryrefslogtreecommitdiff
path: root/bin/updatedirs
blob: 681f02fbc2e71ef946035c4434b9fd6b8ba465f5 (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
#!/usr/bin/env python3

import os

ROOT    = "/home/nolln/u"
SRCS    = ["sys"]
BUILD   = ".build"
TEST    = ".test"
IGNORED = ["build", "include", "lib", "bin", ".git", "vendor", "obj", "dep", ".generated"]

if __name__ == "__main__":
    if not os.path.exists(BUILD):
        os.mkdir(BUILD)

    if not os.path.exists(TEST):
        os.mkdir(TEST)

    for SRC in SRCS:
        for root, dirs, _ in os.walk(f"{ROOT}/{SRC}"):
            dirs[:] = [d for d in dirs if d not in IGNORED]
            for newroot in [BUILD, TEST]:
                blddir  = f"{ROOT}/{newroot}/{SRC}/{root[len(ROOT)+len(SRC)+2:]}"
                if not os.path.exists(blddir):
                    os.mkdir(blddir)