From 48e9d68918a4fde6a780b25df95c94e0c2a6e185 Mon Sep 17 00:00:00 2001 From: Georg Osang Date: Wed, 31 Jul 2024 06:34:33 +0200 Subject: [PATCH] Support sources pointing to local folder --- src/parenttext_pipeline/compile_sources.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/parenttext_pipeline/compile_sources.py b/src/parenttext_pipeline/compile_sources.py index a7bbcf7..4b3cab9 100644 --- a/src/parenttext_pipeline/compile_sources.py +++ b/src/parenttext_pipeline/compile_sources.py @@ -31,7 +31,10 @@ def compile_sources(repo_folder, destination_folder): for parent_id, parent in config.parents.items(): parent_destination_folder = destination_folder / parent_id with tempfile.TemporaryDirectory() as temp_dir: - unpack_archive(temp_dir, parent.location) + if parent.location.endswith(".zip"): + unpack_archive(temp_dir, parent.location) + else: + shutil.copytree(parent.location, Path(temp_dir) / "archive") # after extracting, all the stuff is inside a subfolder # which we need to identify. folder_contents = os.listdir(temp_dir)