Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.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 (210) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +210 -207
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +29 -2
  7. nuitka/MainControl.py +62 -35
  8. nuitka/ModuleRegistry.py +11 -3
  9. nuitka/OptionParsing.py +78 -39
  10. nuitka/Options.py +142 -35
  11. nuitka/OutputDirectories.py +5 -0
  12. nuitka/PostProcessing.py +23 -14
  13. nuitka/PythonFlavors.py +22 -4
  14. nuitka/PythonVersions.py +18 -0
  15. nuitka/TreeXML.py +6 -3
  16. nuitka/Version.py +1 -1
  17. nuitka/__main__.py +55 -10
  18. nuitka/build/Backend.scons +6 -1
  19. nuitka/build/CCompilerVersion.scons +1 -0
  20. nuitka/build/Onefile.scons +4 -0
  21. nuitka/build/SconsCaching.py +1 -0
  22. nuitka/build/SconsCompilerSettings.py +1 -0
  23. nuitka/build/SconsHacks.py +5 -1
  24. nuitka/build/SconsInterface.py +2 -0
  25. nuitka/build/SconsUtils.py +4 -1
  26. nuitka/build/include/nuitka/allocator.h +27 -5
  27. nuitka/build/include/nuitka/calling.h +1 -1
  28. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  29. nuitka/build/include/nuitka/compiled_method.h +1 -1
  30. nuitka/build/include/nuitka/exception_groups.h +0 -2
  31. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  33. nuitka/build/include/nuitka/helpers.h +7 -4
  34. nuitka/build/include/nuitka/prelude.h +6 -10
  35. nuitka/build/include/nuitka/printing.h +2 -0
  36. nuitka/build/include/nuitka/unfreezing.h +5 -5
  37. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  38. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  39. nuitka/build/static_src/CompiledCellType.c +7 -7
  40. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  41. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  42. nuitka/build/static_src/CompiledFrameType.c +109 -82
  43. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  44. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  46. nuitka/build/static_src/CompiledMethodType.c +14 -13
  47. nuitka/build/static_src/HelpersAttributes.c +13 -15
  48. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  49. nuitka/build/static_src/HelpersCalling.c +13 -13
  50. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  51. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  52. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  53. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  54. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  56. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  58. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  59. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  60. nuitka/build/static_src/HelpersFiles.c +2 -2
  61. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  62. nuitka/build/static_src/HelpersImport.c +1 -1
  63. nuitka/build/static_src/HelpersLists.c +5 -1
  64. nuitka/build/static_src/HelpersMatching.c +95 -35
  65. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  66. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  67. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  68. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  69. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  71. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  72. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  73. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  74. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  75. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  76. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  77. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  78. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  80. nuitka/build/static_src/HelpersSequences.c +1 -1
  81. nuitka/build/static_src/HelpersTypes.c +8 -4
  82. nuitka/build/static_src/MainProgram.c +28 -9
  83. nuitka/build/static_src/MetaPathBasedLoader.c +124 -108
  84. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  85. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +1 -1
  86. nuitka/build/static_src/OnefileBootstrap.c +34 -6
  87. nuitka/code_generation/AttributeCodes.py +12 -10
  88. nuitka/code_generation/CodeGeneration.py +6 -7
  89. nuitka/code_generation/ConstantCodes.py +53 -10
  90. nuitka/code_generation/GlobalConstants.py +6 -6
  91. nuitka/code_generation/Indentation.py +3 -4
  92. nuitka/code_generation/LoaderCodes.py +3 -0
  93. nuitka/code_generation/LocalsDictCodes.py +36 -14
  94. nuitka/code_generation/MatchCodes.py +23 -4
  95. nuitka/code_generation/ModuleCodes.py +0 -7
  96. nuitka/code_generation/Namify.py +2 -0
  97. nuitka/code_generation/PackageResourceCodes.py +5 -1
  98. nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
  99. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  100. nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
  101. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  102. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  103. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  104. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  105. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  106. nuitka/freezer/DependsExe.py +3 -1
  107. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  108. nuitka/freezer/IncludedDataFiles.py +12 -3
  109. nuitka/freezer/IncludedEntryPoints.py +8 -2
  110. nuitka/freezer/Onefile.py +6 -1
  111. nuitka/freezer/Standalone.py +9 -2
  112. nuitka/importing/Importing.py +14 -5
  113. nuitka/importing/Recursion.py +3 -0
  114. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  115. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  116. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  117. nuitka/nodes/BuiltinRefNodes.py +41 -1
  118. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  119. nuitka/nodes/ClassNodes.py +30 -12
  120. nuitka/nodes/CodeObjectSpecs.py +9 -0
  121. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  122. nuitka/nodes/FunctionNodes.py +7 -11
  123. nuitka/nodes/FutureSpecs.py +16 -3
  124. nuitka/nodes/GeneratorNodes.py +2 -2
  125. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  126. nuitka/nodes/LocalsScopes.py +19 -23
  127. nuitka/nodes/MatchNodes.py +18 -7
  128. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  129. nuitka/nodes/ModuleNodes.py +23 -6
  130. nuitka/nodes/NodeBases.py +3 -2
  131. nuitka/nodes/NodeMetaClasses.py +26 -10
  132. nuitka/nodes/ReturnNodes.py +1 -1
  133. nuitka/nodes/StatementBasesGenerated.py +11 -11
  134. nuitka/nodes/SubscriptNodes.py +4 -4
  135. nuitka/nodes/VariableAssignNodes.py +1 -1
  136. nuitka/nodes/VariableRefNodes.py +28 -2
  137. nuitka/optimizations/FunctionInlining.py +3 -6
  138. nuitka/optimizations/Optimization.py +13 -12
  139. nuitka/optimizations/TraceCollections.py +19 -4
  140. nuitka/plugins/PluginBase.py +121 -133
  141. nuitka/plugins/Plugins.py +91 -3
  142. nuitka/plugins/YamlPluginBase.py +121 -0
  143. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  144. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  145. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  146. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  147. nuitka/plugins/standard/ImplicitImports.py +34 -20
  148. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  149. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  150. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  151. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  152. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  153. nuitka/plugins/standard/standard.nuitka-package.config.yml +462 -179
  154. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
  155. nuitka/reports/Reports.py +53 -5
  156. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  157. nuitka/specs/HardImportSpecs.py +0 -6
  158. nuitka/tools/data_composer/DataComposer.py +29 -27
  159. nuitka/tools/environments/CreateEnvironment.py +1 -0
  160. nuitka/tools/environments/Virtualenv.py +25 -11
  161. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  162. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  163. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  164. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  165. nuitka/tools/specialize/SpecializePython.py +18 -1
  166. nuitka/tools/testing/Common.py +19 -6
  167. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  168. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  169. nuitka/tools/watch/AutoStage.py +144 -0
  170. nuitka/tools/watch/__main__.py +79 -32
  171. nuitka/tree/Building.py +105 -104
  172. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  173. nuitka/tree/InternalModule.py +8 -0
  174. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  175. nuitka/tree/ReformulationClasses.py +10 -17
  176. nuitka/tree/ReformulationClasses3.py +69 -43
  177. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  178. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  179. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  180. nuitka/tree/ReformulationExecStatements.py +10 -10
  181. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  182. nuitka/tree/ReformulationFunctionStatements.py +21 -28
  183. nuitka/tree/ReformulationImportStatements.py +8 -10
  184. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  185. nuitka/tree/ReformulationMatchStatements.py +166 -60
  186. nuitka/tree/ReformulationMultidist.py +3 -1
  187. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  188. nuitka/tree/ReformulationPrintStatements.py +3 -6
  189. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  190. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  191. nuitka/tree/ReformulationWithStatements.py +12 -16
  192. nuitka/tree/SourceHandling.py +13 -8
  193. nuitka/tree/VariableClosure.py +5 -21
  194. nuitka/utils/Distributions.py +80 -11
  195. nuitka/utils/Download.py +38 -31
  196. nuitka/utils/Execution.py +13 -2
  197. nuitka/utils/FileOperations.py +55 -28
  198. nuitka/utils/Images.py +6 -1
  199. nuitka/utils/Importing.py +1 -1
  200. nuitka/utils/ModuleNames.py +11 -5
  201. nuitka/utils/ReExecute.py +17 -13
  202. nuitka/utils/SharedLibraries.py +32 -8
  203. nuitka/utils/Signing.py +3 -1
  204. nuitka/utils/StaticLibraries.py +51 -41
  205. nuitka/utils/Timing.py +1 -1
  206. nuitka/utils/Utils.py +29 -7
  207. /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
  208. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
  209. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
  210. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
@@ -798,7 +798,7 @@ class StatementAssignmentVariableConstantMutableTrusted(
798
798
 
799
799
  @staticmethod
800
800
  def hasVeryTrustedValue():
801
- return True
801
+ return False
802
802
 
803
803
 
804
804
  class StatementAssignmentVariableConstantImmutableTrusted(
@@ -318,6 +318,23 @@ Subscript del to dictionary lowered to dictionary del."""
318
318
  Subscript look-up to dictionary lowered to dictionary look-up.""",
319
319
  )
320
320
 
321
+ if subscript.isCompileTimeConstant():
322
+ attribute_node = self.variable_trace.getAttributeNode()
323
+
324
+ if attribute_node is not None:
325
+ # TODO: That could probably be one single question.
326
+ if (
327
+ attribute_node.isCompileTimeConstant()
328
+ and not attribute_node.isMutable()
329
+ ):
330
+ return trace_collection.getCompileTimeComputationResult(
331
+ node=lookup_node,
332
+ computation=lambda: attribute_node.getCompileTimeConstant()[
333
+ subscript.getCompileTimeConstant()
334
+ ],
335
+ description="Subscript of variable immutable value.",
336
+ )
337
+
321
338
  # Any code could be run, note that.
322
339
  trace_collection.onControlFlowEscape(self)
323
340
 
@@ -420,6 +437,15 @@ class ExpressionVariableRef(ExpressionVariableRefBase):
420
437
  # could be decided from context.
421
438
  trace_collection.onExceptionRaiseExit(BaseException)
422
439
 
440
+ very_trusted_node = self.variable_trace.getAttributeNodeVeryTrusted()
441
+ if very_trusted_node is not None:
442
+ return (
443
+ very_trusted_node.makeClone(),
444
+ "new_expression",
445
+ lambda: "Forward propagating value of %s from very trusted %s value."
446
+ % (self.getVariableName(), very_trusted_node.kind),
447
+ )
448
+
423
449
  if variable.isModuleVariable() and (
424
450
  variable.hasDefiniteWrites() is False or variable.getName() == "super"
425
451
  ):
@@ -494,7 +520,7 @@ Replaced read-only module attribute '__package__' with module attribute referenc
494
520
  change_tags = "new_expression"
495
521
  change_desc = """\
496
522
  Replaced read-only module attribute '__loader__' with module attribute reference."""
497
- elif variable_name == "__spec__" and python_version >= 0x340:
523
+ elif variable_name == "__spec__" and python_version >= 0x300:
498
524
  new_node = ExpressionModuleAttributeSpecRef(
499
525
  variable=variable, source_ref=self.source_ref
500
526
  )
@@ -586,7 +612,7 @@ Replaced read-only module attribute '__spec__' with module attribute reference."
586
612
  return (
587
613
  bool(attribute_node.getCompileTimeConstant()),
588
614
  attribute_node.makeClone(),
589
- "Using very trusted constant truth value.",
615
+ "Using trusted constant's truth value.",
590
616
  )
591
617
 
592
618
  # TODO: This is probably only default stuff here, that could be compressed.
@@ -9,10 +9,9 @@ from the in-lined function.
9
9
 
10
10
  from nuitka.nodes.OutlineNodes import ExpressionOutlineBody
11
11
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
12
- from nuitka.nodes.VariableReleaseNodes import makeStatementsReleaseVariables
13
12
  from nuitka.tree.Operations import VisitorNoopMixin, visitTree
14
13
  from nuitka.tree.ReformulationTryFinallyStatements import (
15
- makeTryFinallyStatement,
14
+ makeTryFinallyReleaseStatement,
16
15
  )
17
16
  from nuitka.tree.TreeHelpers import makeStatementsSequence
18
17
 
@@ -83,12 +82,10 @@ def convertFunctionCallToOutline(provider, function_body, values, call_source_re
83
82
 
84
83
  # TODO: Not possible to auto release with outline bodies too?
85
84
  if auto_releases:
86
- body = makeTryFinallyStatement(
85
+ body = makeTryFinallyReleaseStatement(
87
86
  provider=outline_body,
88
87
  tried=body,
89
- final=makeStatementsReleaseVariables(
90
- variables=auto_releases, source_ref=function_source_ref
91
- ),
88
+ variables=auto_releases,
92
89
  source_ref=function_source_ref,
93
90
  )
94
91
 
@@ -26,7 +26,7 @@ from nuitka.utils.Timing import TimerReport
26
26
  from . import Graphs
27
27
  from .BytecodeDemotion import demoteCompiledModuleToBytecode
28
28
  from .Tags import TagSet
29
- from .TraceCollections import withChangeIndicationsTo
29
+ from .TraceCollections import fetchMergeCounts, withChangeIndicationsTo
30
30
 
31
31
  tag_set = None
32
32
 
@@ -68,7 +68,12 @@ def optimizeCompiledPythonModule(module):
68
68
  # allow to continue the loop even without changes one more time.
69
69
  unchanged_count = 0
70
70
 
71
+ # Count the micro passes, so we can see how often we looped
72
+ micro_pass = 0
73
+
71
74
  while True:
75
+ micro_pass += 1
76
+
72
77
  tag_set.clear()
73
78
 
74
79
  try:
@@ -120,7 +125,7 @@ def optimizeCompiledPythonModule(module):
120
125
 
121
126
  considerUsedModules(module=module, pass_count=pass_count)
122
127
 
123
- return touched
128
+ return touched, micro_pass
124
129
 
125
130
 
126
131
  def optimizeUncompiledPythonModule(module):
@@ -156,14 +161,12 @@ def optimizeModule(module):
156
161
 
157
162
  if module.isPythonExtensionModule():
158
163
  optimizeExtensionModule(module)
159
- changed = False
164
+ return False, 0
160
165
  elif module.isCompiledPythonModule():
161
- changed = optimizeCompiledPythonModule(module)
166
+ return optimizeCompiledPythonModule(module)
162
167
  else:
163
168
  optimizeUncompiledPythonModule(module)
164
- changed = False
165
-
166
- return changed
169
+ return False, 0
167
170
 
168
171
 
169
172
  pass_count = 0
@@ -250,8 +253,6 @@ def restoreFromXML(text):
250
253
  def makeOptimizationPass():
251
254
  """Make a single pass for optimization, indication potential completion."""
252
255
 
253
- # Controls complex optimization
254
-
255
256
  finished = True
256
257
 
257
258
  ModuleRegistry.startTraversal()
@@ -284,14 +285,14 @@ def makeOptimizationPass():
284
285
  with TimerReport(
285
286
  message="Optimizing %s" % module_name, decider=False
286
287
  ) as module_timer:
287
- changed = optimizeModule(current_module)
288
-
289
- # module_timer=module_time_report.getTimer()
288
+ changed, micro_passes = optimizeModule(current_module)
290
289
 
291
290
  ModuleRegistry.addModuleOptimizationTimeInformation(
292
291
  module_name=module_name,
293
292
  pass_number=pass_count,
294
293
  time_used=module_timer.getDelta(),
294
+ micro_passes=micro_passes,
295
+ merge_counts=fetchMergeCounts(),
295
296
  )
296
297
 
297
298
  _traceProgressModuleEnd(current_module)
@@ -51,6 +51,16 @@ from .ValueTraces import (
51
51
  ValueTraceUnknown,
52
52
  )
53
53
 
54
+ # Keeping trace of how often branches are merged between calls
55
+ _merge_counts = defaultdict(int)
56
+
57
+
58
+ def fetchMergeCounts():
59
+ result = dict(_merge_counts)
60
+ _merge_counts.clear()
61
+ return result
62
+
63
+
54
64
  signalChange = None
55
65
 
56
66
 
@@ -189,10 +199,10 @@ class CollectionStartPointMixin(CollectionUpdateMixin):
189
199
 
190
200
  # TODO: We might want to track per exception, pylint: disable=unused-argument
191
201
 
192
- if collection is None:
193
- collection = self
194
-
195
202
  if self.exception_collections is not None:
203
+ if collection is None:
204
+ collection = self
205
+
196
206
  self.exception_collections.append(
197
207
  TraceCollectionBranch(parent=collection, name="exception")
198
208
  )
@@ -754,6 +764,8 @@ class TraceCollectionBase(object):
754
764
  collection1 = collection_yes
755
765
  collection2 = collection_no
756
766
 
767
+ _merge_counts[2] += 1
768
+
757
769
  variable_versions = {}
758
770
 
759
771
  for variable, version in iterItems(collection1.variable_actives):
@@ -816,7 +828,8 @@ class TraceCollectionBase(object):
816
828
  elif merge_size == 2:
817
829
  return self.mergeBranches(*collections)
818
830
 
819
- # print("Enter mergeMultipleBranches", len(collections))
831
+ _merge_counts[len(collections)] += 1
832
+
820
833
  with TimerReport(
821
834
  message="Running merge for %s took %%.2f seconds" % collections,
822
835
  decider=False,
@@ -874,6 +887,8 @@ class TraceCollectionBase(object):
874
887
  self.variable_actives.update(collection_replace.variable_actives)
875
888
  collection_replace.variable_actives = None
876
889
 
890
+ _merge_counts[1] += 1
891
+
877
892
  def onLoopBreak(self, collection=None):
878
893
  if collection is None:
879
894
  collection = self
@@ -43,10 +43,14 @@ from nuitka.ModuleRegistry import (
43
43
  getModuleInclusionInfoByName,
44
44
  )
45
45
  from nuitka.Options import (
46
- hasPythonFlagNoAnnotations,
47
- hasPythonFlagNoAsserts,
48
- hasPythonFlagNoDocStrings,
46
+ getCompanyName,
47
+ getFileVersion,
48
+ getProductFileVersion,
49
+ getProductName,
50
+ getProductVersion,
49
51
  isDeploymentMode,
52
+ isOnefileMode,
53
+ isOnefileTempDirMode,
50
54
  isStandaloneMode,
51
55
  shallCreateAppBundle,
52
56
  shallMakeModule,
@@ -70,7 +74,11 @@ from nuitka.utils.Distributions import (
70
74
  getDistributionName,
71
75
  isDistributionCondaPackage,
72
76
  )
73
- from nuitka.utils.Execution import NuitkaCalledProcessError, check_output
77
+ from nuitka.utils.Execution import (
78
+ NuitkaCalledProcessError,
79
+ check_output,
80
+ withEnvironmentVarsOverridden,
81
+ )
74
82
  from nuitka.utils.FileOperations import (
75
83
  changeFilenameExtension,
76
84
  getFileContents,
@@ -84,6 +92,7 @@ from nuitka.utils.ModuleNames import (
84
92
  )
85
93
  from nuitka.utils.SharedLibraries import locateDLL, locateDLLsInDirectory
86
94
  from nuitka.utils.SlotMetaClasses import getMetaClassBase
95
+ from nuitka.utils.StaticLibraries import getSystemStaticLibPythonPath
87
96
  from nuitka.utils.Utils import (
88
97
  getArchitecture,
89
98
  isAndroidBasedLinux,
@@ -92,7 +101,6 @@ from nuitka.utils.Utils import (
92
101
  isWin32Windows,
93
102
  withNoWarning,
94
103
  )
95
- from nuitka.utils.Yaml import getYamlPackageConfiguration
96
104
 
97
105
  _warned_unused_plugins = set()
98
106
 
@@ -119,6 +127,15 @@ def _getImportLibModule():
119
127
  return importlib
120
128
 
121
129
 
130
+ def _makeEvaluationContext(logger, full_name, config_name):
131
+ context = TagContext(logger=logger, full_name=full_name, config_name=config_name)
132
+ context.update(control_tags)
133
+
134
+ context.update(_getEvaluationContext())
135
+
136
+ return context
137
+
138
+
122
139
  def _getEvaluationContext():
123
140
  # Using global here, as this is really a singleton, in the form of a module,
124
141
  # pylint: disable=global-statement
@@ -137,16 +154,21 @@ def _getEvaluationContext():
137
154
  "debian_python": isDebianPackagePython(),
138
155
  "nuitka_python": isNuitkaPython(),
139
156
  "standalone": isStandaloneMode(),
157
+ "onefile": isOnefileMode(),
158
+ "onefile_cached": not isOnefileTempDirMode(),
140
159
  "module_mode": shallMakeModule(),
141
160
  "deployment": isDeploymentMode(),
161
+ # Version information
162
+ "company": getCompanyName(),
163
+ "product": getProductName(),
164
+ "file_version": getFileVersion(),
165
+ "product_version": getProductVersion(),
166
+ "combined_version": getProductFileVersion(),
142
167
  # Querying package versions.
143
168
  "version": _getPackageVersion,
144
169
  "version_str": _getPackageVersionStr,
145
170
  "get_dist_name": _getDistributionNameFromPackageName,
146
171
  "plugin": _isPluginActive,
147
- "no_asserts": hasPythonFlagNoAsserts(),
148
- "no_docstrings": hasPythonFlagNoDocStrings(),
149
- "no_annotations": hasPythonFlagNoAnnotations(),
150
172
  # Iterating packages
151
173
  "iterate_modules": _iterate_module_names,
152
174
  # Locating package directories
@@ -166,6 +188,8 @@ def _getEvaluationContext():
166
188
  # Python version string
167
189
  "python_version_str": python_version_str,
168
190
  "python_version_full_str": python_version_full_str,
191
+ # Technical requirements
192
+ "static_libpython": getSystemStaticLibPythonPath() is not None,
169
193
  # Builtins
170
194
  "True": True,
171
195
  "False": False,
@@ -1055,6 +1079,18 @@ Unwanted import of '%(unwanted)s' that %(problem)s '%(binding_name)s' encountere
1055
1079
  # Virtual method, pylint: disable=no-self-use,unused-argument
1056
1080
  return None
1057
1081
 
1082
+ def decideAnnotations(self, module_name):
1083
+ # Virtual method, pylint: disable=no-self-use,unused-argument
1084
+ return None
1085
+
1086
+ def decideDocStrings(self, module_name):
1087
+ # Virtual method, pylint: disable=no-self-use,unused-argument
1088
+ return None
1089
+
1090
+ def decideAsserts(self, module_name):
1091
+ # Virtual method, pylint: disable=no-self-use,unused-argument
1092
+ return None
1093
+
1058
1094
  def getPreprocessorSymbols(self):
1059
1095
  """Decide which C defines to be used in compilation.
1060
1096
 
@@ -1245,7 +1281,7 @@ except ImportError:
1245
1281
  return None
1246
1282
 
1247
1283
  if Options.is_debug:
1248
- self.info(cmd)
1284
+ self.info(cmd, keep_format=True)
1249
1285
 
1250
1286
  raise
1251
1287
 
@@ -1386,16 +1422,22 @@ except ImportError:
1386
1422
  for count, variable_config in enumerate(
1387
1423
  self.config.get(full_name, section="variables")
1388
1424
  ):
1389
- setup_codes = variable_config.get("setup_code")
1390
- declarations = variable_config.get("declarations")
1425
+ environment = variable_config.get("environment", {})
1426
+ setup_codes = variable_config.get("setup_code", [])
1427
+ if type(setup_codes) is str:
1428
+ setup_codes = setup_codes.splitlines()
1429
+ declarations = variable_config.get("declarations", {})
1391
1430
 
1392
- if declarations and self.evaluateCondition(
1431
+ if len(declarations) < 1:
1432
+ self.sysexit(
1433
+ "Error, no variable 'declarations' for %s makes no sense."
1434
+ % full_name
1435
+ )
1436
+
1437
+ if self.evaluateCondition(
1393
1438
  full_name=full_name,
1394
1439
  condition=variable_config.get("when", "True"),
1395
1440
  ):
1396
- if type(setup_codes) is str:
1397
- setup_codes = setup_codes.splitlines()
1398
-
1399
1441
  setup_codes.extend(
1400
1442
  "%s=%r" % (constant_name, constant_value)
1401
1443
  for (
@@ -1404,11 +1446,31 @@ except ImportError:
1404
1446
  ) in self.getExpressionConstants(full_name=full_name).items()
1405
1447
  )
1406
1448
 
1407
- info = self.queryRuntimeInformationMultiple(
1408
- "%s_variables_%s" % (full_name.asString(), count),
1409
- setup_codes=setup_codes,
1410
- values=tuple(declarations.items()),
1411
- )
1449
+ env_variables = {}
1450
+
1451
+ for env_name, env_value in environment.items():
1452
+ env_variables[env_name] = self.evaluateExpressionOrConstant(
1453
+ full_name=full_name,
1454
+ expression=env_value,
1455
+ config_name="variables config #%d" % count,
1456
+ extra_context=None,
1457
+ single_value=True,
1458
+ )
1459
+
1460
+ with withEnvironmentVarsOverridden(env_variables):
1461
+ info = self.queryRuntimeInformationMultiple(
1462
+ "%s_variables_%s" % (full_name.asString(), count),
1463
+ setup_codes=setup_codes,
1464
+ values=tuple(declarations.items()),
1465
+ )
1466
+
1467
+ if Options.isExperimental("display-yaml-variables"):
1468
+ self.info("Evaluated %r" % info)
1469
+
1470
+ if info is None:
1471
+ self.sysexit(
1472
+ "Error, failed to evaluate variables for %s." % full_name
1473
+ )
1412
1474
 
1413
1475
  variables.update(info.asDict())
1414
1476
 
@@ -1419,10 +1481,9 @@ except ImportError:
1419
1481
  def evaluateExpression(
1420
1482
  self, full_name, expression, config_name, extra_context, single_value
1421
1483
  ):
1422
- context = TagContext(logger=self, full_name=full_name, config_name=config_name)
1423
- context.update(control_tags)
1424
-
1425
- context.update(_getEvaluationContext())
1484
+ context = _makeEvaluationContext(
1485
+ logger=self, full_name=full_name, config_name=config_name
1486
+ )
1426
1487
 
1427
1488
  def get_variable(variable_name):
1428
1489
  assert type(variable_name) is str, variable_name
@@ -1521,12 +1582,10 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
1521
1582
  if condition == "False":
1522
1583
  return False
1523
1584
 
1524
- context = TagContext(
1585
+ # TODO: Maybe add module name to config name?
1586
+ context = _makeEvaluationContext(
1525
1587
  logger=self, full_name=full_name, config_name="'when' configuration"
1526
1588
  )
1527
- context.update(control_tags)
1528
-
1529
- context.update(_getEvaluationContext())
1530
1589
 
1531
1590
  def get_parameter(parameter_name, default):
1532
1591
  result = Options.getModuleParameter(full_name, parameter_name)
@@ -1609,6 +1668,11 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
1609
1668
  def info(cls, message, keep_format=False):
1610
1669
  plugins_logger.info(message, prefix=cls.plugin_name, keep_format=keep_format)
1611
1670
 
1671
+ @classmethod
1672
+ def debug(cls, message, keep_format=False):
1673
+ if Options.is_debug:
1674
+ cls.info(message, keep_format=keep_format)
1675
+
1612
1676
  @classmethod
1613
1677
  def sysexit(cls, message, mnemonic=None, reporting=True):
1614
1678
  plugins_logger.sysexit(
@@ -1616,96 +1680,46 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
1616
1680
  )
1617
1681
 
1618
1682
 
1619
- class NuitkaYamlPluginBase(NuitkaPluginBase):
1620
- """Nuitka base class for all plugins that use yaml config"""
1621
-
1622
- def __init__(self):
1623
- self.config = getYamlPackageConfiguration()
1624
-
1625
- def getYamlConfigItem(
1626
- self, module_name, section, item_name, decide_relevant, default, recursive
1627
- ):
1628
- while True:
1629
- module_configs = self.config.get(module_name, section=section)
1630
-
1631
- if module_configs is not None:
1632
- for module_config in module_configs:
1633
- config_item = module_config.get(item_name, default)
1683
+ class TagContext(dict):
1684
+ def __init__(self, logger, full_name, config_name):
1685
+ dict.__init__(self)
1634
1686
 
1635
- # Avoid condition, if the item is not relevant
1636
- if decide_relevant is not None and not decide_relevant(config_item):
1637
- continue
1687
+ self.logger = logger
1688
+ self.full_name = full_name
1689
+ self.config_name = config_name
1638
1690
 
1639
- if not self.evaluateCondition(
1640
- full_name=module_name,
1641
- condition=module_config.get("when", "True"),
1642
- ):
1643
- continue
1691
+ self.used_tags = OrderedSet()
1692
+ self.used_variables = OrderedSet()
1644
1693
 
1645
- if recursive:
1646
- yield module_name, config_item
1647
- else:
1648
- yield config_item
1694
+ def __getitem__(self, key):
1695
+ try:
1696
+ self.used_tags.add(key)
1649
1697
 
1650
- if not recursive:
1651
- break
1698
+ return dict.__getitem__(self, key)
1699
+ except KeyError:
1700
+ if key.startswith("use_"):
1701
+ return False
1652
1702
 
1653
- module_name = module_name.getPackageName()
1654
- if not module_name:
1655
- break
1703
+ if key == "no_asserts":
1704
+ # TODO: This should be better decoupled.
1705
+ from .Plugins import Plugins
1656
1706
 
1657
- def getYamlConfigItemItems(
1658
- self, module_name, section, item_name, decide_relevant, recursive
1659
- ):
1660
- def dict_decide_relevant(item_dict):
1661
- if not item_dict:
1662
- return False
1707
+ return Plugins.decideAssertions(self.full_name) is False
1663
1708
 
1664
- if decide_relevant is None:
1665
- return True
1709
+ if key == "no_docstrings":
1710
+ from .Plugins import Plugins
1666
1711
 
1667
- for key, value in item_dict.items():
1668
- if decide_relevant(key, value):
1669
- return True
1712
+ return Plugins.decideDocStrings(self.full_name) is False
1670
1713
 
1671
- return False
1714
+ if key == "no_annotations":
1715
+ from .Plugins import Plugins
1672
1716
 
1673
- for item_config in self.getYamlConfigItem(
1674
- module_name=module_name,
1675
- section=section,
1676
- item_name=item_name,
1677
- decide_relevant=dict_decide_relevant,
1678
- default={},
1679
- recursive=recursive,
1680
- ):
1681
- if recursive:
1682
- for key, value in item_config[1].items():
1683
- if decide_relevant(key, value):
1684
- yield item_config[0], key, value
1685
- else:
1686
- for key, value in item_config.items():
1687
- if decide_relevant(key, value):
1688
- yield key, value
1717
+ return Plugins.decideAnnotations(self.full_name) is False
1689
1718
 
1690
- def getYamlConfigItemSet(
1691
- self, module_name, section, item_name, decide_relevant, recursive
1692
- ):
1693
- for item_config in self.getYamlConfigItem(
1694
- module_name=module_name,
1695
- section=section,
1696
- item_name=item_name,
1697
- decide_relevant=None,
1698
- default=(),
1699
- recursive=recursive,
1700
- ):
1701
- if recursive:
1702
- for value in item_config[1]:
1703
- if decide_relevant is None or decide_relevant(value):
1704
- yield item_config[0], value
1705
- else:
1706
- for value in item_config:
1707
- if decide_relevant is None or decide_relevant(value):
1708
- yield value
1719
+ self.logger.sysexit(
1720
+ "Identifier '%s' in %s of module '%s' is unknown."
1721
+ % (key, self.config_name, self.full_name)
1722
+ )
1709
1723
 
1710
1724
 
1711
1725
  def standalone_only(func):
@@ -1724,32 +1738,6 @@ def standalone_only(func):
1724
1738
  return wrapped
1725
1739
 
1726
1740
 
1727
- class TagContext(dict):
1728
- def __init__(self, logger, full_name, config_name):
1729
- dict.__init__(self)
1730
-
1731
- self.logger = logger
1732
- self.full_name = full_name
1733
- self.config_name = config_name
1734
-
1735
- self.used_tags = OrderedSet()
1736
- self.used_variables = OrderedSet()
1737
-
1738
- def __getitem__(self, key):
1739
- try:
1740
- self.used_tags.add(key)
1741
-
1742
- return dict.__getitem__(self, key)
1743
- except KeyError:
1744
- if key.startswith("use_"):
1745
- return False
1746
-
1747
- self.logger.sysexit(
1748
- "Identifier '%s' in %s of module '%s' is unknown."
1749
- % (key, self.config_name, self.full_name)
1750
- )
1751
-
1752
-
1753
1741
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
1754
1742
  # integrates with CPython, but also works on its own.
1755
1743
  #