f4pga/flows/common_modules/generic_script_wrapper: fix relocating files when paths are specified explicitely (#628)

This commit is contained in:
Unai Martinez-Corral 2022-08-29 18:49:16 +01:00 committed by GitHub
commit cfe69b69e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -177,9 +177,10 @@ class GenericScriptWrapperModule(Module):
with open(target, "wb") as f:
f.write(data)
for _, file, target in self.file_outputs:
for dep, file, _ in self.file_outputs:
file = ctx.r_env.resolve(file, final=True)
target = ctx.r_env.resolve(target, final=True)
target = ctx.r_env.resolve(getattr(ctx.outputs, dep), final=True)
print(f"file is: {file}, target is: {target}")
if target != file:
Path(file).rename(target)

View File

@ -238,12 +238,12 @@ class Flow:
sfprint(verbosity, f" {Style.BRIGHT + status} " f"{dep + Style.RESET_ALL}: {source}")
def _build_dep(self, dep):
paths = self.dep_paths.get(dep)
provider = self.os_map.get(dep)
r_env = self.cfg.r_env if provider is None else self.cfg.get_r_env(provider.name)
paths = r_env.resolve(self.dep_paths.get(dep))
if not paths:
sfprint(2, f"Dependency {dep} is unresolved.")
return False
provider = self.os_map.get(dep)
run = (provider.name in self.run_stages) if provider else False
if p_req_exists(paths) and not run: