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
@@ -10,6 +10,7 @@ stuff. It will also frequently add sorting for determinism.
10
10
 
11
11
  from __future__ import print_function
12
12
 
13
+ import codecs
13
14
  import errno
14
15
  import fnmatch
15
16
  import glob
@@ -27,17 +28,10 @@ from nuitka.__past__ import ( # pylint: disable=redefined-builtin
27
28
  FileNotFoundError,
28
29
  PermissionError,
29
30
  basestring,
30
- raw_input,
31
31
  unicode,
32
32
  )
33
33
  from nuitka.PythonVersions import python_version
34
- from nuitka.Tracing import (
35
- flushStandardOutputs,
36
- general,
37
- my_print,
38
- options_logger,
39
- printLine,
40
- )
34
+ from nuitka.Tracing import general, my_print, options_logger, queryUser
41
35
 
42
36
  from .Importing import importFromInlineCopy
43
37
  from .ThreadedExecutor import RLock, getThreadIdent
@@ -101,8 +95,8 @@ def areSamePaths(path1, path2):
101
95
  if path1 == path2:
102
96
  return True
103
97
 
104
- path1 = os.path.abspath(os.path.normpath(path1))
105
- path2 = os.path.abspath(os.path.normpath(path2))
98
+ path1 = os.path.abspath(getNormalizedPath(path1))
99
+ path2 = os.path.abspath(getNormalizedPath(path2))
106
100
 
107
101
  if os.path.exists(path1) and os.path.exists(path2):
108
102
  path1 = getExternalUsePath(path1)
@@ -446,7 +440,7 @@ def getFileList(
446
440
  fullname = os.path.join(root, filename)
447
441
 
448
442
  if normalize:
449
- fullname = os.path.normpath(fullname)
443
+ fullname = getNormalizedPath(fullname)
450
444
 
451
445
  result.append(fullname)
452
446
 
@@ -787,19 +781,22 @@ def withTemporaryFile(suffix="", mode="w", delete=True, temp_path=None):
787
781
  yield temp_file
788
782
 
789
783
 
790
- def getFileContentByLine(filename, mode="r", encoding=None):
784
+ def getFileContentByLine(filename, mode="r", encoding=None, errors=None):
791
785
  # We read the whole, to keep lock times minimal. We only deal with small
792
786
  # files like this normally.
793
- return getFileContents(filename, mode, encoding=encoding).splitlines()
787
+ return getFileContents(
788
+ filename, mode, encoding=encoding, errors=errors
789
+ ).splitlines()
794
790
 
795
791
 
796
- def getFileContents(filename, mode="r", encoding=None):
792
+ def getFileContents(filename, mode="r", encoding=None, errors=None):
797
793
  """Get the contents of a file.
798
794
 
799
795
  Args:
800
796
  filename: str with the file to be read
801
797
  mode: "r" for str, "rb" for bytes result
802
798
  encoding: optional encoding to used when reading the file, e.g. "utf8"
799
+ errors: optional error handler decoding the content, as defined in `codecs`
803
800
 
804
801
  Returns:
805
802
  str or bytes - depending on mode.
@@ -807,7 +804,7 @@ def getFileContents(filename, mode="r", encoding=None):
807
804
  """
808
805
 
809
806
  with withFileLock("reading file %s" % filename):
810
- with openTextFile(filename, mode, encoding=encoding) as f:
807
+ with openTextFile(filename, mode, encoding=encoding, errors=errors) as f:
811
808
  return f.read()
812
809
 
813
810
 
@@ -829,18 +826,11 @@ def getFileFirstLine(filename, mode="r", encoding=None):
829
826
  return f.readline()
830
827
 
831
828
 
832
- def openTextFile(filename, mode, encoding=None):
833
- if encoding is not None:
834
- import codecs
835
-
836
- return codecs.open(filename, mode, encoding=encoding)
837
- else:
838
- # Avoid deprecation warning, is now the default.
839
- if python_version >= 0x370:
840
- mode = mode.replace("U", "")
829
+ def openTextFile(filename, mode, encoding=None, errors=None):
830
+ if python_version >= 0x370:
831
+ mode = mode.replace("U", "")
841
832
 
842
- # Encoding was checked to be not needed.
843
- return open(filename, mode) # pylint: disable=unspecified-encoding
833
+ return codecs.open(filename, mode, encoding=encoding, errors=errors)
844
834
 
845
835
 
846
836
  def putTextFileContents(filename, contents, encoding=None):
@@ -1027,33 +1017,6 @@ def copyFileWithPermissions(source_path, dest_path, dist_dir):
1027
1017
  os.chmod(dest_path, source_mode)
1028
1018
 
1029
1019
 
1030
- def queryUser(question, choices, default, default_non_interactive):
1031
- assert default in choices, (default, choices)
1032
- assert default_non_interactive in choices, (default, choices)
1033
-
1034
- prompt = "%s? %s : " % (
1035
- question,
1036
- "/".join(
1037
- "[%s]" % choice.title() if choice == default else choice.title()
1038
- for choice in choices
1039
- ),
1040
- )
1041
-
1042
- # Integrates with progress bar by closing it.
1043
- printLine(prompt, end="")
1044
- flushStandardOutputs()
1045
-
1046
- try:
1047
- reply = raw_input() or default
1048
- except EOFError:
1049
- reply = default_non_interactive
1050
-
1051
- if reply == "y":
1052
- reply = "yes"
1053
-
1054
- return reply.lower()
1055
-
1056
-
1057
1020
  def copyFile(source_path, dest_path):
1058
1021
  """Improved version of shutil.copy
1059
1022
 
@@ -1205,7 +1168,7 @@ def getWindowsLongPathName(filename):
1205
1168
  while True:
1206
1169
  output_buf = ctypes.create_unicode_buffer(output_buf_size)
1207
1170
  needed = GetLongPathNameW(
1208
- os.path.abspath(filename), output_buf, output_buf_size
1171
+ getNormalizedPath(os.path.abspath(filename)), output_buf, output_buf_size
1209
1172
  )
1210
1173
 
1211
1174
  if needed == 0:
@@ -1475,6 +1438,16 @@ def isFilesystemEncodable(filename):
1475
1438
  return True
1476
1439
 
1477
1440
 
1441
+ def makeFilesystemEncodable(filename):
1442
+ if not os.path.isabs(filename):
1443
+ filename = os.path.abspath(filename)
1444
+
1445
+ if not isFilesystemEncodable(filename):
1446
+ filename = getExternalUsePath(filename)
1447
+
1448
+ return filename
1449
+
1450
+
1478
1451
  def openPickleFile(filename, mode, protocol=-1):
1479
1452
  file_handle = openTextFile(filename, mode)
1480
1453
 
@@ -1533,6 +1506,18 @@ def getParentDirectories(path):
1533
1506
  yield path
1534
1507
 
1535
1508
 
1509
+ def getNormalizedPath(path):
1510
+ """Return normalized path that is also a native path, i.e. only legal characters.
1511
+
1512
+ Needed, because MSYS2 likes to keep "/" in normalized paths.
1513
+ """
1514
+ path = os.path.normpath(path)
1515
+ if isWin32Windows():
1516
+ path = path.replace("/", "\\")
1517
+
1518
+ return path
1519
+
1520
+
1536
1521
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
1537
1522
  # integrates with CPython, but also works on its own.
1538
1523
  #
nuitka/utils/Importing.py CHANGED
@@ -12,6 +12,7 @@ import sys
12
12
  from nuitka.PythonVersions import python_version
13
13
  from nuitka.Tracing import general
14
14
 
15
+ from .InlineCopies import getInlineCopyFolder
15
16
  from .ModuleNames import ModuleName
16
17
  from .Utils import withNoDeprecationWarning
17
18
 
@@ -156,20 +157,7 @@ _deleted_modules = {}
156
157
  def importFromInlineCopy(module_name, must_exist, delete_module=False):
157
158
  """Import a module from the inline copy stage."""
158
159
 
159
- folder_name = os.path.normpath(
160
- os.path.join(
161
- os.path.dirname(__file__), "..", "build", "inline_copy", module_name
162
- )
163
- )
164
-
165
- candidate_27 = folder_name + "_27"
166
- candidate_35 = folder_name + "_35"
167
-
168
- # Use specific versions if needed.
169
- if python_version < 0x300 and os.path.exists(candidate_27):
170
- folder_name = candidate_27
171
- elif python_version < 0x360 and os.path.exists(candidate_35):
172
- folder_name = candidate_35
160
+ folder_name = getInlineCopyFolder(module_name)
173
161
 
174
162
  module = _importFromFolder(
175
163
  module_name=module_name,
@@ -0,0 +1,52 @@
1
+ # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+
4
+ """ Policies for locating inline copies."""
5
+
6
+ import os
7
+
8
+ from nuitka.PythonVersions import python_version
9
+
10
+
11
+ def _getInlineCopyBaseFolder():
12
+ """Base folder for inline copies."""
13
+ return os.path.normpath(
14
+ os.path.join(os.path.dirname(__file__), "..", "build", "inline_copy")
15
+ )
16
+
17
+
18
+ def getInlineCopyFolder(module_name):
19
+ """Get the inline copy folder for a given name."""
20
+ folder_name = os.path.join(_getInlineCopyBaseFolder(), module_name)
21
+
22
+ candidate_27 = folder_name + "_27"
23
+ candidate_35 = folder_name + "_35"
24
+
25
+ # Use specific versions if needed.
26
+ if python_version < 0x300 and os.path.exists(candidate_27):
27
+ folder_name = candidate_27
28
+ elif python_version < 0x360 and os.path.exists(candidate_35):
29
+ folder_name = candidate_35
30
+
31
+ return folder_name
32
+
33
+
34
+ def getDownloadCopyFolder():
35
+ """Get the inline copy folder for a given name."""
36
+ return os.path.join(_getInlineCopyBaseFolder(), "downloads", "pip")
37
+
38
+
39
+ # Part of "Nuitka", an optimizing Python compiler that is compatible and
40
+ # integrates with CPython, but also works on its own.
41
+ #
42
+ # Licensed under the Apache License, Version 2.0 (the "License");
43
+ # you may not use this file except in compliance with the License.
44
+ # You may obtain a copy of the License at
45
+ #
46
+ # http://www.apache.org/licenses/LICENSE-2.0
47
+ #
48
+ # Unless required by applicable law or agreed to in writing, software
49
+ # distributed under the License is distributed on an "AS IS" BASIS,
50
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
51
+ # See the License for the specific language governing permissions and
52
+ # limitations under the License.
@@ -195,10 +195,15 @@ def findPythons(python_version, module_name=None, module_version=None):
195
195
  _installed_pythons[python_version] = result
196
196
 
197
197
  return tuple(
198
- candidate
199
- for candidate in _installed_pythons[python_version]
200
- if candidate.checkUsability(
201
- module_name=module_name, module_version=module_version
198
+ sorted(
199
+ (
200
+ candidate
201
+ for candidate in _installed_pythons[python_version]
202
+ if candidate.checkUsability(
203
+ module_name=module_name, module_version=module_version
204
+ )
205
+ ),
206
+ key=lambda c: c.getPythonExe(),
202
207
  )
203
208
  )
204
209
 
nuitka/utils/Json.py CHANGED
@@ -19,9 +19,9 @@ def loadJsonFromFilename(filename):
19
19
  return None
20
20
 
21
21
 
22
- def writeJsonToFilename(filename, contents):
22
+ def writeJsonToFilename(filename, contents, indent=2):
23
23
  with openTextFile(filename, "w") as output:
24
- json.dump(contents, output)
24
+ json.dump(contents, output, indent=indent)
25
25
 
26
26
 
27
27
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -0,0 +1,44 @@
1
+ # Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+
4
+ """ Access package data. """
5
+
6
+ import os
7
+ import pkgutil
8
+
9
+ from nuitka.importing.Importing import locateModule
10
+
11
+ from .FileOperations import getFileContents
12
+
13
+
14
+ def getPackageData(package_name, resource):
15
+ """Get the package data, but without loading the code, i.e. we try and avoids its loader.
16
+
17
+ If it's absolutely necessary, we fallback to "pkgutil.get_data" but
18
+ only if we absolutely cannot find it easily.
19
+ """
20
+ package_directory = locateModule(package_name, None, 0)[1]
21
+
22
+ if package_directory is not None:
23
+ resource_filename = os.path.join(package_directory, resource)
24
+
25
+ if os.path.exists(resource_filename):
26
+ return getFileContents(resource_filename, mode="rb")
27
+
28
+ return pkgutil.get_data(package_name, resource)
29
+
30
+
31
+ # Part of "Nuitka", an optimizing Python compiler that is compatible and
32
+ # integrates with CPython, but also works on its own.
33
+ #
34
+ # Licensed under the Apache License, Version 2.0 (the "License");
35
+ # you may not use this file except in compliance with the License.
36
+ # You may obtain a copy of the License at
37
+ #
38
+ # http://www.apache.org/licenses/LICENSE-2.0
39
+ #
40
+ # Unless required by applicable law or agreed to in writing, software
41
+ # distributed under the License is distributed on an "AS IS" BASIS,
42
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
+ # See the License for the specific language governing permissions and
44
+ # limitations under the License.
nuitka/utils/Utils.py CHANGED
@@ -128,6 +128,22 @@ def getWindowsRelease():
128
128
  if not isWin32OrPosixWindows():
129
129
  return None
130
130
 
131
+ if isPosixWindows():
132
+ from .FileOperations import getFileContents
133
+
134
+ build_number = int(
135
+ getFileContents("/proc/version").split(" ")[0].rsplit("-")[-1]
136
+ )
137
+
138
+ if build_number >= 21996:
139
+ return 11
140
+ elif build_number >= 10240:
141
+ return 10
142
+ elif build_number >= 9200:
143
+ return 8
144
+ else:
145
+ return 7
146
+
131
147
  class OsVersionInfoEx(ctypes.Structure):
132
148
  _fields_ = [
133
149
  ("dwOSVersionInfoSize", ctypes.c_ulong),
@@ -308,6 +324,7 @@ def encodeNonAscii(var_name):
308
324
  else:
309
325
  # Using a escaping here, because that makes it safe in terms of not
310
326
  # to occur in the encoding escape sequence for unicode use.
327
+ # spell-checker: ignore xmlcharrefreplace
311
328
  var_name = var_name.replace("$$", "$_$")
312
329
 
313
330
  var_name = var_name.encode("ascii", "xmlcharrefreplace")