Only include directories with __init__.py when building mbp file

This commit is contained in:
Tulir Asokan 2024-03-30 23:32:08 +02:00
parent 4f68e20ff7
commit a7f31f6175

View File

@ -93,10 +93,16 @@ def write_plugin(meta: PluginMeta, output: str | IO) -> None:
if os.path.isfile(f"{module}.py"): if os.path.isfile(f"{module}.py"):
zip.write(f"{module}.py") zip.write(f"{module}.py")
elif module is not None and os.path.isdir(module): elif module is not None and os.path.isdir(module):
zipdir(zip, module) if os.path.isfile(f"{module}/__init__.py"):
zipdir(zip, module)
else:
print(
Fore.YELLOW
+ f"Module {module} is missing __init__.py, skipping"
+ Fore.RESET
)
else: else:
print(Fore.YELLOW + f"Module {module} not found, skipping" + Fore.RESET) print(Fore.YELLOW + f"Module {module} not found, skipping" + Fore.RESET)
for pattern in meta.extra_files: for pattern in meta.extra_files:
for file in glob.iglob(pattern): for file in glob.iglob(pattern):
zip.write(file) zip.write(file)