From 030d122b6d23e586d57bca9a8fc9cfdb02bc004a Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Tue, 30 Mar 2021 13:00:08 +0200 Subject: [PATCH 1/2] Update minimal Nuitka required version --- hinted-compilation/nuitka-hints.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hinted-compilation/nuitka-hints.py b/hinted-compilation/nuitka-hints.py index 2945263..d08ab53 100644 --- a/hinted-compilation/nuitka-hints.py +++ b/hinted-compilation/nuitka-hints.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright 2019-2020, Jorj McKie, mailto: -# Copyright 2019-2020, Orsiris de Jong, mailto: +# Copyright 2019-2021, Orsiris de Jong, mailto: # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. @@ -44,8 +44,8 @@ # TODO: Provide a comparison/check method in the nuitka.Version module, maybe for 0.6.10 -if not nuitka_version >= (0,6,9): - sys.exit("This needs Nuitka version 0.6.9 or higher, this is %s" % getNuitkaVersion()) +if not nuitka_version >= (0,6,11): + sys.exit("This needs Nuitka version 0.6.11 or higher, this is %s" % getNuitkaVersion()) python_version = sys.version.split()[0] this_dir = os.path.dirname(os.path.abspath(__file__)) From c6ecc1fff7982ffa4277d758ff5eedaf5b9753b4 Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Tue, 30 Mar 2021 13:02:07 +0200 Subject: [PATCH 2/2] Fix hinted compilation missing *ALL* packages Since `full_name` is now a ModuleName instance but `self.import_files` and `self.import_calls` are string lists, we need to call `asString()` method on ModuleName in order to make comparisons work again. --- hinted-compilation/hinted-mods.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hinted-compilation/hinted-mods.py b/hinted-compilation/hinted-mods.py index 351b58e..5599bd2 100644 --- a/hinted-compilation/hinted-mods.py +++ b/hinted-compilation/hinted-mods.py @@ -1,5 +1,5 @@ # Copyright 2019-2020, Jorj McKie, mailto: -# Copyright 2019-2020, Orsiris de Jong, mailto: +# Copyright 2019-2021, Orsiris de Jong, mailto: # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. @@ -86,11 +86,12 @@ def get_checklist(full_name): """ if not full_name: # guard against nonsense return [] - checklist = [full_name] # full name is always looked up first + checklist = [full_name.asString(), full_name.asString() + '.*'] # full name is always looked up first m0 = "" while True: # generate *-import names pkg, full_name = full_name.splitPackageName() - if not pkg: break + if not pkg: + break m = pkg.asString() m0 += "." + m if m0 else m checklist.append(m0 + ".*") @@ -374,7 +375,7 @@ def onModuleEncounter(self, module_filename, module_name, module_kind): self.info(ignore_msg) return False, "dropped by plugin " + plugin.plugin_name - if full_name == "cv2": + if full_name.asString() == "cv2": return True, "needed by OpenCV" if str(full_name.getTopLevelPackageName()).startswith("pywin"): @@ -385,7 +386,7 @@ def onModuleEncounter(self, module_filename, module_name, module_kind): if m in checklist: return True, "module is hinted to" # ok - if check_dependents(full_name, self.import_files) is True: + if check_dependents(full_name.asString(), self.import_files) is True: return True, "parent of recursed-to module" # next we ask if implicit imports knows our candidate