From f4ffcfa597b7d390701b3e7f8921f2cd9901d69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Fri, 7 Jun 2019 00:00:00 +0000 Subject: [PATCH] build-gem5: fix --dry-run on os.listdir --- shell_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell_helpers.py b/shell_helpers.py index c64a514..9d2bd99 100644 --- a/shell_helpers.py +++ b/shell_helpers.py @@ -147,7 +147,11 @@ class ShellHelpers: ): # TODO print rsync equivalent. os.makedirs(destdir, exist_ok=True) - for basename in sorted(os.listdir(srcdir)): + if not os.path.exists(srcdir) and self.dry_run: + basenames = [] + else: + basenames = os.listdir(srcdir) + for basename in sorted(basenames): src = os.path.join(srcdir, basename) if os.path.isfile(src) or os.path.islink(src): noext, ext = os.path.splitext(basename)