3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-05 06:04:06 +00:00

Allow to set a working directory even when having multiple tasks

Fixes #125.
This commit is contained in:
piegames 2021-06-21 22:32:29 +02:00
parent 99aca04638
commit 1f6700f21d

View file

@ -33,7 +33,7 @@ parser = argparse.ArgumentParser(prog="sby",
parser.set_defaults(exe_paths=dict())
parser.add_argument("-d", metavar="<dirname>", dest="workdir",
help="set workdir name. default: <jobname> or <jobname>_<taskname>")
help="set workdir name prefix. default: <jobname>. `_<taskname>` will be appended to the path for each task")
parser.add_argument("-f", action="store_true", dest="force",
help="remove workdir if it already exists")
parser.add_argument("-b", action="store_true", dest="backup",
@ -323,14 +323,12 @@ if dump_tasks:
print(task)
sys.exit(0)
if (workdir is not None) and (len(tasknames) != 1):
print("ERROR: Exactly one task is required when workdir is specified.", file=sys.stderr)
sys.exit(1)
def run_job(taskname):
my_workdir = workdir
my_opt_tmpdir = opt_tmpdir
if my_workdir is not None and len(taskname) > 1:
my_workdir += "_" + taskname
if my_workdir is None and sbyfile is not None and not my_opt_tmpdir:
my_workdir = sbyfile[:-4]
if taskname is not None: