Skip to content

Commit

Permalink
Properly generate ZIPs for single file Python packages
Browse files Browse the repository at this point in the history
If a plugin consists only of a single __init__.py file treat it as a module.
  • Loading branch information
phw committed Jun 6, 2019
1 parent 23d3b7e commit af3de8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion generate.py
Expand Up @@ -74,7 +74,8 @@ def zip_files(dest_dir):
file_path = os.path.join(root, filename)
plugin_files.append(file_path)

if len(plugin_files) == 1:
if (len(plugin_files) == 1
and os.path.basename(plugin_files[0]) != '__init__.py'):
# There's only one file, put it directly into the zipfile
archive.write(plugin_files[0],
os.path.basename(plugin_files[0]),
Expand Down

1 comment on commit af3de8b

@zas
Copy link
Collaborator

@zas zas commented on af3de8b Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart a minor code redundancy (calls to os.path.basename()) ok for me ;)

Please sign in to comment.