Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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 (213) hide show
  1. Nuitka_winsvc-2.3.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
  2. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
  3. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
  4. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
  5. nuitka/CacheCleanup.py +6 -1
  6. nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
  14. nuitka/PythonFlavors.py +22 -4
  15. nuitka/PythonVersions.py +18 -0
  16. nuitka/Tracing.py +1 -0
  17. nuitka/TreeXML.py +6 -3
  18. nuitka/Version.py +1 -1
  19. nuitka/__main__.py +55 -10
  20. nuitka/__past__.py +5 -0
  21. nuitka/build/Backend.scons +6 -1
  22. nuitka/build/CCompilerVersion.scons +1 -0
  23. nuitka/build/Onefile.scons +4 -0
  24. nuitka/build/SconsCaching.py +2 -1
  25. nuitka/build/SconsCompilerSettings.py +1 -0
  26. nuitka/build/SconsHacks.py +5 -1
  27. nuitka/build/SconsInterface.py +2 -0
  28. nuitka/build/SconsUtils.py +4 -1
  29. nuitka/build/include/nuitka/allocator.h +27 -5
  30. nuitka/build/include/nuitka/calling.h +1 -1
  31. nuitka/build/include/nuitka/compiled_frame.h +23 -23
  32. nuitka/build/include/nuitka/compiled_method.h +1 -1
  33. nuitka/build/include/nuitka/exception_groups.h +0 -2
  34. nuitka/build/include/nuitka/helper/attributes.h +7 -1
  35. nuitka/build/include/nuitka/helper/subscripts.h +1 -1
  36. nuitka/build/include/nuitka/helpers.h +10 -3
  37. nuitka/build/include/nuitka/prelude.h +6 -15
  38. nuitka/build/include/nuitka/printing.h +2 -0
  39. nuitka/build/include/nuitka/unfreezing.h +11 -5
  40. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
  41. nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
  42. nuitka/build/static_src/CompiledCellType.c +7 -7
  43. nuitka/build/static_src/CompiledCodeHelpers.c +49 -36
  44. nuitka/build/static_src/CompiledCoroutineType.c +2 -4
  45. nuitka/build/static_src/CompiledFrameType.c +109 -82
  46. nuitka/build/static_src/CompiledFunctionType.c +36 -9
  47. nuitka/build/static_src/CompiledGeneratorType.c +12 -10
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
  49. nuitka/build/static_src/CompiledMethodType.c +14 -13
  50. nuitka/build/static_src/HelpersAttributes.c +13 -15
  51. nuitka/build/static_src/HelpersBuiltin.c +16 -7
  52. nuitka/build/static_src/HelpersCalling.c +13 -13
  53. nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
  54. nuitka/build/static_src/HelpersComparisonEq.c +110 -110
  55. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
  56. nuitka/build/static_src/HelpersComparisonGe.c +110 -110
  57. nuitka/build/static_src/HelpersComparisonGt.c +110 -110
  58. nuitka/build/static_src/HelpersComparisonLe.c +110 -110
  59. nuitka/build/static_src/HelpersComparisonLt.c +110 -110
  60. nuitka/build/static_src/HelpersComparisonNe.c +110 -110
  61. nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
  62. nuitka/build/static_src/HelpersDictionaries.c +9 -0
  63. nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
  64. nuitka/build/static_src/HelpersImport.c +1 -1
  65. nuitka/build/static_src/HelpersLists.c +5 -1
  66. nuitka/build/static_src/HelpersMatching.c +95 -35
  67. nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
  68. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
  69. nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
  70. nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
  71. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
  72. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
  73. nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
  74. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  75. nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
  76. nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
  77. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
  78. nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
  79. nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
  80. nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
  81. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
  82. nuitka/build/static_src/HelpersSequences.c +1 -1
  83. nuitka/build/static_src/HelpersTypes.c +8 -4
  84. nuitka/build/static_src/InspectPatcher.c +14 -2
  85. nuitka/build/static_src/MainProgram.c +20 -1
  86. nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
  87. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
  88. nuitka/build/static_src/OnefileBootstrap.c +100 -6
  89. nuitka/code_generation/AttributeCodes.py +12 -10
  90. nuitka/code_generation/CodeGeneration.py +6 -7
  91. nuitka/code_generation/ConstantCodes.py +53 -10
  92. nuitka/code_generation/Emission.py +1 -1
  93. nuitka/code_generation/GlobalConstants.py +6 -6
  94. nuitka/code_generation/Indentation.py +4 -5
  95. nuitka/code_generation/LoaderCodes.py +3 -0
  96. nuitka/code_generation/LocalsDictCodes.py +36 -14
  97. nuitka/code_generation/MatchCodes.py +23 -4
  98. nuitka/code_generation/ModuleCodes.py +1 -8
  99. nuitka/code_generation/Namify.py +2 -0
  100. nuitka/code_generation/PackageResourceCodes.py +5 -1
  101. nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
  102. nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
  103. nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
  104. nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
  105. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
  106. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
  107. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  108. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
  109. nuitka/freezer/DependsExe.py +3 -1
  110. nuitka/freezer/DllDependenciesMacOS.py +5 -12
  111. nuitka/freezer/IncludedDataFiles.py +15 -4
  112. nuitka/freezer/IncludedEntryPoints.py +8 -2
  113. nuitka/freezer/Onefile.py +6 -1
  114. nuitka/freezer/Standalone.py +9 -2
  115. nuitka/importing/Importing.py +14 -5
  116. nuitka/importing/Recursion.py +3 -0
  117. nuitka/nodes/AttributeNodesGenerated.py +21 -12
  118. nuitka/nodes/BuiltinOpenNodes.py +5 -0
  119. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
  120. nuitka/nodes/BuiltinRefNodes.py +41 -1
  121. nuitka/nodes/ChildrenHavingMixins.py +143 -355
  122. nuitka/nodes/ClassNodes.py +30 -12
  123. nuitka/nodes/CodeObjectSpecs.py +9 -0
  124. nuitka/nodes/ExpressionBasesGenerated.py +11 -11
  125. nuitka/nodes/FunctionNodes.py +7 -11
  126. nuitka/nodes/FutureSpecs.py +16 -3
  127. nuitka/nodes/GeneratorNodes.py +2 -2
  128. nuitka/nodes/HardImportNodesGenerated.py +11 -134
  129. nuitka/nodes/LocalsScopes.py +19 -23
  130. nuitka/nodes/MatchNodes.py +18 -7
  131. nuitka/nodes/ModuleAttributeNodes.py +1 -20
  132. nuitka/nodes/ModuleNodes.py +23 -6
  133. nuitka/nodes/NodeBases.py +3 -2
  134. nuitka/nodes/NodeMetaClasses.py +26 -10
  135. nuitka/nodes/ReturnNodes.py +1 -1
  136. nuitka/nodes/StatementBasesGenerated.py +11 -11
  137. nuitka/nodes/SubscriptNodes.py +4 -4
  138. nuitka/nodes/VariableAssignNodes.py +1 -1
  139. nuitka/nodes/VariableRefNodes.py +28 -2
  140. nuitka/optimizations/FunctionInlining.py +3 -6
  141. nuitka/optimizations/Optimization.py +13 -12
  142. nuitka/optimizations/TraceCollections.py +19 -4
  143. nuitka/plugins/PluginBase.py +121 -133
  144. nuitka/plugins/Plugins.py +92 -4
  145. nuitka/plugins/YamlPluginBase.py +121 -0
  146. nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
  147. nuitka/plugins/standard/DataFilesPlugin.py +15 -6
  148. nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
  149. nuitka/plugins/standard/DllFilesPlugin.py +5 -3
  150. nuitka/plugins/standard/ImplicitImports.py +34 -20
  151. nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
  152. nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
  153. nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
  154. nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
  155. nuitka/plugins/standard/SpacyPlugin.py +136 -0
  156. nuitka/plugins/standard/standard.nuitka-package.config.yml +489 -182
  157. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -0
  158. nuitka/reports/Reports.py +53 -5
  159. nuitka/specs/BuiltinParameterSpecs.py +1 -1
  160. nuitka/specs/HardImportSpecs.py +0 -6
  161. nuitka/tools/data_composer/DataComposer.py +29 -27
  162. nuitka/tools/environments/CreateEnvironment.py +1 -0
  163. nuitka/tools/environments/Virtualenv.py +25 -11
  164. nuitka/tools/general/find_module/FindModuleCode.py +13 -3
  165. nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
  166. nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
  167. nuitka/tools/specialize/CTypeDescriptions.py +13 -7
  168. nuitka/tools/specialize/SpecializePython.py +18 -1
  169. nuitka/tools/testing/Common.py +19 -6
  170. nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
  171. nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
  172. nuitka/tools/watch/AutoStage.py +144 -0
  173. nuitka/tools/watch/__main__.py +79 -32
  174. nuitka/tree/Building.py +105 -104
  175. nuitka/tree/ComplexCallHelperFunctions.py +16 -26
  176. nuitka/tree/InternalModule.py +8 -0
  177. nuitka/tree/ReformulationAssignmentStatements.py +29 -59
  178. nuitka/tree/ReformulationClasses.py +10 -17
  179. nuitka/tree/ReformulationClasses3.py +69 -43
  180. nuitka/tree/ReformulationComparisonExpressions.py +6 -16
  181. nuitka/tree/ReformulationContractionExpressions.py +14 -23
  182. nuitka/tree/ReformulationDictionaryCreation.py +6 -10
  183. nuitka/tree/ReformulationExecStatements.py +10 -10
  184. nuitka/tree/ReformulationForLoopStatements.py +6 -12
  185. nuitka/tree/ReformulationFunctionStatements.py +21 -28
  186. nuitka/tree/ReformulationImportStatements.py +8 -10
  187. nuitka/tree/ReformulationLambdaExpressions.py +3 -6
  188. nuitka/tree/ReformulationMatchStatements.py +166 -60
  189. nuitka/tree/ReformulationMultidist.py +3 -1
  190. nuitka/tree/ReformulationNamespacePackages.py +1 -1
  191. nuitka/tree/ReformulationPrintStatements.py +3 -6
  192. nuitka/tree/ReformulationSequenceCreation.py +13 -26
  193. nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
  194. nuitka/tree/ReformulationWithStatements.py +12 -16
  195. nuitka/tree/SourceHandling.py +13 -8
  196. nuitka/tree/VariableClosure.py +5 -21
  197. nuitka/utils/Distributions.py +80 -11
  198. nuitka/utils/Download.py +38 -31
  199. nuitka/utils/Execution.py +13 -2
  200. nuitka/utils/FileOperations.py +55 -28
  201. nuitka/utils/Images.py +6 -1
  202. nuitka/utils/Importing.py +1 -1
  203. nuitka/utils/ModuleNames.py +11 -5
  204. nuitka/utils/ReExecute.py +17 -13
  205. nuitka/utils/SharedLibraries.py +32 -8
  206. nuitka/utils/Signing.py +3 -1
  207. nuitka/utils/StaticLibraries.py +51 -41
  208. nuitka/utils/Timing.py +1 -1
  209. nuitka/utils/Utils.py +29 -7
  210. /Nuitka_winsvc-2.3.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
  211. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
  212. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
  213. {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
@@ -34,7 +34,6 @@ from nuitka.nodes.StatementNodes import (
34
34
  )
35
35
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
36
36
  from nuitka.nodes.VariableRefNodes import ExpressionTempVariableRef
37
- from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
38
37
  from nuitka.nodes.YieldNodes import ExpressionYieldFromAwaitable
39
38
  from nuitka.PythonVersions import python_version
40
39
 
@@ -42,7 +41,10 @@ from .ReformulationAssignmentStatements import buildAssignmentStatements
42
41
  from .ReformulationTryExceptStatements import (
43
42
  makeTryExceptSingleHandlerNodeWithPublish,
44
43
  )
45
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
44
+ from .ReformulationTryFinallyStatements import (
45
+ makeTryFinallyReleaseStatement,
46
+ makeTryFinallyStatement,
47
+ )
46
48
  from .TreeHelpers import (
47
49
  buildNode,
48
50
  buildStatementsNode,
@@ -285,19 +287,13 @@ def _buildWithNode(provider, context_expr, assign_target, body, sync, source_ref
285
287
  ),
286
288
  )
287
289
 
288
- return makeTryFinallyStatement(
290
+ return makeTryFinallyReleaseStatement(
289
291
  provider=provider,
290
292
  tried=statements,
291
- final=(
292
- makeStatementReleaseVariable(
293
- variable=tmp_source_variable, source_ref=with_exit_source_ref
294
- ),
295
- makeStatementReleaseVariable(
296
- variable=tmp_enter_variable, source_ref=with_exit_source_ref
297
- ),
298
- makeStatementReleaseVariable(
299
- variable=tmp_exit_variable, source_ref=with_exit_source_ref
300
- ),
293
+ variables=(
294
+ tmp_source_variable,
295
+ tmp_enter_variable,
296
+ tmp_exit_variable,
301
297
  ),
302
298
  source_ref=source_ref,
303
299
  )
@@ -308,13 +304,13 @@ def buildWithNode(provider, node, source_ref):
308
304
  # manual. Catches exceptions, and provides them to "__exit__", while making
309
305
  # the "__enter__" value available under a given name.
310
306
 
311
- # Before Python3.3, multiple context managers are not visible in the parse
307
+ # Before Python3, multiple context managers are not visible in the parse
312
308
  # tree, now we need to handle it ourselves.
313
309
  if hasattr(node, "items"):
314
310
  context_exprs = [item.context_expr for item in node.items]
315
311
  assign_targets = [item.optional_vars for item in node.items]
316
312
  else:
317
- # Make it a list for before Python3.3
313
+ # Make it a list for before Python3
318
314
  context_exprs = [node.context_expr]
319
315
  assign_targets = [node.optional_vars]
320
316
 
@@ -344,7 +340,7 @@ def buildAsyncWithNode(provider, node, source_ref):
344
340
  # manual. Catches exceptions, and provides them to "__exit__", while making
345
341
  # the "__enter__" value available under a given name.
346
342
 
347
- # Before Python3.3, multiple context managers are not visible in the parse
343
+ # Before Python3, multiple context managers are not visible in the parse
348
344
  # tree, now we need to handle it ourselves.
349
345
  context_exprs = [item.context_expr for item in node.items]
350
346
  assign_targets = [item.optional_vars for item in node.items]
@@ -17,10 +17,7 @@ from nuitka.containers.OrderedSets import OrderedSet
17
17
  from nuitka.plugins.Plugins import Plugins
18
18
  from nuitka.PythonVersions import python_version, python_version_str
19
19
  from nuitka.Tracing import general, my_print
20
- from nuitka.utils.FileOperations import (
21
- getFileContentByLine,
22
- putTextFileContents,
23
- )
20
+ from nuitka.utils.FileOperations import putTextFileContents
24
21
  from nuitka.utils.Shebang import getShebangFromSource, parseShebang
25
22
  from nuitka.utils.Utils import isWin32OrPosixWindows
26
23
 
@@ -192,7 +189,8 @@ def readSourceCodeFromFilenameWithInformation(
192
189
  contributing_plugins = ()
193
190
 
194
191
  if (
195
- Options.shallShowSourceModifications(module_name)
192
+ module_name is not None
193
+ and Options.shallShowSourceModifications(module_name)
196
194
  and source_code_modified != source_code
197
195
  ):
198
196
  source_diff = getSourceCodeDiff(source_code, source_code_modified)
@@ -324,7 +322,14 @@ def parsePyIFile(module_name, pyi_filename):
324
322
  in_import_part = ""
325
323
  in_quote = None
326
324
 
327
- for line in getFileContentByLine(pyi_filename):
325
+ pyi_contents = readSourceCodeFromFilename(
326
+ # Do not pass module name, or else plugins modify it, which they
327
+ # should not.
328
+ module_name=None,
329
+ source_filename=pyi_filename,
330
+ )
331
+
332
+ for line in pyi_contents.splitlines():
328
333
  line = line.strip()
329
334
 
330
335
  if in_quote:
@@ -369,11 +374,11 @@ def parsePyIFile(module_name, pyi_filename):
369
374
  if dot_count > 0:
370
375
  if origin_name:
371
376
  origin_name = module_name.getRelativePackageName(
372
- level=dot_count + 1
377
+ level=dot_count - 1
373
378
  ).getChildNamed(origin_name)
374
379
  else:
375
380
  origin_name = module_name.getRelativePackageName(
376
- level=dot_count + 1
381
+ level=dot_count - 1
377
382
  )
378
383
 
379
384
  if origin_name != module_name:
@@ -28,7 +28,6 @@ from nuitka.nodes.VariableRefNodes import (
28
28
  ExpressionTempVariableRef,
29
29
  makeExpressionVariableRef,
30
30
  )
31
- from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
32
31
  from nuitka.PythonVersions import (
33
32
  getErrorMessageExecWithNestedFunction,
34
33
  python_version,
@@ -37,7 +36,7 @@ from nuitka.Variables import isSharedAmongScopes, releaseSharedScopeInformation
37
36
 
38
37
  from .Operations import VisitorNoopMixin, visitTree
39
38
  from .ReformulationFunctionStatements import addFunctionVariableReleases
40
- from .ReformulationTryFinallyStatements import makeTryFinallyStatement
39
+ from .ReformulationTryFinallyStatements import makeTryFinallyReleaseStatement
41
40
  from .SyntaxErrors import raiseSyntaxError
42
41
 
43
42
  # Note: We do the variable scope assignment, as an extra step from tree
@@ -158,7 +157,7 @@ class VariableClosureLookupVisitorPhase1(VisitorNoopMixin):
158
157
  source=node.subnode_source.subnode_left,
159
158
  source_ref=node.source_ref,
160
159
  ),
161
- makeTryFinallyStatement(
160
+ makeTryFinallyReleaseStatement(
162
161
  provider=provider,
163
162
  tried=(
164
163
  makeStatementAssignmentVariable(
@@ -184,9 +183,7 @@ class VariableClosureLookupVisitorPhase1(VisitorNoopMixin):
184
183
  source_ref=node.source_ref,
185
184
  ),
186
185
  ),
187
- final=makeStatementReleaseVariable(
188
- variable=tmp_variable, source_ref=node.source_ref
189
- ),
186
+ variables=(tmp_variable,),
190
187
  source_ref=node.source_ref,
191
188
  ),
192
189
  )
@@ -294,32 +291,19 @@ class VariableClosureLookupVisitorPhase1(VisitorNoopMixin):
294
291
  elif node.isExpressionGeneratorObjectBody():
295
292
  if python_version >= 0x300:
296
293
  self._handleNonLocal(node)
297
-
298
- # Only Python3.4 or later allows for generators to have qualname.
299
- if python_version >= 0x340:
300
294
  self._handleQualnameSetup(node)
301
295
  elif node.isExpressionCoroutineObjectBody():
302
296
  self._handleNonLocal(node)
303
-
304
297
  self._handleQualnameSetup(node)
305
298
  elif node.isExpressionAsyncgenObjectBody():
306
299
  self._handleNonLocal(node)
307
-
308
300
  self._handleQualnameSetup(node)
309
- elif node.isExpressionClassBodyP3():
301
+ elif node.isExpressionClassMappingBody():
310
302
  self._handleNonLocal(node)
311
-
312
- # Python3.4 allows for class declarations to be made global, even
313
- # after they were declared, so we need to fix this up.
314
- if python_version >= 0x340:
315
- self._handleQualnameSetup(node)
303
+ self._handleQualnameSetup(node)
316
304
  elif node.isExpressionFunctionBody():
317
305
  if python_version >= 0x300:
318
306
  self._handleNonLocal(node)
319
-
320
- # Python 3.4 allows for class declarations to be made global, even
321
- # after they were declared, so we need to fix this up.
322
- if python_version >= 0x340:
323
307
  self._handleQualnameSetup(node)
324
308
  # Check if continue and break are properly in loops. If not, raise a
325
309
  # syntax error.
@@ -9,6 +9,7 @@ from nuitka.__past__ import ( # pylint: disable=redefined-builtin
9
9
  FileNotFoundError,
10
10
  unicode,
11
11
  )
12
+ from nuitka.containers.Namedtuples import makeNamedtupleClass
12
13
  from nuitka.containers.OrderedSets import OrderedSet
13
14
  from nuitka.Options import isExperimental
14
15
  from nuitka.PythonFlavors import (
@@ -74,6 +75,15 @@ is typically caused by corruption of its installation."""
74
75
  return None
75
76
 
76
77
 
78
+ def _getDistributionInstallerFileContents(distribution):
79
+ installer_name = _getDistributionMetadataFileContents(distribution, "INSTALLER")
80
+
81
+ if installer_name:
82
+ installer_name = installer_name.strip().lower()
83
+
84
+ return installer_name
85
+
86
+
77
87
  def getDistributionTopLevelPackageNames(distribution):
78
88
  """Returns the top level package names for a distribution."""
79
89
  top_level_txt = _getDistributionMetadataFileContents(distribution, "top_level.txt")
@@ -126,6 +136,16 @@ def getDistributionTopLevelPackageNames(distribution):
126
136
  return tuple(result)
127
137
 
128
138
 
139
+ def _get_pkg_resources_module():
140
+ # pip and vendored pkg_resources are optional of course, but of course very
141
+ # omnipresent generally, so we don't handle failure here.
142
+
143
+ # pylint: disable=I0021,no-name-in-module
144
+ from pip._vendor import pkg_resources
145
+
146
+ return pkg_resources
147
+
148
+
129
149
  def _get_pkg_resource_distributions():
130
150
  """Small replacement of distributions() of importlib.metadata that uses pkg_resources"""
131
151
 
@@ -135,11 +155,7 @@ def _get_pkg_resource_distributions():
135
155
  if _user_site_directory is not None:
136
156
  site.USER_SITE = _user_site_directory
137
157
 
138
- # pip and vendored pkg_resources are optional of course, but of course very
139
- # omnipresent generally, so we don't handle failure here.
140
-
141
- # pylint: disable=I0021,no-name-in-module
142
- from pip._vendor import pkg_resources
158
+ pkg_resources = _get_pkg_resources_module()
143
159
 
144
160
  return lambda: pkg_resources.working_set
145
161
 
@@ -353,14 +369,10 @@ def getDistributionInstallerName(distribution_name):
353
369
  else:
354
370
  _distribution_to_installer[distribution_name] = "not_found"
355
371
  else:
356
- installer_name = _getDistributionMetadataFileContents(
357
- distribution, "INSTALLER"
358
- )
372
+ installer_name = _getDistributionInstallerFileContents(distribution)
359
373
 
360
374
  if installer_name:
361
- _distribution_to_installer[distribution_name] = (
362
- installer_name.strip().lower()
363
- )
375
+ _distribution_to_installer[distribution_name] = installer_name
364
376
  elif isAnacondaPython():
365
377
  _distribution_to_installer[distribution_name] = "conda"
366
378
  elif isPdmPackageInstallation(distribution):
@@ -401,6 +413,20 @@ def getDistributionName(distribution):
401
413
 
402
414
  if hasattr(distribution, "metadata"):
403
415
  result = distribution.metadata["Name"]
416
+
417
+ if result is None:
418
+ installer_name = _getDistributionInstallerFileContents(distribution)
419
+
420
+ if installer_name == "debian":
421
+ distribution_path = _getDistributionPath(distribution)
422
+
423
+ if distribution_path is not None:
424
+ dir_name = os.path.basename(distribution_path)
425
+
426
+ if dir_name.endswith(".dist-info"):
427
+ dir_name = dir_name[:-10]
428
+
429
+ result = dir_name.rsplit("-", 1)[0]
404
430
  else:
405
431
  result = distribution.project_name
406
432
 
@@ -443,6 +469,49 @@ def getDistributionLicense(distribution):
443
469
  return license_name
444
470
 
445
471
 
472
+ def _getEntryPointGroup(group_name):
473
+ try:
474
+ if isExperimental("force-pkg-resources-metadata"):
475
+ raise ImportError
476
+
477
+ try:
478
+ from importlib.metadata import entry_points
479
+ except ImportError:
480
+ from importlib_metadata import entry_points
481
+
482
+ except (ImportError, SyntaxError, RuntimeError):
483
+ pkg_resources = _get_pkg_resources_module()
484
+
485
+ entry_points = pkg_resources.entry_points
486
+
487
+ return entry_points(group=group_name)
488
+
489
+
490
+ EntryPointDescription = makeNamedtupleClass(
491
+ "EntryPointDescription",
492
+ (
493
+ "distribution_name",
494
+ "distribution",
495
+ "module_name",
496
+ ),
497
+ )
498
+
499
+
500
+ def getEntryPointGroup(group_name):
501
+ result = OrderedSet()
502
+
503
+ for entry_point in _getEntryPointGroup(group_name):
504
+ result.add(
505
+ EntryPointDescription(
506
+ distribution_name=getDistributionName(entry_point.dist),
507
+ distribution=entry_point.dist,
508
+ module_name=ModuleName(entry_point.module),
509
+ )
510
+ )
511
+
512
+ return result
513
+
514
+
446
515
  # User site directory if any
447
516
  _user_site_directory = None
448
517
 
nuitka/utils/Download.py CHANGED
@@ -52,6 +52,7 @@ def getCachedDownload(
52
52
  name,
53
53
  url,
54
54
  binary,
55
+ unzip,
55
56
  flatten,
56
57
  is_arch_specific,
57
58
  specificity,
@@ -114,44 +115,52 @@ Fully automatic, cached. Proceed and download"""
114
115
  % (url, e, download_path)
115
116
  )
116
117
 
117
- if not os.path.isfile(exe_path) and os.path.isfile(download_path):
118
- Tracing.general.info("Extracting to '%s'" % exe_path)
118
+ if unzip:
119
+ if not os.path.isfile(exe_path) and os.path.isfile(download_path):
120
+ Tracing.general.info("Extracting to '%s'" % exe_path)
119
121
 
120
- import zipfile
122
+ import zipfile
121
123
 
122
- try:
123
- # Not all Python versions support using it as a context manager, pylint: disable=consider-using-with
124
- zip_file = zipfile.ZipFile(download_path)
124
+ try:
125
+ # Not all Python versions support using it as a context manager, pylint: disable=consider-using-with
126
+ zip_file = zipfile.ZipFile(download_path)
125
127
 
126
- for zip_info in zip_file.infolist():
127
- if zip_info.filename[-1] == "/":
128
- continue
128
+ for zip_info in zip_file.infolist():
129
+ if zip_info.filename[-1] == "/":
130
+ continue
129
131
 
130
- if flatten:
131
- zip_info.filename = os.path.basename(zip_info.filename)
132
+ if flatten:
133
+ zip_info.filename = os.path.basename(zip_info.filename)
132
134
 
133
- zip_file.extract(zip_info, nuitka_download_dir)
135
+ zip_file.extract(zip_info, nuitka_download_dir)
134
136
 
135
- except Exception: # Catching anything zip throws, pylint: disable=broad-except
136
- Tracing.general.info("Problem with the downloaded zip file, deleting it.")
137
+ except (
138
+ # Catching anything zip throws, pylint: disable=broad-except
139
+ Exception
140
+ ):
141
+ Tracing.general.info(
142
+ "Problem with the downloaded zip file, deleting it."
143
+ )
137
144
 
138
- deleteFile(binary, must_exist=False)
139
- deleteFile(download_path, must_exist=True)
145
+ deleteFile(binary, must_exist=False)
146
+ deleteFile(download_path, must_exist=True)
140
147
 
141
- Tracing.general.sysexit(
142
- "Error, need '%s' as extracted from '%s'." % (binary, url)
143
- )
148
+ Tracing.general.sysexit(
149
+ "Error, need '%s' as extracted from '%s'." % (binary, url)
150
+ )
144
151
 
145
- # Check success here, and make sure it's executable.
146
- if os.path.isfile(exe_path):
147
- addFileExecutablePermission(exe_path)
148
- else:
149
- if reject:
150
- Tracing.general.sysexit(reject)
152
+ # Check success here, and make sure it's executable.
153
+ if os.path.isfile(exe_path):
154
+ addFileExecutablePermission(exe_path)
155
+ else:
156
+ if reject:
157
+ Tracing.general.sysexit(reject)
151
158
 
152
- exe_path = None
159
+ exe_path = None
153
160
 
154
- return exe_path
161
+ return exe_path
162
+ else:
163
+ return download_path
155
164
 
156
165
 
157
166
  def getCachedDownloadedMinGW64(target_arch, assume_yes_for_downloads):
@@ -164,19 +173,17 @@ def getCachedDownloadedMinGW64(target_arch, assume_yes_for_downloads):
164
173
  url = "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.1-msvcrt-r1/winlibs-i686-posix-dwarf-gcc-13.2.0-llvm-16.0.6-mingw-w64msvcrt-11.0.1-r1.zip"
165
174
  binary = r"mingw32\bin\gcc.exe"
166
175
  elif target_arch == "arm64":
167
- url = None
176
+ return None
168
177
  else:
169
178
  assert False, target_arch
170
179
 
171
- if url is None:
172
- return None
173
-
174
180
  gcc_binary = getCachedDownload(
175
181
  name="mingw64",
176
182
  url=url,
177
183
  is_arch_specific=target_arch,
178
184
  specificity=url.rsplit("/", 2)[1],
179
185
  binary=binary,
186
+ unzip=True,
180
187
  flatten=False,
181
188
  message="Nuitka will use gcc from MinGW64 of winlibs to compile on Windows.",
182
189
  reject="Only this specific gcc is supported with Nuitka.",
nuitka/utils/Execution.py CHANGED
@@ -20,7 +20,8 @@ from .Utils import getArchitecture, isWin32OrPosixWindows, isWin32Windows
20
20
  # Cache, so we avoid repeated command lookups.
21
21
  _executable_command_cache = {}
22
22
 
23
- # We emulate and use APIs of stdlib, spell-checker: ignore popenargs,creationflags,preexec_fn,setsid
23
+ # We emulate and use APIs of stdlib,
24
+ # spell-checker: ignore popenargs,creationflags,preexec_fn,setsid,debuginfod
24
25
 
25
26
 
26
27
  def _getExecutablePath(filename, search_path):
@@ -289,7 +290,17 @@ def wrapCommandForDebuggerForExec(*args):
289
290
  general.sysexit("Error, no 'gdb' or 'lldb' binary found in path.")
290
291
 
291
292
  if gdb_path is not None:
292
- args = (gdb_path, "gdb", "-ex=run", "-ex=where", "-ex=quit", "--args") + args
293
+ args = (
294
+ gdb_path,
295
+ "gdb",
296
+ "-q",
297
+ "-ex=set pagination off",
298
+ "-ex=set debuginfod enabled off",
299
+ "-ex=run",
300
+ "-ex=where",
301
+ "-ex=quit",
302
+ "--args",
303
+ ) + args
293
304
  else:
294
305
  args = (lldb_path, "lldb", "-o", "run", "-o", "bt", "-o", "quit", "--") + args
295
306
 
@@ -42,6 +42,7 @@ from nuitka.Tracing import (
42
42
  from .Importing import importFromInlineCopy
43
43
  from .ThreadedExecutor import RLock, getThreadIdent
44
44
  from .Utils import (
45
+ decoratorRetries,
45
46
  isLinux,
46
47
  isMacOS,
47
48
  isWin32OrPosixWindows,
@@ -718,7 +719,7 @@ def addFilenameExtension(path, extension):
718
719
  return path
719
720
 
720
721
 
721
- def removeDirectory(path, ignore_errors):
722
+ def removeDirectory(path, logger, ignore_errors, extra_recommendation):
722
723
  """Remove a directory recursively.
723
724
 
724
725
  On Windows, it happens that operations fail, and succeed when retried,
@@ -729,36 +730,52 @@ def removeDirectory(path, ignore_errors):
729
730
  it hopefully only briefly.
730
731
  """
731
732
 
732
- def onError(func, path, exc_info):
733
- # Record what happened what happened, pylint: disable=unused-argument
734
- last_error.append((func, path))
735
-
736
733
  with withFileLock("removing directory %s" % path):
737
734
  if os.path.exists(path):
738
- previous_error = []
739
-
740
- while True:
741
- last_error = []
742
- shutil.rmtree(path, ignore_errors=False, onerror=onError)
743
-
744
- # onError as a side effect, modifies last_error
745
- if previous_error == last_error:
746
- break
747
-
748
- previous_error = list(last_error)
749
- time.sleep(0.1)
750
-
751
- # if it still exists, try one more time, this time not ignoring errors.
752
- if os.path.exists(path):
753
- try:
754
- shutil.rmtree(path, ignore_errors=ignore_errors)
755
- except OSError:
756
- if not ignore_errors:
757
- raise
758
-
759
735
 
760
- def resetDirectory(path, ignore_errors):
761
- removeDirectory(path=path, ignore_errors=ignore_errors)
736
+ @decoratorRetries(
737
+ logger=logger,
738
+ purpose="delete '%s'" % path,
739
+ consequence="the path is not fully removed",
740
+ extra_recommendation=extra_recommendation,
741
+ )
742
+ def _removeDirectory():
743
+ def onError(func, path, exc_info):
744
+ # Record what happened what happened, pylint: disable=unused-argument
745
+ last_error.append((func, path))
746
+
747
+ previous_error = []
748
+
749
+ # Try deleting while ignoring errors first.
750
+ while True:
751
+ last_error = []
752
+ shutil.rmtree(path, ignore_errors=False, onerror=onError)
753
+
754
+ # onError as a side effect, modifies last_error
755
+ if previous_error == last_error:
756
+ break
757
+
758
+ previous_error = list(last_error)
759
+ time.sleep(0.2)
760
+
761
+ # If it still exists, try one more time, this time not ignoring errors.
762
+ if os.path.exists(path):
763
+ try:
764
+ shutil.rmtree(path, ignore_errors=ignore_errors)
765
+ except OSError:
766
+ if not ignore_errors:
767
+ raise
768
+
769
+ _removeDirectory()
770
+
771
+
772
+ def resetDirectory(path, logger, ignore_errors, extra_recommendation):
773
+ removeDirectory(
774
+ path=path,
775
+ logger=logger,
776
+ ignore_errors=ignore_errors,
777
+ extra_recommendation=extra_recommendation,
778
+ )
762
779
  makePath(path)
763
780
 
764
781
 
@@ -1490,6 +1507,16 @@ def isLegalPath(path):
1490
1507
  if path.endswith(illegal_suffix):
1491
1508
  return False, "contains illegal suffix %r" % illegal_suffix
1492
1509
 
1510
+ for part in path.split(os.path.sep):
1511
+ if part == ".":
1512
+ continue
1513
+
1514
+ if part.endswith(illegal_suffix):
1515
+ return False, "contains illegal suffix %r in path part %r" % (
1516
+ part,
1517
+ illegal_suffix,
1518
+ )
1519
+
1493
1520
  return True, None
1494
1521
 
1495
1522
 
nuitka/utils/Images.py CHANGED
@@ -22,7 +22,12 @@ def checkIconUsage(logger, icon_path):
22
22
  if needs_conversion:
23
23
  try:
24
24
  import imageio # pylint: disable=I0021,import-error,unused-import
25
- except ImportError:
25
+ except ImportError as e:
26
+ from nuitka import Options
27
+
28
+ if Options.is_debug:
29
+ logger.info("Exception importing 'imageio' is %s" % repr(e))
30
+
26
31
  logger.sysexit(
27
32
  """\
28
33
  Need to install 'imageio' to automatically convert the non native \
nuitka/utils/Importing.py CHANGED
@@ -322,7 +322,7 @@ def hasPackageDirFilename(path):
322
322
  def getPackageDirFilename(path):
323
323
  assert os.path.isdir(path)
324
324
 
325
- for suffix in (".py",) + getSharedLibrarySuffixes():
325
+ for suffix in getSharedLibrarySuffixes() + (".py",):
326
326
  candidate = os.path.join(path, "__init__" + suffix)
327
327
 
328
328
  if os.path.isfile(candidate):
@@ -112,12 +112,18 @@ class ModuleName(str):
112
112
  yield parent_package
113
113
 
114
114
  def getRelativePackageName(self, level):
115
- result = ".".join(self.asString().split(".")[: -level + 1])
115
+ assert level >= 0
116
116
 
117
- if result == "":
118
- return None
119
- else:
120
- return ModuleName(result)
117
+ parts = self.asString().split(".")
118
+
119
+ while level > 0:
120
+ if not parts:
121
+ return None
122
+
123
+ del parts[-1]
124
+ level -= 1
125
+
126
+ return ModuleName(".".join(parts))
121
127
 
122
128
  def getTopLevelPackageName(self):
123
129
  """Get the top level package name.