Skip to content

Commit 4d40816

Browse files
committed
Identify source files if module is not located
1 parent 53ad7ac commit 4d40816

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

code.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,16 @@ def download_application(full_name: str = None) -> bool:
820820
if info.filename.split("/")[-1] == module_filename:
821821
dirpath = info.filename[:-len(module_filename)].strip("/")
822822
break
823+
824+
if dirpath is None:
825+
# try finding top-level directory with .py files
826+
min_parts = -1
827+
for info in zf.infolist():
828+
if info.filename.endswith(".py"):
829+
parts = info.filename.split("/")[:-1]
830+
if min_parts < 0 or min_parts > len(parts):
831+
min_parts = len(parts)
832+
dirpath = "/".join(parts).strip("/")
823833

824834
# make sure we found module
825835
if dirpath is None:

0 commit comments

Comments
 (0)