Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling archived lib when scanning rezplugins (fix #1108) #1109

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from rez.utils.logging_ import print_debug, print_warning
from rez.vendor.six import six
from rez.exceptions import RezPluginError
from zipimport import zipimporter
import pkgutil
import os.path
import sys
Expand Down Expand Up @@ -302,9 +303,22 @@ def rezplugins_module_paths(self):
if not ispkg:
continue

module_path = os.path.join(importer.path, name)
if os.path.isdir(os.path.join(module_path, "rezplugins")):
paths.append(module_path)
if isinstance(importer, zipimporter):
init_path = os.path.join(name, "rezplugins", "__init__.pyc")
try:
importer.get_data(init_path)
except (IOError, OSError):
continue
else:
module_path = os.path.join(importer.archive, name)

else:
module_path = os.path.join(importer.path, name)
init_path = os.path.join(module_path, "rezplugins", "__init__.py")
if not os.path.isfile(init_path):
continue

paths.append(module_path)

return paths

Expand Down