From 302c111b99f19cee153cd68017629231eaa2371a Mon Sep 17 00:00:00 2001 From: Alexander Blum Date: Fri, 31 May 2024 06:50:10 +0000 Subject: [PATCH] Fixes PyOtherSideQtRCImporter for submodule imports (#134) * fixes PyOtherSideQtRCImporter for submodule imports * adjusts QrRCImporter to use the original check --- src/qrc_importer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qrc_importer.py b/src/qrc_importer.py index af51a98..83eb015 100644 --- a/src/qrc_importer.py +++ b/src/qrc_importer.py @@ -31,7 +31,7 @@ def get_filename(fullname): for candidate in ("{}/{}.py", "{}/{}/__init__.py"): filename = candidate.format(import_path, basename) - if pyotherside.qrc_is_file(filename[len("qrc:") :]): + if pyotherside.qrc_is_file(filename[len("qrc:"):]): return filename @@ -40,7 +40,7 @@ def __init__(self, filepath): self.filepath = filepath def get_data(self, path): - return pyotherside.qrc_get_file_contents(self.filepath[len("qrc:") :]) + return pyotherside.qrc_get_file_contents(self.filepath[len("qrc:"):]) def get_filename(self, fullname): return get_filename(fullname) @@ -48,7 +48,7 @@ def get_filename(self, fullname): class PyOtherSideQtRCImporter(abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): - if path is None: + if path is None or all(x.startswith('qrc:') for x in path): fname = get_filename(fullname) if fname: return spec_from_loader(fullname, PyOtherSideQtRCLoader(fname))