Nuitka-winsvc 2.1.5__cp311-cp311-win_amd64.whl → 2.2.1__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Nuitka-winsvc might be problematic. Click here for more details.

Files changed (234) hide show
  1. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +234 -225
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +9 -5
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/constants.h +2 -0
  26. nuitka/build/include/nuitka/exceptions.h +554 -179
  27. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  28. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  29. nuitka/build/include/nuitka/helper/ints.h +15 -2
  30. nuitka/build/include/nuitka/helper/lists.h +4 -1
  31. nuitka/build/include/nuitka/helper/raising.h +12 -0
  32. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  33. nuitka/build/include/nuitka/helpers.h +5 -0
  34. nuitka/build/include/nuitka/importing.h +3 -4
  35. nuitka/build/include/nuitka/jit_sources.h +25 -0
  36. nuitka/build/include/nuitka/prelude.h +38 -11
  37. nuitka/build/include/nuitka/printing.h +3 -0
  38. nuitka/build/include/nuitka/threading.h +2 -6
  39. nuitka/build/include/nuitka/type_aliases.h +27 -0
  40. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  41. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  42. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  43. nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
  44. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  45. nuitka/build/static_src/CompiledFrameType.c +14 -11
  46. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  47. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  49. nuitka/build/static_src/CompiledMethodType.c +8 -7
  50. nuitka/build/static_src/HelpersAttributes.c +2 -19
  51. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  52. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  53. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  57. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  58. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  59. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  60. nuitka/build/static_src/HelpersExceptions.c +36 -22
  61. nuitka/build/static_src/HelpersFiles.c +9 -0
  62. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  63. nuitka/build/static_src/HelpersImportHard.c +15 -0
  64. nuitka/build/static_src/HelpersJitSources.c +46 -0
  65. nuitka/build/static_src/HelpersLists.c +40 -0
  66. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  67. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  68. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  69. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  70. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  71. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  72. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  73. nuitka/build/static_src/HelpersProfiling.c +3 -4
  74. nuitka/build/static_src/HelpersRaising.c +62 -1
  75. nuitka/build/static_src/HelpersStrings.c +203 -8
  76. nuitka/build/static_src/HelpersTypes.c +42 -0
  77. nuitka/build/static_src/MainProgram.c +1 -1
  78. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  79. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  80. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  81. nuitka/code_generation/BuiltinCodes.py +1 -0
  82. nuitka/code_generation/CodeGeneration.py +11 -0
  83. nuitka/code_generation/CodeHelpers.py +5 -3
  84. nuitka/code_generation/CodeObjectCodes.py +10 -6
  85. nuitka/code_generation/ComparisonCodes.py +19 -3
  86. nuitka/code_generation/ConstantCodes.py +5 -0
  87. nuitka/code_generation/Contexts.py +22 -6
  88. nuitka/code_generation/Emission.py +1 -0
  89. nuitka/code_generation/ErrorCodes.py +8 -16
  90. nuitka/code_generation/EvalCodes.py +5 -3
  91. nuitka/code_generation/ExceptionCodes.py +8 -1
  92. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  93. nuitka/code_generation/FrameCodes.py +5 -3
  94. nuitka/code_generation/FunctionCodes.py +0 -1
  95. nuitka/code_generation/GeneratorCodes.py +3 -3
  96. nuitka/code_generation/GlobalConstants.py +1 -2
  97. nuitka/code_generation/ImportCodes.py +2 -0
  98. nuitka/code_generation/JitCodes.py +44 -0
  99. nuitka/code_generation/ListCodes.py +11 -17
  100. nuitka/code_generation/MatchCodes.py +0 -1
  101. nuitka/code_generation/ModuleCodes.py +2 -1
  102. nuitka/code_generation/Namify.py +0 -1
  103. nuitka/code_generation/NetworkxCodes.py +51 -0
  104. nuitka/code_generation/OperationCodes.py +8 -6
  105. nuitka/code_generation/PackageResourceCodes.py +7 -5
  106. nuitka/code_generation/TensorflowCodes.py +54 -0
  107. nuitka/code_generation/TypeAliasCodes.py +71 -0
  108. nuitka/code_generation/VariableCodes.py +7 -5
  109. nuitka/code_generation/VariableDeclarations.py +1 -0
  110. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  111. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  112. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  113. nuitka/code_generation/templates/CodeTemplatesConstants.py +15 -0
  114. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  115. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  116. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  117. nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
  118. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  119. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  120. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  121. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  122. nuitka/containers/Namedtuples.py +0 -1
  123. nuitka/finalizations/Finalization.py +1 -0
  124. nuitka/finalizations/FinalizeMarkups.py +0 -1
  125. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  126. nuitka/freezer/DllDependenciesPosix.py +0 -1
  127. nuitka/freezer/IncludedDataFiles.py +46 -15
  128. nuitka/freezer/IncludedEntryPoints.py +5 -3
  129. nuitka/freezer/Standalone.py +6 -1
  130. nuitka/importing/ImportCache.py +2 -2
  131. nuitka/importing/ImportResolving.py +80 -78
  132. nuitka/importing/Importing.py +34 -1
  133. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  134. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  135. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  136. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  137. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  138. nuitka/nodes/BuiltinRefNodes.py +8 -1
  139. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  140. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  141. nuitka/nodes/CodeObjectSpecs.py +1 -1
  142. nuitka/nodes/ConstantRefNodes.py +38 -0
  143. nuitka/nodes/CtypesNodes.py +0 -1
  144. nuitka/nodes/DictionaryNodes.py +0 -1
  145. nuitka/nodes/ExceptionNodes.py +10 -0
  146. nuitka/nodes/ExpressionBases.py +15 -9
  147. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  148. nuitka/nodes/FunctionNodes.py +50 -5
  149. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  150. nuitka/nodes/ImportHardNodes.py +27 -13
  151. nuitka/nodes/ImportNodes.py +90 -70
  152. nuitka/nodes/InjectCNodes.py +0 -1
  153. nuitka/nodes/ModuleNodes.py +10 -5
  154. nuitka/nodes/NetworkxNodes.py +45 -0
  155. nuitka/nodes/OperatorNodesUnary.py +1 -0
  156. nuitka/nodes/OsSysNodes.py +0 -1
  157. nuitka/nodes/PackageMetadataNodes.py +0 -1
  158. nuitka/nodes/PackageResourceNodes.py +10 -6
  159. nuitka/nodes/StatementBasesGenerated.py +107 -60
  160. nuitka/nodes/StringConcatenationNodes.py +1 -0
  161. nuitka/nodes/TensorflowNodes.py +38 -0
  162. nuitka/nodes/TypeNodes.py +21 -0
  163. nuitka/nodes/VariableRefNodes.py +1 -0
  164. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  165. nuitka/optimizations/Optimization.py +7 -6
  166. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  167. nuitka/optimizations/Tags.py +0 -1
  168. nuitka/optimizations/TraceCollections.py +6 -55
  169. nuitka/optimizations/ValueTraces.py +49 -1
  170. nuitka/plugins/PluginBase.py +26 -4
  171. nuitka/plugins/Plugins.py +49 -12
  172. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  173. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  174. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  175. nuitka/plugins/standard/DillPlugin.py +3 -3
  176. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  177. nuitka/plugins/standard/GiPlugin.py +1 -0
  178. nuitka/plugins/standard/ImplicitImports.py +9 -7
  179. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  180. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  181. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  182. nuitka/plugins/standard/PmwPlugin.py +10 -9
  183. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  184. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  185. nuitka/plugins/standard/TorchPlugin.py +1 -0
  186. nuitka/plugins/standard/TrioPlugin.py +1 -0
  187. nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -54
  188. nuitka/reports/CompilationReportReader.py +0 -1
  189. nuitka/reports/Reports.py +49 -5
  190. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  191. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  192. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  193. nuitka/specs/HardImportSpecs.py +34 -1
  194. nuitka/specs/ParameterSpecs.py +11 -9
  195. nuitka/tools/environments/Virtualenv.py +0 -1
  196. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  197. nuitka/tools/specialize/SpecializeC.py +11 -9
  198. nuitka/tools/specialize/SpecializePython.py +57 -30
  199. nuitka/tools/testing/Common.py +24 -7
  200. nuitka/tools/testing/OutputComparison.py +4 -0
  201. nuitka/tools/testing/Pythons.py +0 -1
  202. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  203. nuitka/tools/watch/GitHub.py +4 -1
  204. nuitka/tools/watch/__main__.py +22 -1
  205. nuitka/tree/Building.py +3 -0
  206. nuitka/tree/InternalModule.py +0 -1
  207. nuitka/tree/ReformulationAssertStatements.py +1 -0
  208. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  209. nuitka/tree/ReformulationClasses3.py +23 -26
  210. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  211. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  212. nuitka/tree/ReformulationExecStatements.py +8 -6
  213. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  214. nuitka/tree/SourceHandling.py +8 -0
  215. nuitka/tree/TreeHelpers.py +6 -3
  216. nuitka/utils/AppDirs.py +6 -2
  217. nuitka/utils/CStrings.py +1 -1
  218. nuitka/utils/CommandLineOptions.py +0 -1
  219. nuitka/utils/Distributions.py +3 -3
  220. nuitka/utils/Download.py +5 -1
  221. nuitka/utils/Execution.py +6 -3
  222. nuitka/utils/FileOperations.py +62 -35
  223. nuitka/utils/Importing.py +4 -4
  224. nuitka/utils/InstanceCounters.py +1 -0
  225. nuitka/utils/MacOSApp.py +1 -0
  226. nuitka/utils/Shebang.py +1 -0
  227. nuitka/utils/Utils.py +39 -1
  228. nuitka/utils/WindowsFileUsage.py +4 -3
  229. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
  230. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
  231. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
  232. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
  233. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
  234. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
@@ -187,9 +187,9 @@ def _getEvaluationContext():
187
187
  numeric_version = int(big) * 256 + int(major) * 16
188
188
  is_same_or_higher_version = python_version >= numeric_version
189
189
 
190
- _context_dict[
191
- "python" + big + major + "_or_higher"
192
- ] = is_same_or_higher_version
190
+ _context_dict["python" + big + major + "_or_higher"] = (
191
+ is_same_or_higher_version
192
+ )
193
193
  _context_dict["before_python" + big + major] = not is_same_or_higher_version
194
194
 
195
195
  _context_dict["before_python3"] = python_version < 0x300
@@ -210,6 +210,8 @@ def _convertVersionToTuple(version_str):
210
210
 
211
211
 
212
212
  def _getPackageNameFromDistributionName(distribution_name):
213
+ # spell-checker: ignore opencv, pyobjc, objc
214
+
213
215
  if distribution_name in ("opencv-python", "opencv-python-headless"):
214
216
  return "cv2"
215
217
  elif distribution_name == "pyobjc":
@@ -302,7 +304,7 @@ def _iterate_module_names(package_name):
302
304
  module_name = package_name.getChildNamed(module_info.name)
303
305
  result.append(module_name.asString())
304
306
 
305
- if module_info.ispkg:
307
+ if module_info.ispkg: # spell-checker: ignore ispkg
306
308
  result.extend(_iterate_module_names(package_name=module_name))
307
309
 
308
310
  return result
@@ -1675,6 +1677,26 @@ class NuitkaYamlPluginBase(NuitkaPluginBase):
1675
1677
  if decide_relevant(key, value):
1676
1678
  yield key, value
1677
1679
 
1680
+ def getYamlConfigItemSet(
1681
+ self, module_name, section, item_name, decide_relevant, recursive
1682
+ ):
1683
+ for item_config in self.getYamlConfigItem(
1684
+ module_name=module_name,
1685
+ section=section,
1686
+ item_name=item_name,
1687
+ decide_relevant=None,
1688
+ default=(),
1689
+ recursive=recursive,
1690
+ ):
1691
+ if recursive:
1692
+ for value in item_config[1]:
1693
+ if decide_relevant is None or decide_relevant(value):
1694
+ yield item_config[0], value
1695
+ else:
1696
+ for value in item_config:
1697
+ if decide_relevant is None or decide_relevant(value):
1698
+ yield value
1699
+
1678
1700
 
1679
1701
  def standalone_only(func):
1680
1702
  """For plugins that have functionality that should be done in standalone mode only."""
nuitka/plugins/Plugins.py CHANGED
@@ -25,6 +25,7 @@ from nuitka.__past__ import basestring, iter_modules
25
25
  from nuitka.build.DataComposerInterface import deriveModuleConstantsBlobName
26
26
  from nuitka.containers.OrderedDicts import OrderedDict
27
27
  from nuitka.containers.OrderedSets import OrderedSet
28
+ from nuitka.Errors import NuitkaSyntaxError
28
29
  from nuitka.freezer.IncludedDataFiles import IncludedDataFile
29
30
  from nuitka.freezer.IncludedEntryPoints import IncludedEntryPoint
30
31
  from nuitka.ModuleRegistry import addUsedModule
@@ -811,7 +812,6 @@ class Plugins(object):
811
812
  def onModuleDiscovered(cls, module):
812
813
  # We offer plugins many ways to provide extra stuff
813
814
  # pylint: disable=too-many-locals,too-many-statements
814
-
815
815
  full_name = module.getFullName()
816
816
 
817
817
  def _untangleLoadDescription(description):
@@ -854,6 +854,12 @@ class Plugins(object):
854
854
  post_module_load_descriptions = []
855
855
  fake_module_descriptions = []
856
856
 
857
+ if module.isMainModule():
858
+ plugin = None
859
+ pre_module_load_descriptions.extend(
860
+ _untangleLoadDescription(_getMainModulePreloadCodes())
861
+ )
862
+
857
863
  for plugin in getActivePlugins():
858
864
  plugin.onModuleDiscovered(module)
859
865
 
@@ -1052,17 +1058,26 @@ class Plugins(object):
1052
1058
  if not os.path.isfile(source_filename):
1053
1059
  return None
1054
1060
 
1055
- return readSourceCodeFromFilename(
1056
- module_name=module_name, source_filename=source_filename, pre_load=True
1057
- )
1061
+ try:
1062
+ return readSourceCodeFromFilename(
1063
+ module_name=module_name,
1064
+ source_filename=source_filename,
1065
+ pre_load=True,
1066
+ )
1067
+ except SyntaxError as e:
1068
+ # Look ahead just not possible.
1069
+ raise NuitkaSyntaxError(e)
1058
1070
 
1059
- for plugin in getActivePlugins():
1060
- plugin.onModuleUsageLookAhead(
1061
- module_name=module_name,
1062
- module_filename=module_filename,
1063
- module_kind=module_kind,
1064
- get_module_source=getModuleSourceCode,
1065
- )
1071
+ try:
1072
+ for plugin in getActivePlugins():
1073
+ plugin.onModuleUsageLookAhead(
1074
+ module_name=module_name,
1075
+ module_filename=module_filename,
1076
+ module_kind=module_kind,
1077
+ get_module_source=getModuleSourceCode,
1078
+ )
1079
+ except NuitkaSyntaxError:
1080
+ pass
1066
1081
 
1067
1082
  @staticmethod
1068
1083
  def onModuleRecursion(
@@ -1423,7 +1438,7 @@ class Plugins(object):
1423
1438
  # Not a DLL filename, then it cannot be true, but it's kind of strange
1424
1439
  # to get asked.
1425
1440
  if dll_basename is None:
1426
- return False
1441
+ return None, None
1427
1442
 
1428
1443
  result = None
1429
1444
  plugin_name = None
@@ -1779,6 +1794,28 @@ def isTriggerModule(module):
1779
1794
  return module in pre_modules.values() or module in post_modules.values()
1780
1795
 
1781
1796
 
1797
+ # TODO: Make this a dedicated thing generally.
1798
+ def _getMainModulePreloadCodes():
1799
+ forced_runtime_env_variable_values = tuple(
1800
+ Options.getForcedRuntimeEnvironmentVariableValues()
1801
+ )
1802
+ if not forced_runtime_env_variable_values:
1803
+ return
1804
+
1805
+ result = ["import os"]
1806
+
1807
+ for (
1808
+ forced_runtime_env_variable_name,
1809
+ forced_runtime_env_variable_value,
1810
+ ) in forced_runtime_env_variable_values:
1811
+ result.append(
1812
+ "os.environ['%s'] = '%s'"
1813
+ % (forced_runtime_env_variable_name, forced_runtime_env_variable_value)
1814
+ )
1815
+
1816
+ yield ("\n".join(result), "forcing environment variable(s)")
1817
+
1818
+
1782
1819
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
1783
1820
  # integrates with CPython, but also works on its own.
1784
1821
  #
@@ -138,6 +138,14 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
138
138
  noinclude_unittest_mode,
139
139
  "unittest",
140
140
  )
141
+ self.handled_modules["keras.src.testing_infra"] = (
142
+ noinclude_unittest_mode,
143
+ "unittest",
144
+ )
145
+ self.handled_modules["tf_keras.src.testing_infra"] = (
146
+ noinclude_unittest_mode,
147
+ "unittest",
148
+ )
141
149
  else:
142
150
  self.control_tags["use_unittest"] = True
143
151
 
@@ -626,7 +634,7 @@ class %(class_name)s:
626
634
  def _applyNoFollowConfiguration(self, module_name):
627
635
  for (
628
636
  config_of_module_name,
629
- no_follow,
637
+ no_follow_pattern,
630
638
  description,
631
639
  ) in self.getYamlConfigItemItems(
632
640
  module_name=module_name,
@@ -635,7 +643,7 @@ class %(class_name)s:
635
643
  decide_relevant=lambda key, value: True,
636
644
  recursive=True,
637
645
  ):
638
- self.no_follows[no_follow] = (config_of_module_name, description)
646
+ self.no_follows[no_follow_pattern] = (config_of_module_name, description)
639
647
 
640
648
  def onModuleRecursion(
641
649
  self,
@@ -661,6 +669,8 @@ class %(class_name)s:
661
669
 
662
670
  # This will allow "unittest.mock" to pass "unittest". It's kind of a hack and
663
671
  # hopefully unusual.
672
+ if module_name == "unittest" and reason == "import path parent":
673
+ return
664
674
  if module_name == "unittest.mock" and module_name not in self.handled_modules:
665
675
  return
666
676
 
@@ -17,7 +17,6 @@ to grow both.
17
17
 
18
18
  """
19
19
 
20
-
21
20
  import re
22
21
 
23
22
  from nuitka.__past__ import intern
@@ -11,7 +11,7 @@ import pkgutil
11
11
  from nuitka import Options
12
12
  from nuitka.code_generation.ConstantCodes import addDistributionMetadataValue
13
13
  from nuitka.containers.OrderedSets import OrderedSet
14
- from nuitka.plugins.PluginBase import NuitkaPluginBase
14
+ from nuitka.plugins.PluginBase import NuitkaYamlPluginBase
15
15
  from nuitka.PythonFlavors import isDebianPackagePython
16
16
  from nuitka.utils.Distributions import getDistribution
17
17
  from nuitka.utils.FileOperations import (
@@ -19,17 +19,13 @@ from nuitka.utils.FileOperations import (
19
19
  getFileList,
20
20
  resolveShellPatternToFilenames,
21
21
  )
22
- from nuitka.utils.Yaml import getYamlPackageConfiguration
23
22
 
24
23
 
25
- class NuitkaPluginDataFileCollector(NuitkaPluginBase):
24
+ class NuitkaPluginDataFileCollector(NuitkaYamlPluginBase):
26
25
  plugin_name = "data-files"
27
26
 
28
27
  plugin_desc = "Include data files specified by package configuration files."
29
28
 
30
- def __init__(self):
31
- self.config = getYamlPackageConfiguration()
32
-
33
29
  @classmethod
34
30
  def isRelevant(cls):
35
31
  return Options.isStandaloneMode()
@@ -34,10 +34,10 @@ Extending "dill" for compiled types to be pickle-able as well.""",
34
34
  return (
35
35
  """\
36
36
  import sys
37
- sys.modules["%(module_name)s"]._create_compiled_function%(version)s = \
37
+ sys.modules[__compiled__.main]._create_compiled_function%(version)s = \
38
38
  sys.modules["%(module_name)s-preLoad"]._create_compiled_function%(version)s
39
- sys.modules["%(module_name)s"]._create_compiled_function%(version)s.__module__ = \
40
- "%(module_name)s"
39
+ sys.modules[__compiled__.main]._create_compiled_function%(version)s.__module__ = \
40
+ __compiled__.main
41
41
  """
42
42
  % {"module_name": full_name, "version": "2" if str is bytes else "3"},
43
43
  """
@@ -13,7 +13,7 @@ import os
13
13
  import sys
14
14
 
15
15
  from nuitka.Options import isStandaloneMode
16
- from nuitka.plugins.PluginBase import NuitkaPluginBase
16
+ from nuitka.plugins.PluginBase import NuitkaYamlPluginBase
17
17
  from nuitka.PythonVersions import python_version
18
18
  from nuitka.utils.Distributions import (
19
19
  getDistributionFromModuleName,
@@ -25,18 +25,14 @@ from nuitka.utils.FileOperations import (
25
25
  listExeFilesFromDirectory,
26
26
  )
27
27
  from nuitka.utils.SharedLibraries import getPyWin32Dir
28
- from nuitka.utils.Utils import isFreeBSD, isLinux, isWin32Windows
29
- from nuitka.utils.Yaml import getYamlPackageConfiguration
28
+ from nuitka.utils.Utils import isFreeBSD, isLinux, isMacOS, isWin32Windows
30
29
 
31
30
 
32
- class NuitkaPluginDllFiles(NuitkaPluginBase):
31
+ class NuitkaPluginDllFiles(NuitkaYamlPluginBase):
33
32
  plugin_name = "dll-files"
34
33
 
35
34
  plugin_desc = "Include DLLs as per package configuration files."
36
35
 
37
- def __init__(self):
38
- self.config = getYamlPackageConfiguration()
39
-
40
36
  @staticmethod
41
37
  def isAlwaysEnabled():
42
38
  return True
@@ -367,24 +363,38 @@ conditions are missing, or this version of the module needs treatment added."""
367
363
  )
368
364
 
369
365
  def getModuleSpecificDllPaths(self, module_name):
370
- for entry in self.config.get(module_name, section="import-hacks"):
371
- if self.evaluateCondition(
372
- full_name=module_name, condition=entry.get("when", "True")
373
- ):
374
- for item in self._getModuleSpecificDllPaths(config=entry):
375
- yield item
376
-
377
- def _getModuleSpecificDllPaths(self, config):
378
- for config_package_name in config.get("find-dlls-near-module", ()):
379
- module_filename = self.locateModule(config_package_name)
366
+ for _config_module_name, near_module_name in self.getYamlConfigItemSet(
367
+ module_name=module_name,
368
+ section="import-hacks",
369
+ item_name="find-dlls-near-module",
370
+ decide_relevant=None,
371
+ recursive=True,
372
+ ):
373
+ module_filename = self.locateModule(near_module_name)
380
374
 
381
375
  if module_filename is not None:
382
376
  if os.path.isfile(module_filename):
383
- yield os.path.dirname(module_filename)
377
+ package_directory = os.path.dirname(module_filename)
384
378
  else:
385
- yield module_filename
379
+ package_directory = module_filename
380
+
381
+ yield package_directory
382
+
383
+ if isMacOS():
384
+ # Some packages for macOS put their DLLs in a ".dylibs" folder,
385
+ # consider those as well, spell-checker: ignore dylibs
386
+ dylib_directory = os.path.join(package_directory, ".dylibs")
387
+
388
+ if os.path.isdir(package_directory):
389
+ yield dylib_directory
386
390
 
387
391
  def isAcceptableMissingDLL(self, package_name, dll_basename):
392
+ if package_name is None:
393
+ return None
394
+
395
+ # Config is to be attached to top level package.
396
+ package_name = package_name.getTopLevelPackageName()
397
+
388
398
  for entry in self.config.get(package_name, section="import-hacks"):
389
399
  if self.evaluateCondition(
390
400
  full_name=package_name, condition=entry.get("when", "True")
@@ -409,10 +419,6 @@ conditions are missing, or this version of the module needs treatment added."""
409
419
  def decideAllowOutsideDependencies(self, module_name):
410
420
  distribution = None
411
421
 
412
- assert module_name != "_ctypes", self.config.get(
413
- module_name, section="import-hacks"
414
- )
415
-
416
422
  while 1:
417
423
  for entry in self.config.get(module_name, section="import-hacks"):
418
424
  if self.evaluateCondition(
@@ -3,6 +3,7 @@
3
3
 
4
4
  """ Support for gi typelib files and DLLs
5
5
  """
6
+
6
7
  import os
7
8
 
8
9
  from nuitka.plugins.PluginBase import NuitkaPluginBase, standalone_only
@@ -15,13 +15,12 @@ import os
15
15
  from nuitka.__past__ import iter_modules, unicode
16
16
  from nuitka.importing.Importing import locateModule
17
17
  from nuitka.importing.Recursion import decideRecursion
18
- from nuitka.plugins.PluginBase import NuitkaPluginBase
18
+ from nuitka.plugins.PluginBase import NuitkaYamlPluginBase
19
19
  from nuitka.utils.ModuleNames import ModuleName
20
20
  from nuitka.utils.Utils import isMacOS, isWin32Windows
21
- from nuitka.utils.Yaml import getYamlPackageConfiguration
22
21
 
23
22
 
24
- class NuitkaPluginImplicitImports(NuitkaPluginBase):
23
+ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
25
24
  plugin_name = "implicit-imports"
26
25
 
27
26
  plugin_desc = (
@@ -29,7 +28,7 @@ class NuitkaPluginImplicitImports(NuitkaPluginBase):
29
28
  )
30
29
 
31
30
  def __init__(self):
32
- self.config = getYamlPackageConfiguration()
31
+ NuitkaYamlPluginBase.__init__(self)
33
32
 
34
33
  self.lazy_loader_usages = {}
35
34
 
@@ -486,9 +485,11 @@ __file__ = (__nuitka_binary_dir + '%ssite.py') if '__nuitka_binary_dir' in dict(
486
485
 
487
486
  submodule_attrs = dict(
488
487
  (
489
- module_name.getChildNamed(submodule[1:])
490
- if submodule.startswith(".")
491
- else ModuleName(submodule),
488
+ (
489
+ module_name.getChildNamed(submodule[1:])
490
+ if submodule.startswith(".")
491
+ else ModuleName(submodule)
492
+ ),
492
493
  tuple(attribute_names),
493
494
  )
494
495
  for (submodule, attribute_names) in sorted(submodule_attrs.items())
@@ -660,6 +661,7 @@ According to Yaml 'overridden-environment-variables' configuration."""
660
661
  "rich", # Not performance relevant and memory leaking due to empty compiled cell leaks
661
662
  "altair.vegalite.v5.schema", # Not performance relevant.
662
663
  "azure", # Not performance relevant.
664
+ "networkx", # Needs solutions for bytecode requiring decorators.
663
665
  )
664
666
 
665
667
  unworthy_modulename_patterns = (
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  """ Matplotlib standard plugin module. """
5
+
5
6
  import os
6
7
 
7
8
  from nuitka.Options import isStandaloneMode
@@ -15,21 +15,17 @@ from nuitka.Options import (
15
15
  shallCreateAppBundle,
16
16
  shallDisableConsoleWindow,
17
17
  )
18
- from nuitka.plugins.PluginBase import NuitkaPluginBase
18
+ from nuitka.plugins.PluginBase import NuitkaYamlPluginBase
19
19
  from nuitka.utils.Utils import isMacOS
20
- from nuitka.utils.Yaml import getYamlPackageConfiguration
21
20
 
22
21
 
23
- class NuitkaPluginOptionsNanny(NuitkaPluginBase):
22
+ class NuitkaPluginOptionsNanny(NuitkaYamlPluginBase):
24
23
  plugin_name = "options-nanny"
25
24
 
26
25
  plugin_desc = (
27
26
  "Inform the user about potential problems as per package configuration files."
28
27
  )
29
28
 
30
- def __init__(self):
31
- self.config = getYamlPackageConfiguration()
32
-
33
29
  @staticmethod
34
30
  def isAlwaysEnabled():
35
31
  return True
@@ -52,7 +48,7 @@ class NuitkaPluginOptionsNanny(NuitkaPluginBase):
52
48
  else:
53
49
  if condition != "True":
54
50
  problem_desc = (
55
- " with incomplete support due to untrue condition '%s'" % condition
51
+ " with incomplete support due to condition '%s'" % condition
56
52
  )
57
53
  else:
58
54
  problem_desc = " with incomplete support"
@@ -8,7 +8,6 @@ runtime, but that is done by nodes and optimization. But there are other things,
8
8
  that need special case, e.g. the registration of the loader class.
9
9
  """
10
10
 
11
-
12
11
  import re
13
12
 
14
13
  from nuitka.plugins.PluginBase import NuitkaPluginBase
@@ -19,7 +19,7 @@ from nuitka.utils.FileOperations import getFileContents, listDir
19
19
 
20
20
  # The order of these files is significant. Files which reference
21
21
  # other files must appear later. Files may be deleted if they are not
22
- # used.
22
+ # used. spell-checker: ignore TimeFuncs
23
23
  files = [
24
24
  "Dialog",
25
25
  "TimeFuncs",
@@ -93,7 +93,7 @@ Should 'Pmw.Color' not be included, Default is to include it.""",
93
93
  return source_code
94
94
 
95
95
  def _packagePmw(self, pmw_path):
96
- self.info("Packaging Pmw into single module fpor freezing.")
96
+ self.info("Packaging Pmw into single module for freezing.")
97
97
 
98
98
  # Algorithm is from the "__init__.py" of Pwm:
99
99
 
@@ -131,12 +131,12 @@ Should 'Pmw.Color' not be included, Default is to include it.""",
131
131
 
132
132
  return self._packagePmw2(candidate, version)
133
133
 
134
- def _packagePmw2(self, srcdir, version):
135
- def mungeFile(filename):
134
+ def _packagePmw2(self, src_dir, version):
135
+ def treatFile(filename):
136
136
  # Read the filename and modify it so that it can be bundled with the
137
- # other Pmw files.
137
+ # other Pmw files. spell-checker: ignore INITOPT
138
138
  filename = "Pmw" + filename + ".py"
139
- text = getFileContents(os.path.join(srcdir, filename))
139
+ text = getFileContents(os.path.join(src_dir, filename))
140
140
  text = re.sub(r"import Pmw\>", "", text)
141
141
  text = re.sub("INITOPT = Pmw.INITOPT", "", text)
142
142
  text = re.sub(r"\<Pmw\.", "", text)
@@ -155,12 +155,13 @@ from . import PmwBlt
155
155
  Blt = PmwBlt
156
156
  del PmwBlt
157
157
  """
158
- # Code used when not linking with PmwBlt.py.
158
+ # Code used when not linking with PmwBlt.py, spell-checker: ignore _bltbusyOK
159
159
  ignore_blt_code = """
160
160
  _bltImported = 1
161
161
  _bltbusyOK = 0
162
162
  """
163
163
  # Code to define the functions normally supplied by the dynamic loader.
164
+ # spell-checker: ignore setversion,setalphaversions,installedversions
164
165
  extra_code = """
165
166
 
166
167
  ### Loader functions:
@@ -200,7 +201,7 @@ def installedversions(alpha = 0):
200
201
  outfile.write(extra_code % version)
201
202
 
202
203
  # Specially handle PmwBase.py filename:
203
- text = mungeFile("Base")
204
+ text = treatFile("Base")
204
205
  text = re.sub("from . import PmwLogicalFont", "", text)
205
206
  text = re.sub("import PmwLogicalFont", "", text)
206
207
  text = re.sub("PmwLogicalFont._font_initialise", "_font_initialise", text)
@@ -212,7 +213,7 @@ def installedversions(alpha = 0):
212
213
  files.append("LogicalFont")
213
214
 
214
215
  for filename in files:
215
- text = mungeFile(filename)
216
+ text = treatFile(filename)
216
217
  outfile.write(text)
217
218
 
218
219
  return outfile.getvalue()
@@ -1045,34 +1045,6 @@ Prefix = .
1045
1045
  reason="needed by '%s'" % full_name.asString(),
1046
1046
  )
1047
1047
 
1048
- def removeDllDependencies(self, dll_filename, dll_filenames):
1049
- for value in self.getQtPluginDirs():
1050
- # TODO: That is not a proper check if a file is below that.
1051
- if dll_filename.startswith(value):
1052
- for sub_dll_filename in dll_filenames:
1053
- for badword in (
1054
- "libKF5",
1055
- "libkfontinst",
1056
- "libkorganizer",
1057
- "libplasma",
1058
- "libakregator",
1059
- "libdolphin",
1060
- "libnoteshared",
1061
- "libknotes",
1062
- "libsystemsettings",
1063
- "libkerfuffle",
1064
- "libkaddressbook",
1065
- "libkworkspace",
1066
- "libkmail",
1067
- "libmilou",
1068
- "libtaskmanager",
1069
- "libkonsole",
1070
- "libgwenview",
1071
- "libweather_ion",
1072
- ):
1073
- if os.path.basename(sub_dll_filename).startswith(badword):
1074
- yield sub_dll_filename
1075
-
1076
1048
  def onModuleEncounter(
1077
1049
  self, using_module_name, module_name, module_filename, module_kind
1078
1050
  ):
@@ -3,6 +3,7 @@
3
3
 
4
4
  """ Deprecated tensorflow plugin.
5
5
  """
6
+
6
7
  from nuitka.plugins.PluginBase import NuitkaPluginBase
7
8
 
8
9
 
@@ -3,6 +3,7 @@
3
3
 
4
4
  """ Deprecated torch plugin.
5
5
  """
6
+
6
7
  from nuitka.plugins.PluginBase import NuitkaPluginBase
7
8
 
8
9
 
@@ -3,6 +3,7 @@
3
3
 
4
4
  """ Deprecated trio plugin.
5
5
  """
6
+
6
7
  from nuitka.plugins.PluginBase import NuitkaPluginBase
7
8
 
8
9