Passed
Push — main ( 8cb12d...a81a91 )
by
unknown
01:47
created

setup_generator.get_dependencies()   A

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 2
nop 1
1
from os import walk
2
3
from pincer import __version__
4
5
6
def get_packages():
7
    return '\n\t'.join(
8
        item[0].replace("./", "").replace("\\", ".").replace("/", ".")
9
        for item in list(walk('pincer')) if "__pycache__" not in item[0]
10
    )
11
12
13
def get_dependencies(path: str) -> str:
14
    with open(path) as f:
15
        return '\n\t'.join(f.read().strip().splitlines())
16
17
18
def main():
19
    with open("VERSION", "w") as f:
20
        f.write(repr(__version__))
21
22
    packages = get_packages()
23
24
    with open(".github/scripts/setup_base.cfg") as f:
25
        base = f.read()
26
27
    dependencies = {
28
        "requires": get_dependencies("requirement.txt"),
29
        "testing_requires": get_dependencies("packages/dev.txt"),
30
        "images_requires": get_dependencies("packages/img.txt")
31
    }
32
33
    with open("setup.cfg", "w") as f:
34
        f.write(
35
            base.format(
36
                version=repr(__version__),
37
                packages=packages,
38
                **dependencies
39
            )
40
        )
41
42
43
if __name__ == '__main__':
44
    main()
45