From 2dee3884b94152076f3c8da268f7d9ef509a2169 Mon Sep 17 00:00:00 2001 From: insolor <2442833+insolor@users.noreply.github.com> Date: Sun, 21 Jul 2024 11:24:21 +0300 Subject: [PATCH] Don't show file list if there is no up-to-date packages --- package_build/file_list.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/package_build/file_list.py b/package_build/file_list.py index c0d5fb9..d219736 100644 --- a/package_build/file_list.py +++ b/package_build/file_list.py @@ -9,7 +9,9 @@ def show_file_list(root_dir: Path) -> None: st.subheader("Package files awailable to download") - if not list(root_dir.glob("*.zip")): + file_list = [file for file in root_dir.glob("*.zip") if package_up_to_date(file)] + + if not file_list: st.write("No package files available.") return @@ -17,10 +19,7 @@ def show_file_list(root_dir: Path) -> None: column1.write("Package name") column2.write("When created") - for package_path in sorted(root_dir.glob("*.zip")): - if not package_up_to_date(package_path): - continue - + for package_path in sorted(file_list): column1, column2, column3 = st.columns([3, 2, 1], vertical_alignment="center") column1.write(package_path.relative_to(root_dir).name) hours_ago = (datetime.now(tz=timezone.utc) - get_file_modification_datetime(package_path)).seconds // 3600