File: generate_contributors.py

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (38 lines) | stat: -rwxr-xr-x 947 bytes parent folder | download | duplicates (2)
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
36
37
38
#!/usr/bin/python3

import argparse
import os.path
import codecs
import ssg
import ssg.contributors


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--dry-run', action="store_true",
                        help="If set the script will not output.")
    return parser.parse_args()


def main():
    args = parse_args()

    contributors_md, contributors_xml = ssg.contributors.generate()

    if args.dry_run:
        exit(0)

    root_dir = os.path.dirname(os.path.dirname(__file__))
    with codecs.open(os.path.join(root_dir, "Contributors.md"),
                     mode="w", encoding="utf-8") as f:
        f.write(contributors_md)

    with codecs.open(os.path.join(root_dir, "Contributors.xml"),
                     mode="w", encoding="utf-8") as f:
        f.write(contributors_xml)

    print("Don't forget to commit Contributors.md and Contributors.xml!")


if __name__ == "__main__":
    main()