Nuitka-winsvc 2.4.11__cp311-cp311-win_amd64.whl → 2.5.6__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 (304) hide show
  1. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/METADATA +56 -109
  2. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/RECORD +304 -280
  3. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/WHEEL +1 -1
  4. nuitka/Builtins.py +31 -0
  5. nuitka/HardImportRegistry.py +8 -0
  6. nuitka/MainControl.py +9 -4
  7. nuitka/OptionParsing.py +108 -54
  8. nuitka/Options.py +69 -13
  9. nuitka/OutputDirectories.py +7 -2
  10. nuitka/PostProcessing.py +69 -38
  11. nuitka/Progress.py +16 -1
  12. nuitka/PythonVersions.py +2 -1
  13. nuitka/Serialization.py +4 -2
  14. nuitka/Tracing.py +69 -1
  15. nuitka/Version.py +2 -2
  16. nuitka/build/Backend.scons +45 -5
  17. nuitka/build/CCompilerVersion.scons +6 -0
  18. nuitka/build/Onefile.scons +6 -0
  19. nuitka/build/SconsCaching.py +4 -0
  20. nuitka/build/SconsCompilerSettings.py +14 -3
  21. nuitka/build/SconsInterface.py +3 -0
  22. nuitka/build/SconsUtils.py +5 -0
  23. nuitka/build/include/nuitka/allocator.h +124 -1
  24. nuitka/build/include/nuitka/calling.h +6 -6
  25. nuitka/build/include/nuitka/compiled_asyncgen.h +10 -7
  26. nuitka/build/include/nuitka/compiled_frame.h +2 -1
  27. nuitka/build/include/nuitka/constants.h +8 -0
  28. nuitka/build/include/nuitka/debug_settings.h +60 -0
  29. nuitka/build/include/nuitka/exceptions.h +264 -121
  30. nuitka/build/include/nuitka/helper/attributes.h +0 -4
  31. nuitka/build/include/nuitka/helper/calling_generated.h +52 -52
  32. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  33. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  34. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  35. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  36. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  37. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  38. nuitka/build/include/nuitka/helper/dictionaries.h +75 -31
  39. nuitka/build/include/nuitka/helper/ints.h +86 -37
  40. nuitka/build/include/nuitka/helper/iterators.h +82 -34
  41. nuitka/build/include/nuitka/helper/operations.h +3 -0
  42. nuitka/build/include/nuitka/helper/operations_binary_add.h +6 -0
  43. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  44. nuitka/build/include/nuitka/helper/operations_binary_sub.h +6 -0
  45. nuitka/build/include/nuitka/helper/operations_inplace_add.h +3 -0
  46. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +3 -0
  47. nuitka/build/include/nuitka/helper/raising.h +47 -28
  48. nuitka/build/include/nuitka/helper/richcomparisons.h +7 -0
  49. nuitka/build/include/nuitka/helper/tuples.h +12 -0
  50. nuitka/build/include/nuitka/helpers.h +12 -2
  51. nuitka/build/include/nuitka/prelude.h +36 -25
  52. nuitka/build/include/nuitka/printing.h +9 -7
  53. nuitka/build/include/nuitka/threading.h +15 -1
  54. nuitka/build/include/nuitka/type_aliases.h +3 -0
  55. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  56. nuitka/build/inline_copy/stubgen/six.py +998 -0
  57. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  58. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  59. nuitka/build/static_src/CompiledCellType.c +6 -4
  60. nuitka/build/static_src/CompiledCodeHelpers.c +106 -40
  61. nuitka/build/static_src/CompiledCoroutineType.c +41 -31
  62. nuitka/build/static_src/CompiledFrameType.c +110 -79
  63. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  64. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  65. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +433 -46
  66. nuitka/build/static_src/CompiledMethodType.c +6 -12
  67. nuitka/build/static_src/HelpersAllocator.c +266 -28
  68. nuitka/build/static_src/HelpersAttributes.c +0 -21
  69. nuitka/build/static_src/HelpersBuiltin.c +23 -14
  70. nuitka/build/static_src/HelpersCalling.c +7 -7
  71. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  72. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  73. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  75. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  77. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  78. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  79. nuitka/build/static_src/HelpersComparisonGe.c +18 -4
  80. nuitka/build/static_src/HelpersComparisonGt.c +18 -4
  81. nuitka/build/static_src/HelpersComparisonLe.c +18 -4
  82. nuitka/build/static_src/HelpersComparisonLt.c +18 -4
  83. nuitka/build/static_src/HelpersComparisonNe.c +18 -4
  84. nuitka/build/static_src/HelpersConsole.c +34 -8
  85. nuitka/build/static_src/HelpersConstantsBlob.c +4 -2
  86. nuitka/build/static_src/HelpersDeepcopy.c +1 -0
  87. nuitka/build/static_src/HelpersDictionaries.c +195 -36
  88. nuitka/build/static_src/HelpersDictionariesGenerated.c +12 -107
  89. nuitka/build/static_src/HelpersExceptions.c +24 -50
  90. nuitka/build/static_src/HelpersFiles.c +79 -5
  91. nuitka/build/static_src/HelpersImport.c +13 -9
  92. nuitka/build/static_src/HelpersImportHard.c +23 -46
  93. nuitka/build/static_src/HelpersLists.c +98 -9
  94. nuitka/build/static_src/HelpersOperationBinaryAdd.c +224 -6
  95. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +3 -0
  96. nuitka/build/static_src/HelpersOperationBinaryBitand.c +5 -5
  97. nuitka/build/static_src/HelpersOperationBinaryBitor.c +5 -5
  98. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +5 -5
  99. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +8 -2
  100. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  101. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +14 -8
  102. nuitka/build/static_src/HelpersOperationBinaryLshift.c +36 -36
  103. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +1 -0
  104. nuitka/build/static_src/HelpersOperationBinaryMod.c +22 -10
  105. nuitka/build/static_src/HelpersOperationBinaryMult.c +17 -7
  106. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +14 -8
  107. nuitka/build/static_src/HelpersOperationBinaryPow.c +24 -24
  108. nuitka/build/static_src/HelpersOperationBinaryRshift.c +4 -4
  109. nuitka/build/static_src/HelpersOperationBinarySub.c +229 -8
  110. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +8 -2
  111. nuitka/build/static_src/HelpersOperationInplaceAdd.c +162 -10
  112. nuitka/build/static_src/HelpersOperationInplaceBitand.c +5 -5
  113. nuitka/build/static_src/HelpersOperationInplaceBitor.c +5 -5
  114. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +5 -5
  115. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +11 -6
  116. nuitka/build/static_src/HelpersOperationInplaceLshift.c +20 -20
  117. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +1 -0
  118. nuitka/build/static_src/HelpersOperationInplaceMod.c +11 -6
  119. nuitka/build/static_src/HelpersOperationInplaceMult.c +11 -6
  120. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +11 -6
  121. nuitka/build/static_src/HelpersOperationInplacePow.c +20 -20
  122. nuitka/build/static_src/HelpersOperationInplaceRshift.c +4 -4
  123. nuitka/build/static_src/HelpersOperationInplaceSub.c +163 -10
  124. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +6 -1
  125. nuitka/build/static_src/HelpersProfiling.c +1 -1
  126. nuitka/build/static_src/HelpersRaising.c +255 -310
  127. nuitka/build/static_src/HelpersStrings.c +1 -1
  128. nuitka/build/static_src/HelpersTuples.c +2 -2
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +132 -28
  131. nuitka/build/static_src/MetaPathBasedLoader.c +18 -19
  132. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +134 -11
  133. nuitka/build/static_src/OnefileBootstrap.c +6 -1
  134. nuitka/code_generation/AsyncgenCodes.py +2 -6
  135. nuitka/code_generation/BinaryOperationHelperDefinitions.py +269 -167
  136. nuitka/code_generation/BuiltinCodes.py +9 -1
  137. nuitka/code_generation/CallCodes.py +16 -16
  138. nuitka/code_generation/CodeGeneration.py +14 -2
  139. nuitka/code_generation/CodeHelperSelection.py +1 -1
  140. nuitka/code_generation/CodeHelpers.py +4 -1
  141. nuitka/code_generation/CodeObjectCodes.py +2 -2
  142. nuitka/code_generation/ComparisonCodes.py +13 -2
  143. nuitka/code_generation/ComparisonHelperDefinitions.py +23 -8
  144. nuitka/code_generation/Contexts.py +28 -16
  145. nuitka/code_generation/CoroutineCodes.py +2 -6
  146. nuitka/code_generation/DictCodes.py +3 -3
  147. nuitka/code_generation/ErrorCodes.py +34 -50
  148. nuitka/code_generation/ExceptionCodes.py +165 -96
  149. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +25 -10
  150. nuitka/code_generation/FrameCodes.py +4 -11
  151. nuitka/code_generation/FunctionCodes.py +2 -6
  152. nuitka/code_generation/GeneratorCodes.py +2 -6
  153. nuitka/code_generation/GlobalConstants.py +8 -2
  154. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  155. nuitka/code_generation/IteratorCodes.py +67 -54
  156. nuitka/code_generation/LineNumberCodes.py +1 -3
  157. nuitka/code_generation/ModuleCodes.py +28 -4
  158. nuitka/code_generation/OperationCodes.py +51 -20
  159. nuitka/code_generation/PackageResourceCodes.py +37 -0
  160. nuitka/code_generation/RaisingCodes.py +164 -90
  161. nuitka/code_generation/Reports.py +13 -5
  162. nuitka/code_generation/ReturnCodes.py +2 -16
  163. nuitka/code_generation/TryCodes.py +12 -24
  164. nuitka/code_generation/TypeAliasCodes.py +48 -0
  165. nuitka/code_generation/VariableCodes.py +99 -40
  166. nuitka/code_generation/VariableDeclarations.py +8 -8
  167. nuitka/code_generation/YieldCodes.py +1 -1
  168. nuitka/code_generation/c_types/CTypeBases.py +10 -2
  169. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +3 -0
  170. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +3 -4
  171. nuitka/code_generation/c_types/CTypeNuitkaInts.py +70 -25
  172. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +1 -1
  173. nuitka/code_generation/c_types/CTypePyObjectPointers.py +16 -6
  174. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +2 -2
  175. nuitka/code_generation/templates/CodeTemplatesConstants.py +11 -3
  176. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +2 -2
  177. nuitka/code_generation/templates/CodeTemplatesExceptions.py +15 -16
  178. nuitka/code_generation/templates/CodeTemplatesFrames.py +18 -10
  179. nuitka/code_generation/templates/CodeTemplatesFunction.py +2 -2
  180. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +2 -2
  181. nuitka/code_generation/templates/CodeTemplatesIterators.py +1 -35
  182. nuitka/code_generation/templates/CodeTemplatesModules.py +34 -4
  183. nuitka/code_generation/templates/CodeTemplatesVariables.py +76 -0
  184. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +3 -3
  185. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +3 -3
  186. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +4 -106
  187. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -2
  188. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
  189. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  190. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +9 -9
  191. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  192. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +1 -1
  193. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +1 -1
  194. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +9 -9
  195. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +7 -7
  196. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +9 -9
  197. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  198. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -4
  199. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +1 -1
  200. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +31 -31
  201. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +1 -1
  202. nuitka/containers/Namedtuples.py +6 -0
  203. nuitka/containers/OrderedSets.py +105 -5
  204. nuitka/distutils/Build.py +14 -0
  205. nuitka/distutils/DistutilCommands.py +50 -10
  206. nuitka/finalizations/Finalization.py +3 -3
  207. nuitka/finalizations/FinalizeMarkups.py +10 -14
  208. nuitka/freezer/DependsExe.py +5 -2
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +6 -0
  212. nuitka/freezer/IncludedDataFiles.py +37 -6
  213. nuitka/freezer/Onefile.py +1 -0
  214. nuitka/freezer/Standalone.py +72 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +5 -2
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +2 -2
  220. nuitka/nodes/BuiltinRefNodes.py +14 -30
  221. nuitka/nodes/ChildrenHavingMixins.py +439 -46
  222. nuitka/nodes/ConditionalNodes.py +3 -2
  223. nuitka/nodes/CoroutineNodes.py +3 -6
  224. nuitka/nodes/DictionaryNodes.py +1 -1
  225. nuitka/nodes/ExceptionNodes.py +102 -26
  226. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  227. nuitka/nodes/FrameNodes.py +22 -11
  228. nuitka/nodes/FunctionNodes.py +3 -3
  229. nuitka/nodes/GeneratorNodes.py +3 -6
  230. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  231. nuitka/nodes/ImportNodes.py +2 -2
  232. nuitka/nodes/NodeBases.py +28 -1
  233. nuitka/nodes/NodeMakingHelpers.py +71 -50
  234. nuitka/nodes/OperatorNodesUnary.py +128 -3
  235. nuitka/nodes/OsSysNodes.py +37 -6
  236. nuitka/nodes/OutlineNodes.py +2 -2
  237. nuitka/nodes/StatementBasesGenerated.py +0 -2
  238. nuitka/nodes/StatementNodes.py +8 -7
  239. nuitka/nodes/SubscriptNodes.py +1 -1
  240. nuitka/nodes/TypeNodes.py +28 -1
  241. nuitka/nodes/VariableAssignNodes.py +2 -1
  242. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  243. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  244. nuitka/nodes/shapes/ShapeMixins.py +18 -0
  245. nuitka/nodes/shapes/StandardShapes.py +47 -44
  246. nuitka/optimizations/BytecodeDemotion.py +2 -1
  247. nuitka/plugins/PluginBase.py +64 -22
  248. nuitka/plugins/Plugins.py +16 -3
  249. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  250. nuitka/plugins/standard/DllFilesPlugin.py +78 -2
  251. nuitka/plugins/standard/ImplicitImports.py +5 -15
  252. nuitka/plugins/standard/KivyPlugin.py +3 -12
  253. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  254. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  255. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -4
  256. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  257. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  258. nuitka/plugins/standard/TkinterPlugin.py +23 -3
  259. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  260. nuitka/plugins/standard/standard.nuitka-package.config.yml +413 -30
  261. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  262. nuitka/reports/CompilationReportReader.py +12 -0
  263. nuitka/reports/Reports.py +11 -0
  264. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  265. nuitka/specs/HardImportSpecs.py +7 -0
  266. nuitka/specs/ParameterSpecs.py +4 -4
  267. nuitka/tools/environments/Virtualenv.py +13 -5
  268. nuitka/tools/general/dll_report/__main__.py +10 -1
  269. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  270. nuitka/tools/podman/__main__.py +4 -2
  271. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  272. nuitka/tools/specialize/SpecializeC.py +218 -56
  273. nuitka/tools/testing/Common.py +69 -62
  274. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  275. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  276. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  277. nuitka/tools/watch/AutoStage.py +1 -0
  278. nuitka/tree/Building.py +10 -37
  279. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  280. nuitka/tree/ReformulationAssertStatements.py +31 -14
  281. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  282. nuitka/tree/ReformulationClasses3.py +94 -19
  283. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  284. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  285. nuitka/tree/ReformulationMatchStatements.py +3 -1
  286. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  287. nuitka/utils/CommandLineOptions.py +27 -3
  288. nuitka/utils/Download.py +2 -2
  289. nuitka/utils/Execution.py +36 -31
  290. nuitka/utils/FileOperations.py +18 -39
  291. nuitka/utils/Hashing.py +5 -1
  292. nuitka/utils/Importing.py +2 -14
  293. nuitka/utils/InlineCopies.py +52 -0
  294. nuitka/utils/InstalledPythons.py +9 -4
  295. nuitka/utils/Json.py +2 -2
  296. nuitka/utils/PackageResources.py +44 -0
  297. nuitka/utils/SharedLibraries.py +24 -0
  298. nuitka/utils/Signing.py +9 -1
  299. nuitka/utils/Utils.py +1 -0
  300. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka-run.cmd +0 -0
  301. {Nuitka_winsvc-2.4.11.data → Nuitka_winsvc-2.5.6.data}/scripts/nuitka.cmd +0 -0
  302. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/LICENSE.txt +0 -0
  303. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/entry_points.txt +0 -0
  304. {Nuitka_winsvc-2.4.11.dist-info → Nuitka_winsvc-2.5.6.dist-info}/top_level.txt +0 -0
@@ -172,7 +172,11 @@ def _getEvaluationContext():
172
172
  # Iterating packages
173
173
  "iterate_modules": _iterate_module_names,
174
174
  # Locating package directories
175
- "_get_module_directory": _getModuleDirectory,
175
+ "get_module_directory": _getModuleDirectory,
176
+ # Checking module presence
177
+ "has_module": _hasModule,
178
+ # Getting data files contents
179
+ "get_data": _getPackageData,
176
180
  # Querying package properties
177
181
  "has_builtin_module": isBuiltinModuleName,
178
182
  # Architectures
@@ -326,6 +330,22 @@ def _getModuleDirectory(module_name):
326
330
  return module_filename
327
331
 
328
332
 
333
+ def _hasModule(module_name):
334
+ from nuitka.importing.Importing import locateModule
335
+
336
+ _module_name, _module_filename, _module_kind, finding = locateModule(
337
+ module_name=ModuleName(module_name), parent_package=None, level=0
338
+ )
339
+
340
+ return finding != "not-found"
341
+
342
+
343
+ def _getPackageData(package_name, resource):
344
+ from nuitka.utils.PackageResources import getPackageData
345
+
346
+ return getPackageData(package_name=ModuleName(package_name), resource=resource)
347
+
348
+
329
349
  def _iterate_module_names(package_name):
330
350
  package_name = ModuleName(package_name)
331
351
  package_path = _getModuleDirectory(module_name=package_name)
@@ -1251,21 +1271,25 @@ Unwanted import of '%(unwanted)s' that %(problem)s '%(binding_name)s' encountere
1251
1271
  setup_codes = setup_codes.splitlines()
1252
1272
 
1253
1273
  if not setup_codes:
1254
- setup_codes = ["pass"]
1274
+ setup_codes = ("pass",)
1255
1275
 
1256
1276
  cmd = r"""\
1257
1277
  from __future__ import print_function
1258
1278
  from __future__ import absolute_import
1279
+ import sys
1259
1280
 
1260
1281
  try:
1261
1282
  %(setup_codes)s
1262
1283
  except ImportError:
1263
- import sys
1264
1284
  sys.exit(38)
1285
+ try:
1265
1286
  %(query_codes)s
1287
+ except Exception as e:
1288
+ sys.stderr.write("\n%%s" %% repr(e))
1289
+ sys.exit(39)
1266
1290
  """ % {
1267
1291
  "setup_codes": "\n".join(" %s" % line for line in setup_codes),
1268
- "query_codes": "\n".join(query_codes),
1292
+ "query_codes": "\n".join(" %s" % line for line in query_codes),
1269
1293
  }
1270
1294
 
1271
1295
  if shallShowExecutedCommands():
@@ -1283,6 +1307,16 @@ except ImportError:
1283
1307
  if Options.is_debug:
1284
1308
  self.info(cmd, keep_format=True)
1285
1309
 
1310
+ if e.returncode == 39:
1311
+ # TODO: Recognize the ModuleNotFoundError or ImportError exceptions
1312
+ # and output the missing module.
1313
+ self.warning(
1314
+ "Exception during compile time command execution: %s"
1315
+ % e.stderr.splitlines()[-1]
1316
+ )
1317
+
1318
+ return None
1319
+
1286
1320
  raise
1287
1321
 
1288
1322
  if str is not bytes: # We want to work with strings, that's hopefully OK.
@@ -1469,7 +1503,7 @@ except ImportError:
1469
1503
 
1470
1504
  if info is None:
1471
1505
  self.sysexit(
1472
- "Error, failed to evaluate variables for %s." % full_name
1506
+ "Error, failed to evaluate variables for '%s'." % full_name
1473
1507
  )
1474
1508
 
1475
1509
  variables.update(info.asDict())
@@ -1541,38 +1575,46 @@ except ImportError:
1541
1575
  raise
1542
1576
 
1543
1577
  self.sysexit(
1544
- "Error, failed to evaluate expression %r in this context, exception was '%s'."
1578
+ "Error, failed to evaluate expression %r in this context, exception was '%r'."
1545
1579
  % (expression, e)
1546
1580
  )
1547
1581
 
1548
1582
  if type(result) not in (str, unicode):
1549
1583
  if single_value:
1550
- self.sysexit(
1551
- """\
1552
- Error, expression '%s' for module '%s' did not evaluate to 'str' result."""
1553
- % (expression, full_name)
1584
+ self._checkStrResult(
1585
+ value=result, expression=expression, full_name=full_name
1554
1586
  )
1555
1587
  else:
1556
- if type(result) not in (tuple, list):
1557
- self.sysexit(
1558
- """\
1559
- Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' or 'list[str]' result."""
1560
- % (expression, full_name)
1561
- )
1588
+ self._checkSequenceResult(
1589
+ value=result, expression=expression, full_name=full_name
1590
+ )
1562
1591
 
1563
1592
  for v in result:
1564
- if type(v) not in (str, unicode):
1565
- self.sysexit(
1566
- """\
1567
- Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' or 'list[str]' result."""
1568
- % (expression, full_name)
1569
- )
1593
+ self._checkStrResult(
1594
+ value=v, expression=expression, full_name=full_name
1595
+ )
1570
1596
 
1571
1597
  # Make it immutable in case it's a list.
1572
1598
  result = tuple(result)
1573
1599
 
1574
1600
  return result
1575
1601
 
1602
+ def _checkStrResult(self, value, expression, full_name):
1603
+ if type(value) not in (str, unicode):
1604
+ self.sysexit(
1605
+ """\
1606
+ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' or 'list[str]' result but '%s'"""
1607
+ % (expression, full_name, type(value))
1608
+ )
1609
+
1610
+ def _checkSequenceResult(self, value, expression, full_name):
1611
+ if type(value) not in (tuple, list):
1612
+ self.sysexit(
1613
+ """\
1614
+ Error, expression '%s' for module '%s' did not evaluate to 'tuple[str]' or 'list[str]' result."""
1615
+ % (expression, full_name)
1616
+ )
1617
+
1576
1618
  def evaluateCondition(self, full_name, condition):
1577
1619
  # Note: Caching makes no sense yet, this should all be very fast and
1578
1620
  # cache themselves. TODO: Allow plugins to contribute their own control
nuitka/plugins/Plugins.py CHANGED
@@ -33,6 +33,7 @@ from nuitka.PythonVersions import python_version
33
33
  from nuitka.Tracing import plugins_logger, printLine
34
34
  from nuitka.utils.FileOperations import (
35
35
  getDllBasename,
36
+ getNormalizedPath,
36
37
  makePath,
37
38
  putTextFileContents,
38
39
  )
@@ -259,6 +260,16 @@ Error, unknown plug-in '%s' in wrong case referenced, use '%s' instead."""
259
260
  return plugin_name2plugin_classes[plugin_name][0]
260
261
 
261
262
 
263
+ def hasPluginName(plugin_name):
264
+ # First, load plugin classes, to know what we are talking about.
265
+ loadPlugins()
266
+
267
+ # Backward compatibility.
268
+ plugin_name = Options.getPluginNameConsideringRenames(plugin_name)
269
+
270
+ return plugin_name in plugin_name2plugin_classes
271
+
272
+
262
273
  def _addPluginClass(plugin_class, detector):
263
274
  plugin_name = plugin_class.plugin_name
264
275
 
@@ -784,9 +795,11 @@ class Plugins(object):
784
795
 
785
796
  try:
786
797
  trigger_module = buildModule(
787
- module_filename=os.path.join(
788
- os.path.dirname(module.getCompileTimeFilename()),
789
- module_name.asPath() + ".py",
798
+ module_filename=getNormalizedPath(
799
+ os.path.join(
800
+ os.path.dirname(module.getCompileTimeFilename()),
801
+ module_name.asPath() + ".py",
802
+ )
790
803
  ),
791
804
  module_name=module_name,
792
805
  reason="trigger",
@@ -18,7 +18,7 @@ from nuitka.Options import isExperimental
18
18
  from nuitka.plugins.YamlPluginBase import NuitkaYamlPluginBase
19
19
  from nuitka.utils.ModuleNames import ModuleName
20
20
 
21
- # spell-checker: ignore dask,numba,statsmodels,matplotlib,sqlalchemy,ipykernel
21
+ # spell-checker: ignore dask,numba,statsmodels,matplotlib,sqlalchemy,ipykernel,pyximport
22
22
 
23
23
  _mode_choices = ("error", "warning", "nofollow", "allow")
24
24
 
@@ -111,6 +111,10 @@ class NuitkaPluginAntiBloat(NuitkaYamlPluginBase):
111
111
  noinclude_setuptools_mode,
112
112
  "setuptools",
113
113
  )
114
+ self.handled_modules["wheel.util"] = (
115
+ noinclude_setuptools_mode,
116
+ "setuptools",
117
+ )
114
118
  else:
115
119
  self.control_tags["use_setuptools"] = True
116
120
 
@@ -267,7 +271,7 @@ form 'module_name:[%s]'."""
267
271
  dest="show_changes",
268
272
  default=False,
269
273
  help="""\
270
- Annotate what changes are by the plugin done.""",
274
+ Annotate what changes are done by the plugin.""",
271
275
  )
272
276
 
273
277
  group.add_option(
@@ -411,7 +415,7 @@ Error, cannot exec module '%s', context code '%s' due to: %s"""
411
415
  replace_dst = self.evaluateExpression(
412
416
  full_name=module_name,
413
417
  expression=replace_code,
414
- config_name="module '%s' config 'replacements' " % module_name,
418
+ config_name="module '%s' config 'replacements'" % module_name,
415
419
  extra_context=self._getContextCode(
416
420
  module_name=module_name, anti_bloat_config=anti_bloat_config
417
421
  ),
@@ -556,10 +560,10 @@ Error, cannot exec module '%s', context code '%s' due to: %s"""
556
560
  def onFunctionBodyParsing(self, module_name, function_name, body):
557
561
  result = False
558
562
 
559
- config = self.config.get(module_name, section="anti-bloat")
560
-
561
- if config:
562
- for anti_bloat_config in config:
563
+ for anti_bloat_config in self.config.get(module_name, section="anti-bloat"):
564
+ if self.evaluateCondition(
565
+ full_name=module_name, condition=anti_bloat_config.get("when", "True")
566
+ ):
563
567
  if self._onFunctionBodyParsing(
564
568
  module_name=module_name,
565
569
  anti_bloat_config=anti_bloat_config,
@@ -604,7 +608,7 @@ class %(class_name)s:
604
608
  replacement = ast.parse(replacement).body[0]
605
609
 
606
610
  node.body[:] = replacement.body
607
- node.bases = replacement.bases
611
+ node.bases[:] = replacement.bases
608
612
 
609
613
  if self.show_changes:
610
614
  self.info(
@@ -616,10 +620,10 @@ class %(class_name)s:
616
620
  def onClassBodyParsing(self, module_name, class_name, node):
617
621
  result = False
618
622
 
619
- config = self.config.get(module_name, section="anti-bloat")
620
-
621
- if config:
622
- for anti_bloat_config in config:
623
+ for anti_bloat_config in self.config.get(module_name, section="anti-bloat"):
624
+ if self.evaluateCondition(
625
+ full_name=module_name, condition=anti_bloat_config.get("when", "True")
626
+ ):
623
627
  if self._onClassBodyParsing(
624
628
  module_name=module_name,
625
629
  anti_bloat_config=anti_bloat_config,
@@ -869,6 +873,13 @@ slow down compilation."""
869
873
  if module_name.hasNamespace(handled_module_name):
870
874
  return "bytecode"
871
875
 
876
+ # TODO: Detect effective "change_class" and "change_function"
877
+ # configuration for standard library modules, but often enough we are
878
+ # happy to let the bytecode not have the effect, but for these ones it's
879
+ # required. TODO: Make the compilation mode part of the config.
880
+ if module_name == "xmlrpc.server":
881
+ return "compiled"
882
+
872
883
  def onModuleCompleteSet(self, module_set):
873
884
  # TODO: Maybe have an entry point that works on the set of names
874
885
  # instead, we are not looking at the modules, and most plugins probably
@@ -41,6 +41,72 @@ class NuitkaPluginDllFiles(NuitkaYamlPluginBase):
41
41
  def isRelevant():
42
42
  return isStandaloneMode()
43
43
 
44
+ def _handleDllConfigBySources(self, dll_config, full_name, dest_path):
45
+ # The "when" is at that level too for these.
46
+ if not self.evaluateCondition(
47
+ full_name=full_name, condition=dll_config.get("when", "True")
48
+ ):
49
+ return
50
+
51
+ config_name = "module '%s' DLL config" % full_name
52
+
53
+ source_paths = []
54
+
55
+ for source_path in dll_config.get("source_paths", ()):
56
+ value = self.evaluateExpressionOrConstant(
57
+ full_name=full_name,
58
+ expression=source_path,
59
+ config_name=config_name,
60
+ extra_context=None,
61
+ single_value=False,
62
+ )
63
+
64
+ if type(value) is str:
65
+ source_paths.append(value)
66
+ else:
67
+ source_paths.extend(value)
68
+
69
+ dest_names = []
70
+
71
+ for dest_name in dll_config.get("dest_names", ()):
72
+ value = self.evaluateExpressionOrConstant(
73
+ full_name=full_name,
74
+ expression=dest_name,
75
+ config_name=config_name,
76
+ extra_context=None,
77
+ single_value=False,
78
+ )
79
+
80
+ if type(value) is str:
81
+ dest_names.append(value)
82
+ else:
83
+ dest_names.extend(value)
84
+
85
+ assert len(source_paths) == len(dest_names), (source_paths, dest_names)
86
+
87
+ module_filename = self.locateModule(full_name)
88
+
89
+ if os.path.isdir(module_filename):
90
+ if dest_path is None:
91
+ dest_path = full_name.asPath()
92
+ else:
93
+ if dest_path is None:
94
+ dest_path = os.path.join(full_name.asPath(), "..")
95
+
96
+ for source_path, dest_name in zip(source_paths, dest_names):
97
+ yield self.makeDllEntryPoint(
98
+ source_path=source_path,
99
+ dest_path=os.path.normpath(
100
+ os.path.join(
101
+ dest_path,
102
+ dest_name,
103
+ )
104
+ ),
105
+ module_name=full_name,
106
+ package_name=full_name,
107
+ reason="Yaml config of '%s'" % full_name.asString(),
108
+ )
109
+
44
110
  def _handleDllConfigFromFilenames(self, dll_config, full_name, dest_path):
45
111
  # A lot of details here, pylint: disable=too-many-locals
46
112
 
@@ -159,7 +225,7 @@ class NuitkaPluginDllFiles(NuitkaYamlPluginBase):
159
225
  dest_path = os.path.normpath(dest_path)
160
226
 
161
227
  if executable:
162
- yield self.makeExeEntryPoint(
228
+ return self.makeExeEntryPoint(
163
229
  source_path=filename,
164
230
  dest_path=dest_path,
165
231
  module_name=full_name,
@@ -167,7 +233,7 @@ class NuitkaPluginDllFiles(NuitkaYamlPluginBase):
167
233
  reason="Yaml config of '%s'" % full_name.asString(),
168
234
  )
169
235
  else:
170
- yield self.makeDllEntryPoint(
236
+ return self.makeDllEntryPoint(
171
237
  source_path=filename,
172
238
  dest_path=dest_path,
173
239
  module_name=full_name,
@@ -217,6 +283,16 @@ conditions are missing, or this version of the module needs treatment added."""
217
283
 
218
284
  found = False
219
285
 
286
+ if "from_sources" in dll_config:
287
+ for result in self._handleDllConfigBySources(
288
+ dll_config=dll_config.get("from_sources"),
289
+ full_name=full_name,
290
+ dest_path=dest_path,
291
+ ):
292
+ yield result
293
+
294
+ found = True
295
+
220
296
  if "by_code" in dll_config:
221
297
  for result in self._handleDllConfigByCode(
222
298
  dll_config=dll_config.get("by_code"),
@@ -102,7 +102,7 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
102
102
  for resolved in self._resolveModulePattern(v):
103
103
  yield resolved
104
104
  else:
105
- yield v
105
+ yield ModuleName(v)
106
106
  elif "*" in dependency or "?" in dependency:
107
107
  for resolved in self._resolveModulePattern(dependency):
108
108
  yield resolved
@@ -317,8 +317,6 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
317
317
  for config_package_dir in config.get("package-dirs", ()):
318
318
  yield os.path.normpath(os.path.join(package_dir, "..", config_package_dir))
319
319
 
320
- yield package_dir
321
-
322
320
  for config_package_name in config.get("package-paths", ()):
323
321
  module_filename = self.locateModule(config_package_name)
324
322
 
@@ -361,19 +359,7 @@ class NuitkaPluginImplicitImports(NuitkaYamlPluginBase):
361
359
  yield item
362
360
 
363
361
  def onModuleSourceCode(self, module_name, source_filename, source_code):
364
- # Too much code here, pylint: disable=too-many-branches
365
362
  # TODO: Move the ones that would be possible to yaml config,
366
- # e.g. the numexpr hack.
367
-
368
- if module_name == "numexpr.cpuinfo":
369
- # We cannot intercept "is" tests, but need it to be "isinstance",
370
- # so we patch it on the file. TODO: This is only temporary, in
371
- # the future, we may use optimization that understands the right
372
- # hand size of the "is" argument well enough to allow for our
373
- # type too.
374
- source_code = source_code.replace(
375
- "type(attr) is types.MethodType", "isinstance(attr, types.MethodType)"
376
- )
377
363
 
378
364
  if module_name == "site":
379
365
  if source_code.startswith("def ") or source_code.startswith("class "):
@@ -555,6 +541,10 @@ __file__ = (__nuitka_binary_dir + '%ssite.py') if '__nuitka_binary_dir' in dict(
555
541
  ):
556
542
  code = "\n".join(entry.get("pre-import-code"))
557
543
 
544
+ # TODO: Add a description to the Yaml file.
545
+ yield code, """\
546
+ According to Yaml 'pre-import-code' configuration."""
547
+
558
548
  for entry in self.config.get(full_name, section="import-hacks"):
559
549
  if "force-environment-variables" in entry:
560
550
  if self.evaluateCondition(
@@ -6,7 +6,6 @@
6
6
 
7
7
  from nuitka.Options import isStandaloneMode
8
8
  from nuitka.plugins.PluginBase import NuitkaPluginBase
9
- from nuitka.utils.Utils import isMacOS, isWin32Windows
10
9
 
11
10
 
12
11
  class NuitkaPluginKivy(NuitkaPluginBase):
@@ -64,7 +63,9 @@ except ImportError:
64
63
  return info
65
64
 
66
65
  def getImplicitImports(self, module):
67
- # Using branches to dispatch, pylint: disable=too-many-branches
66
+ # TODO: Move this all to yaml configuration, we now can
67
+ # query Kivy installation and use variables to solve some
68
+ # of the more difficult ones.
68
69
 
69
70
  full_name = module.getFullName()
70
71
 
@@ -92,16 +93,6 @@ except ImportError:
92
93
  yield "kivy.graphics.cgl_backend.cgl_sdl2"
93
94
  elif full_name == "kivy.graphics.cgl_backend.cgl_glew":
94
95
  yield "kivy.graphics.cgl_backend.cgl_gl"
95
- elif full_name == "kivymd.app":
96
- yield self.locateModules("kivymd.uix")
97
- elif full_name == "kivy.core.clipboard":
98
- if isWin32Windows():
99
- yield "kivy.core.clipboard.clipboard_winctypes"
100
- if isMacOS():
101
- if self.locateModule("pyobjus"):
102
- yield "kivy.core.clipboard.clipboard_nspaste"
103
- else:
104
- yield "kivy.core.clipboard.clipboard_sdl2"
105
96
 
106
97
  def getExtraDlls(self, module):
107
98
  """Copy extra shared libraries or data for this installation.
@@ -8,6 +8,7 @@ import os
8
8
  from nuitka.Options import isStandaloneMode
9
9
  from nuitka.plugins.PluginBase import NuitkaPluginBase
10
10
  from nuitka.plugins.Plugins import (
11
+ getActiveQtPlugin,
11
12
  getActiveQtPluginBindingName,
12
13
  hasActivePlugin,
13
14
  )
@@ -76,7 +77,7 @@ from inspect import getsource
76
77
  ),
77
78
  )
78
79
  except NuitkaCalledProcessError as e:
79
- self.debug("Exception during detection: %r" % e)
80
+ self.debug("Exception during detection: %s" % str(e))
80
81
 
81
82
  if "MPLBACKEND" not in os.environ:
82
83
  self.sysexit(
@@ -92,6 +93,15 @@ https://matplotlib.org/stable/users/installing/environment_variables_faq.html#en
92
93
  if info is None:
93
94
  self.sysexit("Error, it seems 'matplotlib' is not installed or broken.")
94
95
 
96
+ # Auto correct for using tk-inter the system setting.
97
+ if "tk" not in info.backend.lower() and hasActivePlugin("tk-inter"):
98
+ info = info.replace(backend="TkAgg")
99
+
100
+ if info.backend == "QtAgg" and getActiveQtPlugin() is None:
101
+ self.sysexit(
102
+ "Error, cannot use 'QtAgg' without a plugin for Qt binding active, use e.g. '--enable-plugin=pyside6'."
103
+ )
104
+
95
105
  return info
96
106
 
97
107
  def getImplicitImports(self, module):
@@ -183,6 +193,7 @@ https://matplotlib.org/stable/users/installing/environment_variables_faq.html#en
183
193
  if hasActivePlugin("tk-inter"):
184
194
  return True, "Needed for tkinter matplotlib backend"
185
195
 
196
+ # For Qt binding, include matplotlib backend, spell-checker: ignore qtagg
186
197
  if module_name == "matplotlib.backends.backend_qtagg":
187
198
  if getActiveQtPluginBindingName() is not None:
188
199
  return True, "Needed for qt matplotlib backend"
@@ -9,7 +9,7 @@ point to a "Python.exe" and won't use compiled code by default.
9
9
 
10
10
  The issue applies to accelerated and standalone mode alike.
11
11
 
12
- spell-checker: ignore joblib
12
+ spell-checker: ignore joblib,anyio
13
13
  """
14
14
 
15
15
  from nuitka import Options
@@ -51,28 +51,21 @@ class NuitkaPluginMultiprocessingWorkarounds(NuitkaPluginBase):
51
51
  def createPreModuleLoadCode(module):
52
52
  full_name = module.getFullName()
53
53
 
54
- # TODO: Replace the setting of "sys.frozen" with a change to the source code of the
55
- # modules we want to affect from this plugin, it's a huge impact on compatibility
56
- # with other things potentially. We should do it, once the anti-bloat engine is
57
- # reusable or supports conditional replacements based on plugin activity and is
58
- # always on.
59
- if full_name == "multiprocessing":
60
- code = """\
54
+ if full_name in ("multiprocessing", "anyio"):
55
+ yield (
56
+ """\
61
57
  import sys, os
62
- sys.frozen = 1
63
58
  argv0 = sys.argv[0]
64
59
  if sys.platform == "win32" and not os.path.exists(argv0) and not argv0.endswith(".exe"):
65
60
  argv0 += ".exe"
66
61
 
67
62
  sys.executable = %s
68
63
  sys._base_executable = sys.executable
69
- """ % (
70
- "__nuitka_binary_exe" if Options.isStandaloneMode() else "argv0"
71
- )
72
- return (
73
- code,
64
+ """
65
+ % ("__nuitka_binary_exe" if Options.isStandaloneMode() else "argv0"),
74
66
  """\
75
- Monkey patching "multiprocessing" load environment.""",
67
+ Monkey patching "%s" load environment."""
68
+ % full_name,
76
69
  )
77
70
 
78
71
  @staticmethod
@@ -80,7 +73,8 @@ Monkey patching "multiprocessing" load environment.""",
80
73
  full_name = module.getFullName()
81
74
 
82
75
  if full_name == "multiprocessing":
83
- code = """\
76
+ yield (
77
+ """\
84
78
  try:
85
79
  from multiprocessing.forking import ForkingPickler
86
80
  except ImportError:
@@ -99,10 +93,7 @@ def _reduce_compiled_method(m):
99
93
  ForkingPickler.register(type(C().f), _reduce_compiled_method)
100
94
  if str is bytes:
101
95
  ForkingPickler.register(type(C.f), _reduce_compiled_method)
102
- """
103
-
104
- return (
105
- code,
96
+ """,
106
97
  """\
107
98
  Monkey patching "multiprocessing" for compiled methods.""",
108
99
  )
@@ -81,15 +81,16 @@ Error, package '%s' requires '--macos-create-app-bundle' to be used or else it c
81
81
  elif macos_bundle == "no":
82
82
  pass
83
83
  elif macos_bundle == "recommend":
84
- self.info(
85
- """\
84
+ if not shallCreateAppBundle():
85
+ self.info(
86
+ """\
86
87
  Note, when using '%s', consider using '--macos-create-app-bundle' option. \
87
88
  Otherwise high resolution will not be available and a terminal window will \
88
89
  open. However for debugging, terminal output is the easiest way to see \
89
90
  informative traceback and error information, so launch it from there if \
90
91
  possible."""
91
- % full_name
92
- )
92
+ % full_name
93
+ )
93
94
  else:
94
95
  self.sysexitIllegalOptionValue(full_name, "macos_bundle", macos_bundle)
95
96