Nuitka-winsvc 2.4.8__cp311-cp311-win_amd64.whl → 2.5.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 (294) hide show
  1. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/METADATA +2 -1
  2. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/RECORD +294 -271
  3. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.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 +105 -52
  8. nuitka/Options.py +73 -16
  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 +12 -2
  20. nuitka/build/SconsCompilerSettings.py +17 -6
  21. nuitka/build/SconsInterface.py +1 -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 +6 -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 +65 -29
  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/helpers.h +12 -2
  50. nuitka/build/include/nuitka/prelude.h +35 -25
  51. nuitka/build/include/nuitka/printing.h +9 -7
  52. nuitka/build/include/nuitka/threading.h +15 -1
  53. nuitka/build/include/nuitka/type_aliases.h +3 -0
  54. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  55. nuitka/build/inline_copy/stubgen/six.py +998 -0
  56. nuitka/build/inline_copy/stubgen/stubgen.py +307 -0
  57. nuitka/build/static_src/CompiledAsyncgenType.c +45 -39
  58. nuitka/build/static_src/CompiledCellType.c +6 -4
  59. nuitka/build/static_src/CompiledCodeHelpers.c +104 -40
  60. nuitka/build/static_src/CompiledCoroutineType.c +40 -30
  61. nuitka/build/static_src/CompiledFrameType.c +110 -79
  62. nuitka/build/static_src/CompiledFunctionType.c +173 -151
  63. nuitka/build/static_src/CompiledGeneratorType.c +51 -49
  64. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +424 -46
  65. nuitka/build/static_src/CompiledMethodType.c +10 -13
  66. nuitka/build/static_src/HelpersAllocator.c +270 -32
  67. nuitka/build/static_src/HelpersAttributes.c +0 -21
  68. nuitka/build/static_src/HelpersBuiltin.c +22 -13
  69. nuitka/build/static_src/HelpersCalling.c +7 -7
  70. nuitka/build/static_src/HelpersCallingGenerated.c +70 -70
  71. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  72. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  73. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  74. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  75. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  76. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  77. nuitka/build/static_src/HelpersComparisonEq.c +18 -4
  78. nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -0
  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 +10 -4
  86. nuitka/build/static_src/HelpersDictionaries.c +181 -34
  87. nuitka/build/static_src/HelpersDictionariesGenerated.c +0 -106
  88. nuitka/build/static_src/HelpersExceptions.c +24 -50
  89. nuitka/build/static_src/HelpersFiles.c +79 -5
  90. nuitka/build/static_src/HelpersImport.c +13 -9
  91. nuitka/build/static_src/HelpersImportHard.c +23 -46
  92. nuitka/build/static_src/HelpersLists.c +98 -9
  93. nuitka/build/static_src/HelpersMatching.c +1 -1
  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 +1 -1
  129. nuitka/build/static_src/HelpersTypes.c +98 -2
  130. nuitka/build/static_src/MainProgram.c +117 -29
  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 +73 -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 +0 -105
  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 +13 -3
  209. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  210. nuitka/freezer/DllDependenciesWin32.py +26 -12
  211. nuitka/freezer/ImportDetection.py +3 -0
  212. nuitka/freezer/IncludedDataFiles.py +31 -8
  213. nuitka/freezer/IncludedEntryPoints.py +3 -2
  214. nuitka/freezer/Standalone.py +76 -18
  215. nuitka/importing/Importing.py +33 -6
  216. nuitka/importing/Recursion.py +12 -1
  217. nuitka/importing/StandardLibrary.py +57 -59
  218. nuitka/nodes/AsyncgenNodes.py +3 -6
  219. nuitka/nodes/BuiltinIteratorNodes.py +1 -1
  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/ExceptionNodes.py +102 -26
  225. nuitka/nodes/ExpressionBasesGenerated.py +288 -4
  226. nuitka/nodes/FrameNodes.py +22 -11
  227. nuitka/nodes/FunctionNodes.py +3 -3
  228. nuitka/nodes/GeneratorNodes.py +3 -6
  229. nuitka/nodes/HardImportNodesGenerated.py +182 -0
  230. nuitka/nodes/ImportNodes.py +2 -2
  231. nuitka/nodes/NodeBases.py +28 -1
  232. nuitka/nodes/NodeMakingHelpers.py +71 -50
  233. nuitka/nodes/OperatorNodesUnary.py +128 -3
  234. nuitka/nodes/OsSysNodes.py +37 -6
  235. nuitka/nodes/OutlineNodes.py +2 -2
  236. nuitka/nodes/StatementBasesGenerated.py +0 -2
  237. nuitka/nodes/StatementNodes.py +8 -7
  238. nuitka/nodes/SubscriptNodes.py +1 -1
  239. nuitka/nodes/TypeNodes.py +28 -1
  240. nuitka/nodes/shapes/BuiltinTypeShapes.py +24 -7
  241. nuitka/nodes/shapes/ShapeMixins.py +17 -0
  242. nuitka/nodes/shapes/StandardShapes.py +53 -1
  243. nuitka/optimizations/BytecodeDemotion.py +2 -1
  244. nuitka/plugins/PluginBase.py +64 -22
  245. nuitka/plugins/Plugins.py +6 -3
  246. nuitka/plugins/standard/AntiBloatPlugin.py +23 -12
  247. nuitka/plugins/standard/ImplicitImports.py +1 -13
  248. nuitka/plugins/standard/KivyPlugin.py +3 -12
  249. nuitka/plugins/standard/MatplotlibPlugin.py +12 -1
  250. nuitka/plugins/standard/MultiprocessingPlugin.py +11 -20
  251. nuitka/plugins/standard/PlaywrightPlugin.py +184 -0
  252. nuitka/plugins/standard/PySidePyQtPlugin.py +8 -0
  253. nuitka/plugins/standard/TkinterPlugin.py +0 -56
  254. nuitka/plugins/standard/TransformersPlugin.py +70 -275
  255. nuitka/plugins/standard/standard.nuitka-package.config.yml +510 -28
  256. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +35 -2
  257. nuitka/reports/CompilationReportReader.py +12 -0
  258. nuitka/reports/Reports.py +11 -0
  259. nuitka/specs/BuiltinParameterSpecs.py +5 -1
  260. nuitka/specs/HardImportSpecs.py +7 -0
  261. nuitka/specs/ParameterSpecs.py +4 -4
  262. nuitka/tools/general/dll_report/__main__.py +10 -1
  263. nuitka/tools/onefile_compressor/OnefileCompressor.py +1 -1
  264. nuitka/tools/specialize/CTypeDescriptions.py +158 -9
  265. nuitka/tools/specialize/SpecializeC.py +218 -56
  266. nuitka/tools/testing/Common.py +70 -63
  267. nuitka/tools/testing/compare_with_cpython/__main__.py +3 -1
  268. nuitka/tools/testing/measure_construct_performance/__main__.py +1 -8
  269. nuitka/tools/testing/run_nuitka_tests/__main__.py +77 -11
  270. nuitka/tools/watch/AutoStage.py +1 -0
  271. nuitka/tree/Building.py +10 -37
  272. nuitka/tree/ComplexCallHelperFunctions.py +4 -0
  273. nuitka/tree/ReformulationAssertStatements.py +31 -14
  274. nuitka/tree/ReformulationAssignmentStatements.py +5 -1
  275. nuitka/tree/ReformulationClasses3.py +94 -19
  276. nuitka/tree/ReformulationDictionaryCreation.py +1 -0
  277. nuitka/tree/ReformulationFunctionStatements.py +1 -1
  278. nuitka/tree/ReformulationMatchStatements.py +3 -1
  279. nuitka/tree/ReformulationYieldExpressions.py +23 -5
  280. nuitka/utils/CommandLineOptions.py +27 -3
  281. nuitka/utils/Download.py +2 -2
  282. nuitka/utils/Execution.py +36 -31
  283. nuitka/utils/FileOperations.py +39 -54
  284. nuitka/utils/Importing.py +2 -14
  285. nuitka/utils/InlineCopies.py +52 -0
  286. nuitka/utils/InstalledPythons.py +9 -4
  287. nuitka/utils/Json.py +2 -2
  288. nuitka/utils/PackageResources.py +44 -0
  289. nuitka/utils/Utils.py +17 -0
  290. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka-run.cmd +0 -0
  291. {Nuitka_winsvc-2.4.8.data → Nuitka_winsvc-2.5.1.data}/scripts/nuitka.cmd +0 -0
  292. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/LICENSE.txt +0 -0
  293. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/entry_points.txt +0 -0
  294. {Nuitka_winsvc-2.4.8.dist-info → Nuitka_winsvc-2.5.1.dist-info}/top_level.txt +0 -0
@@ -32,6 +32,7 @@ from nuitka.PythonFlavors import (
32
32
  getHomebrewInstallPath,
33
33
  isAnacondaPython,
34
34
  isHomebrewPython,
35
+ isMSYS2MingwPython,
35
36
  )
36
37
  from nuitka.PythonVersions import getSystemPrefixPath
37
38
  from nuitka.Tracing import general, inclusion_logger
@@ -115,6 +116,7 @@ def _detectBinaryDLLs(
115
116
  original_filename,
116
117
  binary_filename,
117
118
  package_name,
119
+ use_path,
118
120
  use_cache,
119
121
  update_cache,
120
122
  ):
@@ -141,6 +143,7 @@ def _detectBinaryDLLs(
141
143
  original_dir=os.path.dirname(original_filename),
142
144
  binary_filename=binary_filename,
143
145
  package_name=package_name,
146
+ use_path=use_path,
144
147
  use_cache=use_cache,
145
148
  update_cache=update_cache,
146
149
  )
@@ -227,7 +230,11 @@ def copyDllsUsed(dist_dir, standalone_entry_points):
227
230
  )
228
231
 
229
232
 
230
- def _reduceToPythonPath(used_dlls):
233
+ _excluded_system_dlls = set()
234
+
235
+
236
+ def _reduceToPythonPath(used_dll_paths):
237
+ """Remove DLLs outside of python path."""
231
238
  inside_paths = getPythonUnpackedSearchPath()
232
239
 
233
240
  if isAnacondaPython():
@@ -236,28 +243,67 @@ def _reduceToPythonPath(used_dlls):
236
243
  if isHomebrewPython():
237
244
  inside_paths.insert(0, getHomebrewInstallPath())
238
245
 
246
+ if isMSYS2MingwPython():
247
+ inside_paths.insert(0, os.path.join(getSystemPrefixPath(), "bin"))
248
+
239
249
  def decideInside(dll_filename):
240
250
  return any(
241
251
  isFilenameBelowPath(path=inside_path, filename=dll_filename)
242
252
  for inside_path in inside_paths
243
253
  )
244
254
 
245
- used_dlls = set(
246
- dll_filename for dll_filename in used_dlls if decideInside(dll_filename)
247
- )
255
+ kept_used_dll_paths = OrderedSet()
256
+ removed_dll_paths = OrderedSet()
257
+
258
+ for dll_filename in used_dll_paths:
259
+ if decideInside(dll_filename):
260
+ kept_used_dll_paths.add(dll_filename)
261
+ else:
262
+ if dll_filename not in _excluded_system_dlls:
263
+ _excluded_system_dlls.add(dll_filename)
264
+ inclusion_logger.info("Not including system DLL '%s'" % dll_filename)
265
+
266
+ removed_dll_paths.add(dll_filename)
248
267
 
249
- return used_dlls
268
+ return kept_used_dll_paths, removed_dll_paths
269
+
270
+
271
+ _removed_dll_usages = {}
272
+
273
+
274
+ def getRemovedUsedDllsInfo():
275
+ return _removed_dll_usages.items()
250
276
 
251
277
 
252
278
  def _detectUsedDLLs(standalone_entry_point, source_dir):
279
+ # TODO: We are handling a bunch of cases here, but also some special cases,
280
+ # that should live elsewhere.
281
+ # pylint: disable=too-many-branches,too-many-locals
282
+
283
+ if standalone_entry_point.module_name is not None:
284
+ module_name, module_filename, _kind, finding = locateModule(
285
+ standalone_entry_point.module_name, parent_package=None, level=0
286
+ )
287
+
288
+ # TODO: How can this be None at all.
289
+ if module_filename is not None and isStandardLibraryPath(module_filename):
290
+ allow_outside_dependencies = True
291
+ else:
292
+ allow_outside_dependencies = Plugins.decideAllowOutsideDependencies(
293
+ standalone_entry_point.module_name
294
+ )
295
+ else:
296
+ allow_outside_dependencies = False
297
+
253
298
  binary_filename = standalone_entry_point.source_path
254
299
  try:
255
300
  used_dll_paths = _detectBinaryDLLs(
256
301
  is_main_executable=standalone_entry_point.kind == "executable",
257
302
  source_dir=source_dir,
258
303
  original_filename=standalone_entry_point.source_path,
259
- binary_filename=standalone_entry_point.source_path,
304
+ binary_filename=binary_filename,
260
305
  package_name=standalone_entry_point.package_name,
306
+ use_path=allow_outside_dependencies,
261
307
  use_cache=not shallNotUseDependsExeCachedResults(),
262
308
  update_cache=not shallNotStoreDependsExeCachedResults(),
263
309
  )
@@ -265,6 +311,14 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
265
311
  inclusion_logger.info(
266
312
  "Not including due to forbidden DLL '%s'." % binary_filename
267
313
  )
314
+ except (RuntimeError, Exception) as e:
315
+ inclusion_logger.warning(
316
+ """\
317
+ Error, cannot detect used DLLs for DLL '%s' in package '%s' due to: %s"""
318
+ % (binary_filename, standalone_entry_point.package_name, str(e))
319
+ )
320
+
321
+ raise
268
322
  else:
269
323
  # Plugins generally decide if they allow dependencies from the outside
270
324
  # based on the package name.
@@ -280,21 +334,25 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
280
334
  ), standalone_entry_point.module_name
281
335
  assert finding == "absolute", standalone_entry_point.module_name
282
336
 
283
- if isStandardLibraryPath(module_filename):
284
- allow_outside_dependencies = True
285
- else:
286
- allow_outside_dependencies = Plugins.decideAllowOutsideDependencies(
287
- standalone_entry_point.module_name
288
- )
337
+ if not allow_outside_dependencies:
338
+ used_dll_paths, removed_dll_paths = _reduceToPythonPath(used_dll_paths)
339
+
340
+ if removed_dll_paths:
341
+ _removed_dll_usages[standalone_entry_point] = (
342
+ "no outside dependencies allowed for '%s'"
343
+ % standalone_entry_point.module_name,
344
+ removed_dll_paths,
345
+ )
289
346
 
290
- if allow_outside_dependencies is False:
291
- used_dll_paths = _reduceToPythonPath(used_dll_paths)
347
+ # Lets be sure of this
348
+ assert type(used_dll_paths) is OrderedSet, type(used_dll_paths)
292
349
 
293
- # Allow plugins can prevent inclusion, this may discard things from used_dlls.
350
+ # Allow plugins can prevent inclusion, this may discard things from
351
+ # used_dlls through its return value.
294
352
  removed_dlls = Plugins.removeDllDependencies(
295
- dll_filename=binary_filename, dll_filenames=used_dll_paths
353
+ dll_filename=binary_filename, dll_filenames=OrderedSet(used_dll_paths)
296
354
  )
297
- used_dll_paths = tuple(OrderedSet(used_dll_paths) - OrderedSet(removed_dlls))
355
+ used_dll_paths = used_dll_paths - removed_dlls
298
356
 
299
357
  for used_dll_path in used_dll_paths:
300
358
  extension_standalone_entry_point = getIncludedExtensionModule(used_dll_path)
@@ -309,7 +367,7 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
309
367
  "openvino",
310
368
  "av",
311
369
  )
312
- and areInSamePaths(standalone_entry_point.source_path, used_dll_path)
370
+ and areInSamePaths(binary_filename, used_dll_path)
313
371
  ):
314
372
  # TODO: If used by a DLL from the same folder, put it there,
315
373
  # otherwise top level, but for now this is limited to a few cases
@@ -36,7 +36,11 @@ from nuitka.PythonVersions import python_version
36
36
  from nuitka.Tracing import my_print, recursion_logger
37
37
  from nuitka.tree.ReformulationMultidist import locateMultidistModule
38
38
  from nuitka.utils.AppDirs import getCacheDir
39
- from nuitka.utils.FileOperations import listDir, removeDirectory
39
+ from nuitka.utils.FileOperations import (
40
+ getNormalizedPath,
41
+ listDir,
42
+ removeDirectory,
43
+ )
40
44
  from nuitka.utils.Hashing import getFileContentsHash
41
45
  from nuitka.utils.Importing import (
42
46
  builtin_module_names,
@@ -826,10 +830,10 @@ def locateModule(module_name, parent_package, level):
826
830
 
827
831
  assert module_package is None or (
828
832
  type(module_package) is ModuleName and module_package != ""
829
- ), repr(module_package)
833
+ ), ("Must not attempt to locate %r" % module_name)
830
834
 
831
835
  if module_filename is not None:
832
- module_filename = os.path.normpath(module_filename)
836
+ module_filename = getNormalizedPath(module_filename)
833
837
 
834
838
  module_name, module_kind = getModuleNameAndKindFromFilename(module_filename)
835
839
  module_name = ModuleName.makeModuleNameInPackage(module_name, module_package)
@@ -874,7 +878,7 @@ def decideModuleSourceRef(filename, module_name, is_main, is_fake, logger):
874
878
  is_package = False
875
879
 
876
880
  if is_main and os.path.isdir(filename):
877
- source_filename = os.path.join(filename, "__main__.py")
881
+ source_filename = getNormalizedPath(os.path.join(filename, "__main__.py"))
878
882
 
879
883
  if not os.path.isfile(source_filename):
880
884
  sys.stderr.write(
@@ -904,7 +908,7 @@ def decideModuleSourceRef(filename, module_name, is_main, is_fake, logger):
904
908
  elif isPackageDir(filename):
905
909
  is_package = True
906
910
 
907
- source_filename = os.path.join(filename, "__init__.py")
911
+ source_filename = getNormalizedPath(os.path.join(filename, "__init__.py"))
908
912
 
909
913
  if not os.path.isfile(source_filename):
910
914
  source_ref = SourceCodeReferences.fromFilename(
@@ -913,7 +917,7 @@ def decideModuleSourceRef(filename, module_name, is_main, is_fake, logger):
913
917
  is_namespace = True
914
918
  else:
915
919
  source_ref = SourceCodeReferences.fromFilename(
916
- filename=os.path.abspath(source_filename)
920
+ filename=getNormalizedPath(os.path.abspath(source_filename))
917
921
  )
918
922
 
919
923
  else:
@@ -1042,6 +1046,7 @@ _stdlib_module_raises = {
1042
1046
  "_interpreters": False,
1043
1047
  "_interpqueues": False,
1044
1048
  "_sysconfig": False,
1049
+ "_suggestions": False,
1045
1050
  }
1046
1051
 
1047
1052
 
@@ -1052,6 +1057,28 @@ def isNonRaisingBuiltinModule(module_name):
1052
1057
  return _stdlib_module_raises.get(module_name)
1053
1058
 
1054
1059
 
1060
+ def _getChildPackageNames(module_name):
1061
+ module_name = ModuleName(module_name)
1062
+
1063
+ _module_name, module_filename, _module_kind, _finding = locateModule(
1064
+ parent_package=None, module_name=module_name, level=0
1065
+ )
1066
+
1067
+ package_dir = module_filename
1068
+
1069
+ for module_info in iter_modules([package_dir]):
1070
+ child_name = module_name.getChildNamed(module_info.name)
1071
+ yield child_name
1072
+
1073
+ if module_info.ispkg:
1074
+ for sub_module_name in getChildPackageNames(child_name):
1075
+ yield sub_module_name
1076
+
1077
+
1078
+ def getChildPackageNames(module_name):
1079
+ return tuple(_getChildPackageNames(module_name))
1080
+
1081
+
1055
1082
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
1056
1083
  # integrates with CPython, but also works on its own.
1057
1084
  #
@@ -339,12 +339,23 @@ def _addIncludedModule(module, package_only):
339
339
  module_package=module.getFullName(),
340
340
  package_only=False,
341
341
  )
342
- elif sub_path.endswith(".py"):
342
+ elif sub_filename.endswith(".py"):
343
343
  checkPluginSinglePath(
344
344
  sub_path,
345
345
  module_package=module.getFullName(),
346
346
  package_only=False,
347
347
  )
348
+ else:
349
+ for suffix in getSharedLibrarySuffixes():
350
+ if (
351
+ sub_filename.endswith(suffix)
352
+ and "." not in sub_filename[: -len(suffix)]
353
+ ):
354
+ checkPluginSinglePath(
355
+ sub_path,
356
+ module_package=module.getFullName(),
357
+ package_only=False,
358
+ )
348
359
 
349
360
  elif module.isCompiledPythonModule() or module.isUncompiledPythonModule():
350
361
  ModuleRegistry.addRootModule(module)
@@ -141,53 +141,55 @@ def isStandardLibraryPath(filename):
141
141
  return _is_standard_library_path_cache[filename]
142
142
 
143
143
 
144
- # Some modules we want to exclude entirely.
145
- _excluded_stdlib_modules = ["__main__.py", "__init__.py", "antigravity.py"]
146
-
147
- if not isWin32Windows():
148
- # On posix systems, and posix Python variants on Windows, this won't
149
- # work.
150
- _excluded_stdlib_modules.append("wintypes.py")
151
- _excluded_stdlib_modules.append("cp65001.py")
152
-
153
-
154
144
  def scanStandardLibraryPath(stdlib_dir):
155
145
  # There is a lot of filtering here, done in branches, so there is many of
156
- # them, but that's acceptable, pylint: disable=too-many-branches,too-many-statements
146
+ # them, but that's acceptable, pylint: disable=too-many-branches
157
147
 
158
148
  for root, dirs, filenames in os.walk(stdlib_dir):
159
149
  import_path = root[len(stdlib_dir) :].strip("/\\")
160
150
  import_path = import_path.replace("\\", ".").replace("/", ".")
161
151
 
152
+ def _removeFilenamesIfPresent(*remove_filenames):
153
+ # pylint: intended for loop usage, pylint: disable=cell-var-from-loop
154
+ for remove_filename in remove_filenames:
155
+ if remove_filename in filenames:
156
+ filenames.remove(remove_filename)
157
+
158
+ def _removeDirsIfPresent(*remove_dirs):
159
+ # pylint: intended for loop usage, pylint: disable=cell-var-from-loop
160
+ for remove_dir in remove_dirs:
161
+ if remove_dir in dirs:
162
+ dirs.remove(remove_dir)
163
+
164
+ _removeDirsIfPresent("__pycache__")
165
+
166
+ # Ignore ".idea", ".git" and similar folders, they are not modules
167
+ dirs[:] = [dirname for dirname in dirs if not dirname.startswith(".")]
168
+
162
169
  if import_path == "":
163
- if "site-packages" in dirs:
164
- dirs.remove("site-packages")
165
- if "dist-packages" in dirs:
166
- dirs.remove("dist-packages")
167
- if "vendor-packages" in dirs:
168
- dirs.remove("vendor-packages")
169
- if "test" in dirs:
170
- dirs.remove("test")
171
- if "turtledemo" in dirs:
172
- dirs.remove("turtledemo")
173
-
174
- if "ensurepip" in filenames:
175
- filenames.remove("ensurepip")
176
- if "ensurepip" in dirs:
177
- dirs.remove("ensurepip")
178
-
179
- if "_ios_support.py" in filenames and not isMacOS():
180
- filenames.remove("_ios_support.py")
181
-
182
- # Ignore "lib-dynload" and "lib-tk" and alike.
170
+ # Ignore "lib-dynload" and "lib-tk" and alike, spell-checker: ignore dynload
183
171
  dirs[:] = [
184
172
  dirname
185
173
  for dirname in dirs
186
174
  if not dirname.startswith("lib-")
187
- if dirname != "Tools"
188
175
  if not dirname.startswith("plat-")
189
176
  ]
190
177
 
178
+ _removeDirsIfPresent(
179
+ "site-packages",
180
+ "dist-packages",
181
+ "vendor-packages",
182
+ "test",
183
+ "ensurepip",
184
+ "turtledemo",
185
+ "Tools",
186
+ )
187
+ _removeFilenamesIfPresent("ensurepip")
188
+
189
+ if not isMacOS():
190
+ _removeFilenamesIfPresent("_ios_support.py")
191
+
192
+ # Ignore tests from selected packages, spell-checker: ignore bsddb
191
193
  if import_path in (
192
194
  "tkinter",
193
195
  "Tkinter",
@@ -199,38 +201,40 @@ def scanStandardLibraryPath(stdlib_dir):
199
201
  "email",
200
202
  "bsddb",
201
203
  ):
202
- if "test" in dirs:
203
- dirs.remove("test")
204
+ _removeDirsIfPresent("test")
205
+
206
+ if import_path in ("lib2to3", "json", "distutils"):
207
+ _removeDirsIfPresent("tests")
204
208
 
205
209
  if import_path == "distutils.command":
206
210
  # Misbehaving and crashing while importing the world.
207
- if "bdist_conda.py" in filenames:
208
- filenames.remove("bdist_conda.py")
209
-
210
- if import_path in ("lib2to3", "json", "distutils"):
211
- if "tests" in dirs:
212
- dirs.remove("tests")
211
+ _removeFilenamesIfPresent("bdist_conda.py")
213
212
 
214
213
  if import_path == "asyncio":
215
- if "test_utils.py" in filenames:
216
- filenames.remove("test_utils.py")
214
+ _removeFilenamesIfPresent("test_utils.py")
217
215
 
218
- if python_version >= 0x340 and isWin32Windows():
216
+ if python_version >= 0x300 and isPosixWindows():
219
217
  if import_path == "multiprocessing":
220
- filenames.remove("popen_fork.py")
221
- filenames.remove("popen_forkserver.py")
222
- filenames.remove("popen_spawn_posix.py")
218
+ _removeFilenamesIfPresent(
219
+ "popen_fork.py", "popen_forkserver.py", "popen_spawn_posix.py"
220
+ )
223
221
 
224
- if python_version >= 0x300 and isPosixWindows():
225
222
  if import_path == "curses":
226
- filenames.remove("has_key.py")
223
+ _removeFilenamesIfPresent("has_key.py")
227
224
 
228
225
  if isNetBSD():
229
226
  if import_path == "xml.sax":
230
- filenames.remove("expatreader.py")
227
+ _removeFilenamesIfPresent("expatreader.py")
228
+
229
+ _removeFilenamesIfPresent("__main__.py", "__init__.py", "antigravity.py")
230
+
231
+ if not isWin32Windows():
232
+ # On POSIX systems, and on POSIX Python variants on Windows, this
233
+ # won't work.
234
+ _removeFilenamesIfPresent("wintypes.py", "cp65001.py")
231
235
 
232
236
  for filename in filenames:
233
- if filename.endswith(".py") and filename not in _excluded_stdlib_modules:
237
+ if filename.endswith(".py"):
234
238
  module_name = filename[:-3]
235
239
 
236
240
  if import_path == "":
@@ -238,13 +242,6 @@ def scanStandardLibraryPath(stdlib_dir):
238
242
  else:
239
243
  yield ModuleName(import_path + "." + module_name)
240
244
 
241
- if python_version >= 0x300:
242
- if "__pycache__" in dirs:
243
- dirs.remove("__pycache__")
244
-
245
- # Ignore ".idea", ".git" and similar folders, they are not modules
246
- dirs[:] = [dirname for dirname in dirs if not dirname.startswith(".")]
247
-
248
245
  for dirname in dirs:
249
246
  if import_path == "":
250
247
  yield ModuleName(dirname)
@@ -255,6 +252,7 @@ def scanStandardLibraryPath(stdlib_dir):
255
252
  _stdlib_no_auto_inclusion_list = (
256
253
  # Avoid this to be included, implicit usages will be rare, but it triggers
257
254
  # the Nuitka plugin "multiprocessing" that is always enabled.
255
+ # spell-checker: ignore _pydecimal,_posixsubprocess,pyexpat,sitecustomize
258
256
  "multiprocessing",
259
257
  "_multiprocessing",
260
258
  # Implicit usages of these will be rare, but it can have that costly extension module
@@ -369,13 +367,13 @@ _stdlib_no_auto_inclusion_list = (
369
367
  "py_compile",
370
368
  "msilib",
371
369
  "_opcode",
372
- # tzdata is not always needed
370
+ # time zone data is not always needed
373
371
  "zoneinfo",
374
372
  # tkinter under all its names
375
373
  "Tkinter",
376
374
  "tkinter",
377
375
  "_tkinter",
378
- # lib-tk from Python2
376
+ # lib-tk from Python2, spell-checker: ignore Tkdnd,Tkconstants
379
377
  "Tix",
380
378
  "FixTk",
381
379
  "ScrolledText",
@@ -76,14 +76,11 @@ class ExpressionAsyncgenObjectBody(ExpressionFunctionEntryPointBase):
76
76
  def getFunctionName(self):
77
77
  return self.name
78
78
 
79
- def markAsNeedsGeneratorReturnHandling(self, value):
80
- self.needs_generator_return_exit = max(self.needs_generator_return_exit, value)
81
-
82
- def needsGeneratorReturnHandling(self):
83
- return self.needs_generator_return_exit == 2
79
+ def markAsNeedsGeneratorReturnHandling(self):
80
+ self.needs_generator_return_exit = True
84
81
 
85
82
  def needsGeneratorReturnExit(self):
86
- return bool(self.needs_generator_return_exit)
83
+ return self.needs_generator_return_exit
87
84
 
88
85
  @staticmethod
89
86
  def needsCreation():
@@ -155,7 +155,7 @@ class ExpressionBuiltinIterForUnpack(ExpressionBuiltinIter1):
155
155
  # Rewrite exceptions to correct message.
156
156
  if (
157
157
  result_node.isExpressionRaiseException()
158
- and result_node.subnode_exception_type.isExpressionBuiltinExceptionRef()
158
+ and result_node.subnode_exception_type.isExpressionBuiltinMakeException()
159
159
  and result_node.subnode_exception_type.getExceptionName() == "TypeError"
160
160
  ):
161
161
  return makeRaiseTypeErrorExceptionReplacementFromTemplateAndValue(
@@ -18,15 +18,10 @@ from nuitka.Builtins import (
18
18
  builtin_type_names,
19
19
  )
20
20
  from nuitka.Options import hasPythonFlagNoAsserts
21
- from nuitka.PythonVersions import python_version
22
21
  from nuitka.specs import BuiltinParameterSpecs
23
22
 
24
23
  from .ConstantRefNodes import makeConstantRefNode
25
- from .ExceptionNodes import (
26
- ExpressionBuiltinMakeException,
27
- ExpressionBuiltinMakeExceptionImportError,
28
- ExpressionBuiltinMakeExceptionModuleNotFoundError,
29
- )
24
+ from .ExceptionNodes import makeBuiltinMakeExceptionNode
30
25
  from .ExpressionBases import (
31
26
  CompileTimeConstantExpressionBase,
32
27
  ExpressionBase,
@@ -267,33 +262,22 @@ class ExpressionBuiltinExceptionRef(ExpressionBuiltinRefBase):
267
262
  def computeExpressionCall(self, call_node, call_args, call_kw, trace_collection):
268
263
  exception_name = self.getExceptionName()
269
264
 
270
- def createBuiltinMakeException(args, name=None, path=None, source_ref=None):
271
- if exception_name == "ImportError" and python_version >= 0x300:
272
- return ExpressionBuiltinMakeExceptionImportError(
273
- args=args,
274
- name=name,
275
- path=path,
276
- source_ref=source_ref,
277
- )
278
- elif exception_name == "ModuleNotFoundError" and python_version >= 0x360:
279
- return ExpressionBuiltinMakeExceptionModuleNotFoundError(
280
- args=args,
281
- name=name,
282
- path=path,
283
- source_ref=source_ref,
284
- )
285
- else:
286
- # We expect to only get the star arguments for these.
287
- assert name is None
288
- assert path is None
289
-
290
- return ExpressionBuiltinMakeException(
291
- exception_name=exception_name, args=args, source_ref=source_ref
292
- )
265
+ def createBuiltinMakeExceptionNode(
266
+ args, name=None, path=None, obj=None, source_ref=None
267
+ ):
268
+ return makeBuiltinMakeExceptionNode(
269
+ exception_name=exception_name,
270
+ args=args,
271
+ name=name,
272
+ path=path,
273
+ obj=obj,
274
+ for_raise=False,
275
+ source_ref=source_ref,
276
+ )
293
277
 
294
278
  new_node = BuiltinParameterSpecs.extractBuiltinArgs(
295
279
  node=call_node,
296
- builtin_class=createBuiltinMakeException,
280
+ builtin_class=createBuiltinMakeExceptionNode,
297
281
  builtin_spec=BuiltinParameterSpecs.makeBuiltinExceptionParameterSpec(
298
282
  exception_name=exception_name
299
283
  ),