From 04b113b42e1238de60d6dcf692908835b0ba4867 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Tue, 18 Apr 2023 17:10:10 -0700 Subject: [PATCH] Edits --- zstash/hpss_utils.py | 7 ------- zstash/ls.py | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/zstash/hpss_utils.py b/zstash/hpss_utils.py index 5c52208f..26fbbc4b 100644 --- a/zstash/hpss_utils.py +++ b/zstash/hpss_utils.py @@ -178,17 +178,10 @@ def add_file( # FIXME: error: "TarFile" has no attribute "offset" offset: int = tar.offset # type: ignore - print(f"file_name={file_name}") - print(f"is_link={os.path.islink(file_name)}") if os.path.islink(file_name): linked_file_name = os.path.realpath(file_name) - print(f"realpath file_name={linked_file_name}") - print(f"cwd={os.getcwd()}") - print(f"ls={os.listdir()}") os.remove(file_name) # Remove symbolic link and create a hard copy - # TODO: see where FileNotFoundError is getting caught such that `create` continues on. shutil.copy(linked_file_name, file_name) - print(os.listdir()) tarinfo: tarfile.TarInfo = tar.gettarinfo(file_name) # Change the size of any hardlinks from 0 to the size of the actual file if tarinfo.islnk(): diff --git a/zstash/ls.py b/zstash/ls.py index b71e39cd..808252ca 100644 --- a/zstash/ls.py +++ b/zstash/ls.py @@ -139,6 +139,9 @@ def ls_database(args: argparse.Namespace, cache: str) -> List[FilesRow]: ) matches_ = matches_ + cur.fetchall() + if matches_ == []: + raise FileNotFoundError("There was nothing to extract.") + # Remove duplicates matches_ = list(set(matches_)) matches: List[FilesRow] = list(map(FilesRow, matches_))