From 8553c4dbffbc9277597808047cadc12270bda2ff Mon Sep 17 00:00:00 2001 From: pyetras Date: Thu, 13 Aug 2020 12:29:19 +0100 Subject: [PATCH] Fix for handling directories. Some of our rules output directories, where they should be outputting files. This adds traversing the directory and collecting all the files into the archive --- compiler/python_archive.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/python_archive.py b/compiler/python_archive.py index 2c69c58..ac71b48 100755 --- a/compiler/python_archive.py +++ b/compiler/python_archive.py @@ -235,8 +235,17 @@ def scan_manifest(self, manifest): stored_resources[stored_path] = stored_resource.EmptyFile( stored_path, self.timestamp_tuple) else: - stored_resources[stored_path] = stored_resource.StoredFile( - stored_path, self.timestamp_tuple, local_path) + if os.path.isdir(local_path): + all_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk(local_path) for f in filenames] + for local_subpath in sorted(all_files): + if os.path.isdir(local_subpath): + continue + stored_subpath = stored_path + local_subpath.replace(local_path, '') + stored_resources[stored_subpath] = stored_resource.StoredFile( + stored_subpath, self.timestamp_tuple, local_subpath) + else: + stored_resources[stored_path] = stored_resource.StoredFile( + stored_path, self.timestamp_tuple, local_path) # Copy main entry point to well-known name if '__main__.py' in stored_resources: