mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-13 00:38:17 +00:00
Add ":"-syntax for [tasks] section
Signed-off-by: Claire Xenia Wolf <claire@clairexen.net>
This commit is contained in:
parent
b409b1179e
commit
ab9d4fd3cf
|
@ -66,6 +66,8 @@ parser.add_argument("--pono", metavar="<path_to_executable>",
|
||||||
help="configure which executable to use for the respective tool")
|
help="configure which executable to use for the respective tool")
|
||||||
parser.add_argument("--dumpcfg", action="store_true", dest="dump_cfg",
|
parser.add_argument("--dumpcfg", action="store_true", dest="dump_cfg",
|
||||||
help="print the pre-processed configuration file")
|
help="print the pre-processed configuration file")
|
||||||
|
parser.add_argument("--dumptags", action="store_true", dest="dump_tags",
|
||||||
|
help="print the list of task tags")
|
||||||
parser.add_argument("--dumptasks", action="store_true", dest="dump_tasks",
|
parser.add_argument("--dumptasks", action="store_true", dest="dump_tasks",
|
||||||
help="print the list of tasks")
|
help="print the list of tasks")
|
||||||
parser.add_argument("--dumpfiles", action="store_true", dest="dump_files",
|
parser.add_argument("--dumpfiles", action="store_true", dest="dump_files",
|
||||||
|
@ -95,6 +97,7 @@ opt_tmpdir = args.tmpdir
|
||||||
exe_paths = args.exe_paths
|
exe_paths = args.exe_paths
|
||||||
throw_err = args.throw_err
|
throw_err = args.throw_err
|
||||||
dump_cfg = args.dump_cfg
|
dump_cfg = args.dump_cfg
|
||||||
|
dump_tags = args.dump_tags
|
||||||
dump_tasks = args.dump_tasks
|
dump_tasks = args.dump_tasks
|
||||||
dump_files = args.dump_files
|
dump_files = args.dump_files
|
||||||
reusedir = False
|
reusedir = False
|
||||||
|
@ -200,6 +203,7 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
task_skiping_blocks = False
|
task_skiping_blocks = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not tasks_section:
|
||||||
found_task_tag = False
|
found_task_tag = False
|
||||||
task_skip_line = False
|
task_skip_line = False
|
||||||
|
|
||||||
|
@ -237,24 +241,38 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
cfgdata.append(line)
|
cfgdata.append(line)
|
||||||
if line.startswith("#"):
|
if line.startswith("#"):
|
||||||
return
|
return
|
||||||
line = line.split()
|
|
||||||
if len(line) > 0:
|
line = line.split(":")
|
||||||
tname = line[0]
|
if len(line) == 1:
|
||||||
|
tnames, line = line[:1], line[1:]
|
||||||
|
elif len(line) == 2:
|
||||||
|
tnames, line = line[0].split(), line[1].split()
|
||||||
|
else:
|
||||||
|
print("ERROR: Syntax error in tasks block.", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for tname in tnames:
|
||||||
|
if tname == "":
|
||||||
|
continue
|
||||||
tpattern = False
|
tpattern = False
|
||||||
for c in tname:
|
for c in tname:
|
||||||
if c in "(?*.[]|)":
|
if c in "(?*.[]|)":
|
||||||
tpattern = True
|
tpattern = True
|
||||||
if not tpattern:
|
if not tpattern:
|
||||||
|
if tname not in tasklist:
|
||||||
tasklist.append(tname)
|
tasklist.append(tname)
|
||||||
task_tags_all.add(tname)
|
task_tags_all.add(tname)
|
||||||
if taskname is not None and re.fullmatch(tname, taskname):
|
if taskname is not None and re.fullmatch(tname, taskname):
|
||||||
task_matched = True
|
task_matched = True
|
||||||
task_tags_active.add(tname)
|
task_tags_active.add(tname)
|
||||||
for t in line[1:]:
|
for t in line:
|
||||||
|
if t == "":
|
||||||
|
continue
|
||||||
task_tags_active.add(t)
|
task_tags_active.add(t)
|
||||||
task_tags_all.add(t)
|
|
||||||
else:
|
for t in line:
|
||||||
for t in line[1:]:
|
if t == "":
|
||||||
|
continue
|
||||||
task_tags_all.add(t)
|
task_tags_all.add(t)
|
||||||
|
|
||||||
elif line == "[tasks]":
|
elif line == "[tasks]":
|
||||||
|
@ -272,7 +290,7 @@ def read_sbyconfig(sbydata, taskname):
|
||||||
print(f"ERROR: Task name '{taskname}' didn't match any lines in [tasks].", file=sys.stderr)
|
print(f"ERROR: Task name '{taskname}' didn't match any lines in [tasks].", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return cfgdata, tasklist
|
return cfgdata, tasklist, sorted(list(task_tags_all))
|
||||||
|
|
||||||
|
|
||||||
sbydata = list()
|
sbydata = list()
|
||||||
|
@ -282,7 +300,7 @@ with (open(sbyfile, "r") if sbyfile is not None else sys.stdin) as f:
|
||||||
|
|
||||||
if dump_cfg:
|
if dump_cfg:
|
||||||
assert len(tasknames) < 2
|
assert len(tasknames) < 2
|
||||||
sbyconfig, _ = read_sbyconfig(sbydata, tasknames[0] if len(tasknames) else None)
|
sbyconfig, _, _ = read_sbyconfig(sbydata, tasknames[0] if len(tasknames) else None)
|
||||||
print("\n".join(sbyconfig))
|
print("\n".join(sbyconfig))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -290,7 +308,7 @@ if dump_files:
|
||||||
file_set = set()
|
file_set = set()
|
||||||
|
|
||||||
def find_files(taskname):
|
def find_files(taskname):
|
||||||
sbyconfig, _ = read_sbyconfig(sbydata, taskname)
|
sbyconfig, _, _ = read_sbyconfig(sbydata, taskname)
|
||||||
|
|
||||||
start_index = -1
|
start_index = -1
|
||||||
for i in range(len(sbyconfig)):
|
for i in range(len(sbyconfig)):
|
||||||
|
@ -319,10 +337,16 @@ if dump_files:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if len(tasknames) == 0:
|
if len(tasknames) == 0:
|
||||||
_, tasknames = read_sbyconfig(sbydata, None)
|
_, tasknames, _ = read_sbyconfig(sbydata, None)
|
||||||
if len(tasknames) == 0:
|
if len(tasknames) == 0:
|
||||||
tasknames = [None]
|
tasknames = [None]
|
||||||
|
|
||||||
|
if dump_tags:
|
||||||
|
_, _, tagnames = read_sbyconfig(sbydata, None)
|
||||||
|
for tag in tagnames:
|
||||||
|
print(tag)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if dump_tasks:
|
if dump_tasks:
|
||||||
for task in tasknames:
|
for task in tasknames:
|
||||||
if task is not None:
|
if task is not None:
|
||||||
|
@ -386,7 +410,7 @@ def run_job(taskname):
|
||||||
else:
|
else:
|
||||||
junit_filename = "junit"
|
junit_filename = "junit"
|
||||||
|
|
||||||
sbyconfig, _ = read_sbyconfig(sbydata, taskname)
|
sbyconfig, _, _ = read_sbyconfig(sbydata, taskname)
|
||||||
job = SbyJob(sbyconfig, my_workdir, early_logmsgs, reusedir)
|
job = SbyJob(sbyconfig, my_workdir, early_logmsgs, reusedir)
|
||||||
|
|
||||||
for k, v in exe_paths.items():
|
for k, v in exe_paths.items():
|
||||||
|
|
Loading…
Reference in a new issue