Test Failed
Pull Request — master (#7075)
by Alexander
02:16
created

build_sce   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 43
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A parse_args() 0 19 1
1
#!/usr/bin/env python
2
3
from __future__ import print_function
4
5
import os
6
import argparse
7
8
import ssg.build_sce
9
import ssg.environment
10
11
12
def parse_args():
13
    p = argparse.ArgumentParser()
14
    p.add_argument(
15
        "--build-config-yaml", required=True,
16
        help="YAML file with information about the build configuration. "
17
        "e.g.: ~/scap-security-guide/build/build_config.yml"
18
    )
19
    p.add_argument(
20
        "--product-yaml", required=True,
21
        help="YAML file with information about the product we are building. "
22
        "e.g.: ~/scap-security-guide/rhel7/product.yml"
23
    )
24
    p.add_argument(
25
        "--output", required=True)
26
    p.add_argument(
27
        "scedirs", metavar="SCE_DIR", nargs="+",
28
        help="SCE definition scripts to build for the specified product.")
29
    args = p.parse_args()
30
    return args
31
32
33
if __name__ == "__main__":
34
    args = parse_args()
35
36
    # Create output directory if it doesn't yet exist.
37
    if not os.path.exists(args.output):
38
        os.makedirs(args.output)
39
40
    env_yaml = ssg.environment.open_environment(
41
        args.build_config_yaml, args.product_yaml)
42
    ssg.build_sce.checks(env_yaml, args.product_yaml, args.scedirs, args.output)
43