From 52c44000cfcd08088822539439b156c5866082bb Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Mon, 15 Aug 2022 07:17:59 +0200 Subject: [PATCH] f4pga/common_modules/pack: use pathlib instead of os and shutil Signed-off-by: Unai Martinez-Corral --- f4pga/common_modules/pack.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/f4pga/common_modules/pack.py b/f4pga/common_modules/pack.py index f0f616c..ee563b8 100644 --- a/f4pga/common_modules/pack.py +++ b/f4pga/common_modules/pack.py @@ -18,8 +18,6 @@ # SPDX-License-Identifier: Apache-2.0 from pathlib import Path -from os import remove as os_remove -from shutil import move as sh_mv from f4pga.common import vpr_specific_values, noisy_warnings, vpr as common_vpr, VprArgs from f4pga.module import Module, ModuleContext @@ -55,19 +53,19 @@ class PackModule(Module): cwd=str(build_dir) ) - og_log = str(build_dir / 'vpr_stdout.log') + og_log = build_dir / 'vpr_stdout.log' yield 'Moving/deleting files...' if ctx.outputs.pack_log: - sh_mv(og_log, ctx.outputs.pack_log) + og_log.rename(ctx.outputs.pack_log) else: - os_remove(og_log) + og_log.unlink() if ctx.outputs.timing_rpt: - sh_mv(str(build_dir / DEFAULT_TIMING_RPT), ctx.outputs.timing_rpt) + (build_dir / DEFAULT_TIMING_RPT).rename(ctx.outputs.timing_rpt) if ctx.outputs.util_rpt: - sh_mv(str(build_dir / DEFAULT_UTIL_RPT), ctx.outputs.util_rpt) + (build_dir / DEFAULT_UTIL_RPT).rename(ctx.outputs.util_rpt) def __init__(self, _): self.name = 'pack'