Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit c6ecc1f

Browse files
authored
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.
1 parent 030d122 commit c6ecc1f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

hinted-compilation/hinted-mods.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright 2019-2020, Jorj McKie, mailto:<jorj.x.mckie@outlook.de>
2-
# Copyright 2019-2020, Orsiris de Jong, mailto:<ozy@netpower.fr>
2+
# Copyright 2019-2021, Orsiris de Jong, mailto:<ozy@netpower.fr>
33
#
44
# Part of "Nuitka", an optimizing Python compiler that is compatible and
55
# integrates with CPython, but also works on its own.
@@ -86,11 +86,12 @@ def get_checklist(full_name):
8686
"""
8787
if not full_name: # guard against nonsense
8888
return []
89-
checklist = [full_name] # full name is always looked up first
89+
checklist = [full_name.asString(), full_name.asString() + '.*'] # full name is always looked up first
9090
m0 = ""
9191
while True: # generate *-import names
9292
pkg, full_name = full_name.splitPackageName()
93-
if not pkg: break
93+
if not pkg:
94+
break
9495
m = pkg.asString()
9596
m0 += "." + m if m0 else m
9697
checklist.append(m0 + ".*")
@@ -374,7 +375,7 @@ def onModuleEncounter(self, module_filename, module_name, module_kind):
374375
self.info(ignore_msg)
375376
return False, "dropped by plugin " + plugin.plugin_name
376377

377-
if full_name == "cv2":
378+
if full_name.asString() == "cv2":
378379
return True, "needed by OpenCV"
379380

380381
if str(full_name.getTopLevelPackageName()).startswith("pywin"):
@@ -385,7 +386,7 @@ def onModuleEncounter(self, module_filename, module_name, module_kind):
385386
if m in checklist:
386387
return True, "module is hinted to" # ok
387388

388-
if check_dependents(full_name, self.import_files) is True:
389+
if check_dependents(full_name.asString(), self.import_files) is True:
389390
return True, "parent of recursed-to module"
390391

391392
# next we ask if implicit imports knows our candidate

0 commit comments

Comments
 (0)