Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Wendel <[email protected]>
  • Loading branch information
KwadFan committed Nov 2, 2023
1 parent ad2f705 commit aadd588
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions scripts/setup_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
# This File is distributed under GPLv3
####

import os
import sys
import yaml

from pathlib import Path
from argparse import ArgumentParser, RawTextHelpFormatter
import yaml


def main():
Expand All @@ -25,33 +28,41 @@ def main():
help='Specify group in your configuration file.\
\nFor example \'-g buildtest\'',
required=True)
parser.add_argument('-git', '--to-git-env',
parser.add_argument('--git',
action='store_true',
help='Push output to git environment variables')
args = parser.parse_args()
# Split Namespaces
config_file, setup_group = args.config, args.group
# Checks if file exists, else raises error.
if args.git:
print(args.git)
try:
with open(config_file, 'r') as config:
data = yaml.safe_load(config)
# Check if group is present
if not setup_group in data:
raise Exception(
f"The given group '{setup_group}' doesn't exist!"
)
else:
print(data[setup_group])
except Exception as e:
err_msg(e)
gitout()
else:
try:
# Checks if file exists, else raises error.
with open(config_file, 'r') as config:
data = yaml.safe_load(config)
# Check if group is present
if not setup_group in data:
raise Exception(
f"The given group '{setup_group}' doesn't exist!"
)
else:
print(data[setup_group])
except Exception as e:
err_msg(e)


def err_msg(err):
name = Path(__file__).stem
print(f'{name}: OOOPS, something went wrong!\n{err}')


def gitout():
"""# Setup Matrix
Some wierd text"""
print(gitout.__doc__)


# MAIN
if __name__ == "__main__":
main()

0 comments on commit aadd588

Please sign in to comment.