Nuitka-winsvc 2.2.2__cp311-cp311-win_amd64.whl → 2.3__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.
Files changed (199) hide show
  1. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/RECORD +199 -198
  3. nuitka/Bytecodes.py +4 -2
  4. nuitka/HardImportRegistry.py +1 -0
  5. nuitka/MainControl.py +16 -10
  6. nuitka/ModuleRegistry.py +15 -0
  7. nuitka/OptionParsing.py +30 -8
  8. nuitka/Options.py +104 -44
  9. nuitka/PostProcessing.py +9 -8
  10. nuitka/PythonVersions.py +2 -1
  11. nuitka/Serialization.py +47 -30
  12. nuitka/Version.py +1 -1
  13. nuitka/build/Backend.scons +46 -19
  14. nuitka/build/CCompilerVersion.scons +3 -3
  15. nuitka/build/Onefile.scons +4 -4
  16. nuitka/build/SconsCaching.py +3 -2
  17. nuitka/build/SconsCompilerSettings.py +11 -5
  18. nuitka/build/SconsInterface.py +22 -6
  19. nuitka/build/SconsUtils.py +9 -1
  20. nuitka/build/include/nuitka/allocator.h +58 -2
  21. nuitka/build/include/nuitka/compiled_frame.h +48 -13
  22. nuitka/build/include/nuitka/compiled_function.h +4 -0
  23. nuitka/build/include/nuitka/constants.h +6 -0
  24. nuitka/build/include/nuitka/exception_groups.h +6 -6
  25. nuitka/build/include/nuitka/exceptions.h +3 -3
  26. nuitka/build/include/nuitka/freelists.h +11 -0
  27. nuitka/build/include/nuitka/helper/dictionaries.h +5 -4
  28. nuitka/build/include/nuitka/helper/lists.h +5 -5
  29. nuitka/build/include/nuitka/helper/lists_generated.h +12 -12
  30. nuitka/build/include/nuitka/helper/sequences.h +6 -0
  31. nuitka/build/include/nuitka/helper/slices.h +14 -8
  32. nuitka/build/include/nuitka/helper/subscripts.h +1 -184
  33. nuitka/build/include/nuitka/helper/tuples.h +42 -33
  34. nuitka/build/include/nuitka/importing.h +5 -0
  35. nuitka/build/include/nuitka/prelude.h +35 -2
  36. nuitka/build/include/nuitka/safe_string_ops.h +1 -0
  37. nuitka/build/include/nuitka/threading.h +13 -10
  38. nuitka/build/static_src/CompiledAsyncgenType.c +19 -8
  39. nuitka/build/static_src/CompiledCellType.c +1 -1
  40. nuitka/build/static_src/CompiledCodeHelpers.c +18 -16
  41. nuitka/build/static_src/CompiledCoroutineType.c +23 -19
  42. nuitka/build/static_src/CompiledFrameType.c +46 -34
  43. nuitka/build/static_src/CompiledFunctionType.c +55 -34
  44. nuitka/build/static_src/CompiledGeneratorType.c +21 -19
  45. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +127 -130
  46. nuitka/build/static_src/CompiledMethodType.c +15 -17
  47. nuitka/build/static_src/HelpersAllocator.c +71 -0
  48. nuitka/build/static_src/HelpersAttributes.c +1 -1
  49. nuitka/build/static_src/HelpersBuiltin.c +5 -5
  50. nuitka/build/static_src/HelpersBytes.c +2 -2
  51. nuitka/build/static_src/HelpersCalling.c +3 -0
  52. nuitka/build/static_src/HelpersCallingGenerated.c +131 -131
  53. nuitka/build/static_src/HelpersComparisonEq.c +329 -329
  54. nuitka/build/static_src/HelpersComparisonEqUtils.c +3 -1
  55. nuitka/build/static_src/HelpersComparisonGe.c +322 -322
  56. nuitka/build/static_src/HelpersComparisonGt.c +321 -321
  57. nuitka/build/static_src/HelpersComparisonLe.c +322 -322
  58. nuitka/build/static_src/HelpersComparisonLt.c +321 -321
  59. nuitka/build/static_src/HelpersComparisonNe.c +329 -329
  60. nuitka/build/static_src/HelpersConsole.c +96 -0
  61. nuitka/build/static_src/HelpersConstantsBlob.c +10 -6
  62. nuitka/build/static_src/HelpersDeepcopy.c +10 -8
  63. nuitka/build/static_src/HelpersDictionaries.c +17 -11
  64. nuitka/build/static_src/HelpersDictionariesGenerated.c +65 -29
  65. nuitka/build/static_src/HelpersExceptions.c +107 -9
  66. nuitka/build/static_src/HelpersFilesystemPaths.c +64 -4
  67. nuitka/build/static_src/HelpersFloats.c +20 -14
  68. nuitka/build/static_src/HelpersImport.c +1 -1
  69. nuitka/build/static_src/HelpersJitSources.c +1 -1
  70. nuitka/build/static_src/HelpersLists.c +29 -19
  71. nuitka/build/static_src/HelpersListsGenerated.c +24 -24
  72. nuitka/build/static_src/HelpersMatching.c +32 -5
  73. nuitka/build/static_src/HelpersOperationBinaryAdd.c +90 -63
  74. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +4 -4
  75. nuitka/build/static_src/HelpersOperationBinaryBitand.c +33 -33
  76. nuitka/build/static_src/HelpersOperationBinaryBitor.c +33 -33
  77. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +33 -33
  78. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +24 -24
  79. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +24 -24
  80. nuitka/build/static_src/HelpersOperationBinaryLshift.c +30 -30
  81. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +7 -7
  82. nuitka/build/static_src/HelpersOperationBinaryMod.c +90 -90
  83. nuitka/build/static_src/HelpersOperationBinaryMult.c +64 -58
  84. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +24 -24
  85. nuitka/build/static_src/HelpersOperationBinaryPow.c +27 -27
  86. nuitka/build/static_src/HelpersOperationBinaryRshift.c +30 -30
  87. nuitka/build/static_src/HelpersOperationBinarySub.c +24 -24
  88. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +24 -24
  89. nuitka/build/static_src/HelpersOperationInplaceAdd.c +67 -49
  90. nuitka/build/static_src/HelpersOperationInplaceBitand.c +25 -25
  91. nuitka/build/static_src/HelpersOperationInplaceBitor.c +25 -25
  92. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +25 -25
  93. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +28 -28
  94. nuitka/build/static_src/HelpersOperationInplaceLshift.c +18 -18
  95. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
  96. nuitka/build/static_src/HelpersOperationInplaceMod.c +70 -70
  97. nuitka/build/static_src/HelpersOperationInplaceMult.c +33 -33
  98. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +28 -28
  99. nuitka/build/static_src/HelpersOperationInplacePow.c +28 -28
  100. nuitka/build/static_src/HelpersOperationInplaceRshift.c +18 -18
  101. nuitka/build/static_src/HelpersOperationInplaceSub.c +28 -28
  102. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +28 -28
  103. nuitka/build/static_src/HelpersRaising.c +10 -3
  104. nuitka/build/static_src/HelpersSafeStrings.c +14 -4
  105. nuitka/build/static_src/HelpersSlices.c +12 -5
  106. nuitka/build/static_src/HelpersStrings.c +1 -1
  107. nuitka/build/static_src/HelpersTuples.c +20 -15
  108. nuitka/build/static_src/InspectPatcher.c +74 -6
  109. nuitka/build/static_src/MainProgram.c +90 -25
  110. nuitka/build/static_src/MetaPathBasedLoader.c +81 -45
  111. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +2 -2
  112. nuitka/build/static_src/OnefileBootstrap.c +17 -20
  113. nuitka/code_generation/CodeGeneration.py +5 -2
  114. nuitka/code_generation/ConstantCodes.py +2 -2
  115. nuitka/code_generation/DictCodes.py +2 -2
  116. nuitka/code_generation/GlobalConstants.py +5 -0
  117. nuitka/code_generation/GlobalsLocalsCodes.py +2 -2
  118. nuitka/code_generation/ListCodes.py +2 -2
  119. nuitka/code_generation/LocalsDictCodes.py +1 -1
  120. nuitka/code_generation/ModuleCodes.py +19 -0
  121. nuitka/code_generation/PackageResourceCodes.py +14 -0
  122. nuitka/code_generation/SliceCodes.py +3 -3
  123. nuitka/code_generation/SubscriptCodes.py +5 -13
  124. nuitka/code_generation/TupleCodes.py +1 -1
  125. nuitka/code_generation/c_types/CTypePyObjectPointers.py +7 -7
  126. nuitka/code_generation/templates/CodeTemplatesConstants.py +7 -5
  127. nuitka/code_generation/templates/CodeTemplatesLoader.py +2 -0
  128. nuitka/code_generation/templates/CodeTemplatesModules.py +78 -54
  129. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +1 -1
  130. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +8 -8
  131. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +5 -5
  132. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +2 -2
  133. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +2 -2
  134. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +57 -21
  135. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +1 -1
  136. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +5 -5
  137. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +18 -18
  138. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +11 -11
  139. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +3 -3
  140. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +3 -3
  141. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +7 -7
  142. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +3 -3
  143. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +11 -11
  144. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +7 -7
  145. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +10 -10
  146. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
  147. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +3 -3
  148. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +4 -1
  149. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +4 -1
  150. nuitka/finalizations/FinalizeMarkups.py +0 -18
  151. nuitka/freezer/DependsExe.py +9 -4
  152. nuitka/freezer/DllDependenciesMacOS.py +1 -1
  153. nuitka/freezer/DllDependenciesWin32.py +1 -1
  154. nuitka/freezer/ImportDetection.py +1 -0
  155. nuitka/freezer/IncludedDataFiles.py +13 -4
  156. nuitka/freezer/Onefile.py +0 -1
  157. nuitka/freezer/Standalone.py +3 -1
  158. nuitka/importing/ImportCache.py +3 -2
  159. nuitka/importing/Importing.py +16 -3
  160. nuitka/importing/StandardLibrary.py +4 -0
  161. nuitka/nodes/ChildrenHavingMixins.py +2 -0
  162. nuitka/nodes/ExpressionBasesGenerated.py +4 -0
  163. nuitka/nodes/HardImportNodesGenerated.py +83 -0
  164. nuitka/nodes/ModuleNodes.py +10 -2
  165. nuitka/nodes/OsSysNodes.py +16 -0
  166. nuitka/nodes/SubscriptNodes.py +3 -3
  167. nuitka/plugins/PluginBase.py +2 -0
  168. nuitka/plugins/standard/DataFilesPlugin.py +22 -1
  169. nuitka/plugins/standard/DillPlugin/DillPlugin.c +3 -3
  170. nuitka/plugins/standard/OptionsNannyPlugin.py +9 -41
  171. nuitka/plugins/standard/PkgResourcesPlugin.py +8 -2
  172. nuitka/plugins/standard/PySidePyQtPlugin.py +4 -0
  173. nuitka/plugins/standard/standard.nuitka-package.config.yml +29 -13
  174. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +2 -2
  175. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +2 -2
  176. nuitka/specs/HardImportSpecs.py +3 -0
  177. nuitka/specs/ParameterSpecs.py +26 -15
  178. nuitka/tools/general/find_module/FindModuleCode.py +3 -2
  179. nuitka/tools/specialize/CTypeDescriptions.py +11 -9
  180. nuitka/tools/testing/Common.py +12 -5
  181. nuitka/tools/testing/SearchModes.py +5 -1
  182. nuitka/tools/watch/GitHub.py +1 -7
  183. nuitka/tree/Building.py +9 -6
  184. nuitka/tree/ReformulationMatchStatements.py +39 -3
  185. nuitka/tree/TreeHelpers.py +8 -0
  186. nuitka/utils/CStrings.py +7 -0
  187. nuitka/utils/Execution.py +10 -1
  188. nuitka/utils/FileOperations.py +21 -13
  189. nuitka/utils/Images.py +1 -1
  190. nuitka/utils/Importing.py +24 -0
  191. nuitka/utils/ReExecute.py +7 -3
  192. nuitka/utils/SharedLibraries.py +17 -0
  193. nuitka/utils/Yaml.py +9 -1
  194. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka-run.bat +0 -0
  195. {Nuitka_winsvc-2.2.2.data → Nuitka_winsvc-2.3.data}/scripts/nuitka.bat +0 -0
  196. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/LICENSE.txt +0 -0
  197. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/WHEEL +0 -0
  198. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/entry_points.txt +0 -0
  199. {Nuitka_winsvc-2.2.2.dist-info → Nuitka_winsvc-2.3.dist-info}/top_level.txt +0 -0
nuitka/Bytecodes.py CHANGED
@@ -7,6 +7,7 @@ import ast
7
7
 
8
8
  from nuitka.Options import hasPythonFlagNoAsserts, hasPythonFlagNoDocStrings
9
9
  from nuitka.tree.TreeHelpers import getKind
10
+ from nuitka.utils.Utils import withNoSyntaxWarning
10
11
 
11
12
  doc_having = tuple(
12
13
  getattr(ast, candidate)
@@ -26,8 +27,9 @@ def _removeDocFromBody(node):
26
27
  def compileSourceToBytecode(source_code, filename):
27
28
  """Compile given source code into bytecode."""
28
29
 
29
- # Prepare compile call with AST tree.
30
- tree = ast.parse(source_code, filename)
30
+ with withNoSyntaxWarning():
31
+ # Prepare compile call with AST tree.
32
+ tree = ast.parse(source_code, filename)
31
33
 
32
34
  # Do we need to remove doc strings.
33
35
  remove_doc_strings_from_tree = hasPythonFlagNoDocStrings()
@@ -211,6 +211,7 @@ module_os_path_trust = {
211
211
  "basename": trust_node,
212
212
  "dirname": trust_node,
213
213
  "abspath": trust_node,
214
+ "normpath": trust_node,
214
215
  }
215
216
 
216
217
 
nuitka/MainControl.py CHANGED
@@ -87,7 +87,10 @@ from nuitka.utils.FileOperations import (
87
87
  removeDirectory,
88
88
  resetDirectory,
89
89
  )
90
- from nuitka.utils.Importing import getSharedLibrarySuffix
90
+ from nuitka.utils.Importing import (
91
+ getPackageDirFilename,
92
+ getSharedLibrarySuffix,
93
+ )
91
94
  from nuitka.utils.MemoryUsage import reportMemoryUsage, showMemoryTrace
92
95
  from nuitka.utils.ModuleNames import ModuleName
93
96
  from nuitka.utils.ReExecute import callExecProcess, reExecuteNuitka
@@ -569,7 +572,6 @@ def runSconsBackend():
569
572
  # pylint: disable=too-many-branches,too-many-statements
570
573
 
571
574
  options = {
572
- "result_name": OutputDirectories.getResultBasePath(onefile=False),
573
575
  "source_dir": OutputDirectories.getSourceDirectoryPath(),
574
576
  "nuitka_python": asBoolStr(isNuitkaPython()),
575
577
  "debug_mode": asBoolStr(Options.is_debug),
@@ -692,7 +694,9 @@ def runSconsBackend():
692
694
  options["abiflags"] = abiflags
693
695
 
694
696
  if Options.shallMakeModule():
695
- options["module_suffix"] = getSharedLibrarySuffix(preferred=True)
697
+ options["result_exe"] = OutputDirectories.getResultBasePath(
698
+ onefile=False
699
+ ) + getSharedLibrarySuffix(preferred=True)
696
700
 
697
701
  link_module_libs = getModuleLinkerLibs()
698
702
  if link_module_libs:
@@ -759,7 +763,7 @@ def runSconsBackend():
759
763
  return result
760
764
 
761
765
 
762
- def callExecPython(args, add_path):
766
+ def callExecPython(args, add_path, uac):
763
767
  if add_path:
764
768
  if "PYTHONPATH" in os.environ:
765
769
  os.environ["PYTHONPATH"] += ":" + Options.getOutputDir()
@@ -769,7 +773,7 @@ def callExecPython(args, add_path):
769
773
  # Add the main arguments, previous separated.
770
774
  args += Options.getPositionalArgs()[1:] + Options.getMainArgs()
771
775
 
772
- callExecProcess(args)
776
+ callExecProcess(args, uac=uac)
773
777
 
774
778
 
775
779
  def _executeMain(binary_filename):
@@ -779,7 +783,11 @@ def _executeMain(binary_filename):
779
783
  else:
780
784
  args = (binary_filename, binary_filename)
781
785
 
782
- callExecPython(add_path=False, args=args)
786
+ callExecPython(
787
+ args=args,
788
+ add_path=False,
789
+ uac=isWin32Windows() and Options.shallAskForWindowsAdminRights(),
790
+ )
783
791
 
784
792
 
785
793
  def _executeModule(tree):
@@ -824,7 +832,7 @@ import sys; sys.path.insert(0, %(output_dir)r)
824
832
  else:
825
833
  args = (sys.executable, "python", "-c", python_command)
826
834
 
827
- callExecPython(add_path=True, args=args)
835
+ callExecPython(args=args, add_path=True, uac=False)
828
836
 
829
837
 
830
838
  def compileTree():
@@ -1085,9 +1093,7 @@ def _main():
1085
1093
  if Options.shallMakeModule():
1086
1094
  base_path = OutputDirectories.getResultBasePath(onefile=False)
1087
1095
 
1088
- if os.path.isdir(base_path) and os.path.isfile(
1089
- os.path.join(base_path, "__init__.py")
1090
- ):
1096
+ if os.path.isdir(base_path) and getPackageDirFilename(base_path):
1091
1097
  general.warning(
1092
1098
  """\
1093
1099
  The compilation result is hidden by package directory '%s'. Importing will \
nuitka/ModuleRegistry.py CHANGED
@@ -295,6 +295,21 @@ def getModuleOptimizationTimingInfos(module_name):
295
295
  return module_timing_infos.get(module_name, ())
296
296
 
297
297
 
298
+ def getImportedModuleNames():
299
+ result = OrderedSet()
300
+
301
+ for module in getDoneModules():
302
+ for used_module in module.getUsedModules():
303
+ module_name = used_module.module_name
304
+
305
+ if hasDoneModule(module_name):
306
+ continue
307
+
308
+ result.add(module_name)
309
+
310
+ return result
311
+
312
+
298
313
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
299
314
  # integrates with CPython, but also works on its own.
300
315
  #
nuitka/OptionParsing.py CHANGED
@@ -287,8 +287,8 @@ follow_group.add_option(
287
287
  default=[],
288
288
  help="""\
289
289
  Do not follow to that module name even if used, or if a package name, to the
290
- whole package in any case, overrides all other options. Can be given multiple
291
- times. Default empty.""",
290
+ whole package in any case, overrides all other options. This can also contain
291
+ patterns, e.g. "*.tests". Can be given multiple times. Default empty.""",
292
292
  )
293
293
 
294
294
  follow_group.add_option(
@@ -454,6 +454,18 @@ data_group.add_option(
454
454
  Output the data files found for a given package name. Default not done.""",
455
455
  )
456
456
 
457
+ data_group.add_option(
458
+ "--include-raw-dir",
459
+ action="append",
460
+ dest="raw_dirs",
461
+ metavar="DIRECTORY",
462
+ default=[],
463
+ help="""\
464
+ Include raw directories completely in the distribution. This is
465
+ recursive. Check '--include-data-dir' to use the sane option.
466
+ Default empty.""",
467
+ )
468
+
457
469
 
458
470
  del data_group
459
471
 
@@ -1288,9 +1300,7 @@ os_group.add_option(
1288
1300
  action="store_true",
1289
1301
  dest="disable_console",
1290
1302
  default=None,
1291
- help="""\
1292
- When compiling for Windows or macOS, disable the console window and create a GUI
1293
- application. Defaults to off.""",
1303
+ help=SUPPRESS_HELP,
1294
1304
  )
1295
1305
 
1296
1306
  os_group.add_option(
@@ -1298,10 +1308,22 @@ os_group.add_option(
1298
1308
  action="store_false",
1299
1309
  dest="disable_console",
1300
1310
  default=None,
1311
+ help=SUPPRESS_HELP,
1312
+ )
1313
+
1314
+ os_group.add_option(
1315
+ "--windows-console-mode",
1316
+ action="store",
1317
+ dest="console_mode",
1318
+ choices=("force", "disable", "attach"),
1319
+ metavar="CONSOLE_MODE",
1320
+ default=None,
1301
1321
  help="""\
1302
- When compiling for Windows or macOS, enable the console window and create a console
1303
- application. This disables hints from certain modules, e.g. "PySide" that suggest
1304
- to disable it. Defaults to true.""",
1322
+ Select console mode to use. Default mode is 'force' and creates a
1323
+ console window if not available, i.e. the program was started from one. With
1324
+ 'disable' it doesn't create or use a console. With 'attach' an existing console
1325
+ will be used for outputs. Default is 'force'.
1326
+ """,
1305
1327
  )
1306
1328
 
1307
1329
  os_group.add_option(
nuitka/Options.py CHANGED
@@ -325,6 +325,28 @@ when '--onefile' is not specified."""
325
325
  )
326
326
 
327
327
 
328
+ def _checkDataDirOptionValue(data_dir, option_name):
329
+ if "=" not in data_dir:
330
+ Tracing.options_logger.sysexit(
331
+ "Error, malformed '%s' value '%s' description, must specify a relative target path with '=' separating it."
332
+ % (option_name, data_dir)
333
+ )
334
+
335
+ src, dst = data_dir.split("=", 1)
336
+
337
+ if os.path.isabs(dst):
338
+ Tracing.options_logger.sysexit(
339
+ "Error, malformed '%s' value, must specify relative target path for data dir, not '%s' as in '%s'."
340
+ % (option_name, dst, data_dir)
341
+ )
342
+
343
+ if not os.path.isdir(src):
344
+ Tracing.options_logger.sysexit(
345
+ "Error, malformed '%s' value, must specify existing source data directory, not '%s' as in '%s'."
346
+ % (option_name, dst, data_dir)
347
+ )
348
+
349
+
328
350
  def parseArgs():
329
351
  """Parse the command line arguments
330
352
 
@@ -628,11 +650,6 @@ it before using it: '%s' (from --output-filename='%s')."""
628
650
  "Error, icon path executable '%s' does not exist." % icon_exe_path
629
651
  )
630
652
 
631
- if isMacOS() and not shallCreateAppBundle() and shallDisableConsoleWindow():
632
- Tracing.options_logger.sysexit(
633
- "Error, cannot disable console unless also using '--macos-create-app-bundle'."
634
- )
635
-
636
653
  try:
637
654
  file_version = getFileVersionTuple()
638
655
  # Catch all the things, don't want any interface, pylint: disable=broad-except
@@ -751,24 +768,10 @@ it before using it: '%s' (from --output-filename='%s')."""
751
768
  )
752
769
 
753
770
  for data_dir in options.data_dirs:
754
- if "=" not in data_dir:
755
- Tracing.options_logger.sysexit(
756
- "Error, malformed data dir description, must specify relative target path with '=' separating it."
757
- )
758
-
759
- src, dst = data_dir.split("=", 1)
760
-
761
- if os.path.isabs(dst):
762
- Tracing.options_logger.sysexit(
763
- "Error, must specify relative target path for data dir, not '%s' as in '%s'."
764
- % (dst, data_dir)
765
- )
771
+ _checkDataDirOptionValue(data_dir=data_dir, option_name="--include-data-dir")
766
772
 
767
- if not os.path.isdir(src):
768
- Tracing.options_logger.sysexit(
769
- "Error, must specify existing source data directory, not '%s' as in '%s'."
770
- % (dst, data_dir)
771
- )
773
+ for data_dir in options.raw_dirs:
774
+ _checkDataDirOptionValue(data_dir=data_dir, option_name="--include-raw-dir")
772
775
 
773
776
  for pattern in getShallFollowExtraFilePatterns():
774
777
  if os.path.isdir(pattern):
@@ -820,11 +823,14 @@ download. With that, your program will work on macOS 10.9 or higher."""
820
823
  "Error, Apple Python 2.7 from macOS is not usable as per Apple decision, use e.g. CPython 2.7 instead."
821
824
  )
822
825
 
823
- if isStandaloneMode() and isLinux() and getExecutablePath("patchelf") is None:
824
- Tracing.options_logger.sysexit(
825
- "Error, standalone mode on Linux requires 'patchelf' to be installed. Use 'apt/dnf/yum install patchelf' first."
826
+ if isStandaloneMode() and isLinux():
827
+ # Cyclic dependency
828
+ from nuitka.utils.SharedLibraries import (
829
+ checkPatchElfPresenceAndUsability,
826
830
  )
827
831
 
832
+ checkPatchElfPresenceAndUsability(Tracing.options_logger)
833
+
828
834
  pgo_executable = getPgoExecutable()
829
835
  if pgo_executable and not isPathExecutable(pgo_executable):
830
836
  Tracing.options_logger.sysexit(
@@ -895,8 +901,27 @@ version '%s' instead or newer Nuitka."""
895
901
  )
896
902
  )
897
903
 
904
+ if sys.version_info.releaselevel != "final":
905
+ if python_version_str not in getNotYetSupportedPythonVersions():
906
+ Tracing.general.sysexit(
907
+ """\
908
+ Non-final versions '%s' '%s' are not supported by Nuitka, use the \
909
+ final version instead."""
910
+ % (python_version_str, sys.version_info.releaselevel)
911
+ )
912
+
898
913
  if python_version_str in getNotYetSupportedPythonVersions():
899
- if not isExperimental("python" + python_version_str):
914
+ if sys.version_info.releaselevel != "final" and not isExperimental(
915
+ "python" + python_version_str
916
+ ):
917
+ Tracing.general.warning(
918
+ """\
919
+ The Python version '%s' '%s' is only experimentally supported by \
920
+ and recommended only for use in Nuitka development and testing."""
921
+ % (python_version_str, sys.version_info.releaselevel)
922
+ )
923
+
924
+ elif not isExperimental("python" + python_version_str):
900
925
  Tracing.general.sysexit(
901
926
  """\
902
927
  The Python version '%s' is not supported by Nuitka '%s', but an upcoming \
@@ -1112,15 +1137,10 @@ and not with the non-debug version.
1112
1137
  """
1113
1138
  )
1114
1139
 
1115
- if (
1116
- isMacOS()
1117
- and shallCreateAppBundle()
1118
- and shallDisableConsoleWindow()
1119
- and not getMacOSIconPaths()
1120
- ):
1140
+ if isMacOS() and shallCreateAppBundle() and not getMacOSIconPaths():
1121
1141
  Tracing.general.warning(
1122
1142
  """\
1123
- For GUI applications, you ought to specify an icon with '--macos-app-icon'.", \
1143
+ For application bundles, you ought to specify an icon with '--macos-app-icon'.", \
1124
1144
  otherwise a dock icon may not be present."""
1125
1145
  )
1126
1146
 
@@ -1139,7 +1159,7 @@ to work."""
1139
1159
  if (
1140
1160
  isWin32Windows()
1141
1161
  and 0x340 <= python_version < 0x380
1142
- and not shallDisableConsoleWindow()
1162
+ and getWindowsConsoleMode() != "disable"
1143
1163
  ):
1144
1164
  Tracing.general.warning(
1145
1165
  """\
@@ -1152,6 +1172,49 @@ console window for deployment.
1152
1172
  mnemonic="old-python-windows-console",
1153
1173
  )
1154
1174
 
1175
+ if shallMakeModule() and (getForcedStderrPath() or getForcedStdoutPath()):
1176
+ Tracing.general.warning(
1177
+ """\
1178
+ Extension modules do not control process outputs, therefore the \
1179
+ options '--force-stdout-spec' and '--force-stderr-spec' have no \
1180
+ impact and should not be specified."""
1181
+ )
1182
+
1183
+ if shallMakeModule() and options.console_mode is not None:
1184
+ Tracing.general.warning(
1185
+ """\
1186
+ Extension modules are not binaries, and therefore the option \
1187
+ '--windows-console-mode' does not have an impact and should \
1188
+ not be specified."""
1189
+ )
1190
+
1191
+ if options.disable_console in (True, False):
1192
+ if isWin32Windows():
1193
+ Tracing.general.warning(
1194
+ """\
1195
+ The old console option '%s' should not be given anymore, use '%s' \
1196
+ instead. It also has the extra mode 'attach' to consider."""
1197
+ % (
1198
+ (
1199
+ "--disable-console"
1200
+ if options.disable_console
1201
+ else "--enable-console"
1202
+ ),
1203
+ "--windows-console-module=%s"
1204
+ % ("force" if options.disable_console else "disable"),
1205
+ )
1206
+ )
1207
+ else:
1208
+ Tracing.general.warning(
1209
+ """The old console option '%s' should not be given anymore, and doesn't
1210
+ have any effect anymore on non-Windows."""
1211
+ % (
1212
+ "--disable-console"
1213
+ if options.disable_console
1214
+ else "--enable-console"
1215
+ )
1216
+ )
1217
+
1155
1218
 
1156
1219
  def isVerbose():
1157
1220
  """:returns: bool derived from ``--verbose``"""
@@ -1658,16 +1721,13 @@ def shallDisableCompressionCacheUsage():
1658
1721
  return shallDisableCacheUsage("compression")
1659
1722
 
1660
1723
 
1661
- def shallDisableConsoleWindow():
1662
- """:returns: None (not given), False, or True derived from ``--disable-console or ``--enable-console``"""
1663
- return options.disable_console
1664
-
1665
-
1666
- def mayDisableConsoleWindow():
1667
- """:returns: bool derived from platform support of disabling the console,"""
1668
-
1669
- # TODO: What about MSYS2?
1670
- return isWin32Windows() or isMacOS()
1724
+ def getWindowsConsoleMode():
1725
+ """:returns: str from ``--windows-console-mode``"""
1726
+ if options.disable_console is True:
1727
+ return "disable"
1728
+ if options.disable_console is False:
1729
+ return "force"
1730
+ return options.console_mode or "force"
1671
1731
 
1672
1732
 
1673
1733
  def _isFullCompat():
nuitka/PostProcessing.py CHANGED
@@ -11,7 +11,7 @@ import sys
11
11
 
12
12
  from nuitka import Options, OutputDirectories
13
13
  from nuitka.build.DataComposerInterface import getConstantBlobFilename
14
- from nuitka.finalizations.FinalizeMarkups import getImportedNames
14
+ from nuitka.ModuleRegistry import getImportedModuleNames
15
15
  from nuitka.PythonVersions import (
16
16
  getPythonABI,
17
17
  getTargetPythonDLLPath,
@@ -25,6 +25,7 @@ from nuitka.utils.FileOperations import (
25
25
  getFileContents,
26
26
  getFileSize,
27
27
  hasFilenameExtension,
28
+ isFilesystemEncodable,
28
29
  makePath,
29
30
  putTextFileContents,
30
31
  removeFileExecutablePermission,
@@ -285,11 +286,6 @@ def executePostProcessing():
285
286
 
286
287
  result_filename = OutputDirectories.getResultFullpath(onefile=False)
287
288
 
288
- if not os.path.exists(result_filename):
289
- postprocessing_logger.sysexit(
290
- "Error, scons failed to create the expected file %r. " % result_filename
291
- )
292
-
293
289
  if isWin32Windows():
294
290
  if not Options.shallMakeModule():
295
291
  if python_version < 0x300:
@@ -387,7 +383,11 @@ set NUITKA_PYTHONPATH=%(python_path)s
387
383
  "dll_directory": dll_directory,
388
384
  "python_home": sys.prefix,
389
385
  "python_path": ";".join(sys.path),
390
- "exe_filename": os.path.basename(result_filename),
386
+ "exe_filename": os.path.basename(
387
+ result_filename
388
+ if isFilesystemEncodable(result_filename)
389
+ else getExternalUsePath(result_filename)
390
+ ),
391
391
  }
392
392
 
393
393
  putTextFileContents(cmd_filename, cmd_contents)
@@ -420,7 +420,8 @@ __name__ = ...
420
420
  """
421
421
  % {
422
422
  "imports": "\n".join(
423
- "import %s" % module_name for module_name in getImportedNames()
423
+ "import %s" % module_name
424
+ for module_name in getImportedModuleNames()
424
425
  )
425
426
  },
426
427
  encoding="utf-8",
nuitka/PythonVersions.py CHANGED
@@ -31,6 +31,7 @@ def getSupportedPythonVersions():
31
31
  "3.9",
32
32
  "3.10",
33
33
  "3.11",
34
+ "3.12",
34
35
  )
35
36
 
36
37
 
@@ -42,7 +43,7 @@ def getNotYetSupportedPythonVersions():
42
43
  def getPartiallySupportedPythonVersions():
43
44
  """Partially supported Python versions for Nuitka."""
44
45
 
45
- return ("3.12",)
46
+ return ()
46
47
 
47
48
 
48
49
  def getZstandardSupportingVersions():
nuitka/Serialization.py CHANGED
@@ -163,7 +163,9 @@ class ConstantStreamReader(object):
163
163
  return self.pickle.load()
164
164
 
165
165
 
166
- class ConstantAccessor(object):
166
+ class GlobalConstantAccessor(object):
167
+ __slots__ = ("constants", "constants_writer", "top_level_name")
168
+
167
169
  def __init__(self, data_filename, top_level_name):
168
170
  self.constants = OrderedSet()
169
171
 
@@ -171,52 +173,54 @@ class ConstantAccessor(object):
171
173
  self.top_level_name = top_level_name
172
174
 
173
175
  def getConstantCode(self, constant):
174
- # Use in user code, or for constants building code itself, many
175
- # constant types get special code immediately.
176
- # pylint: disable=too-many-branches,too-many-statements
176
+ # Use in user code, or for constants building code itself, many constant
177
+ # types get special code immediately, and it's return driven.
178
+ # pylint: disable=too-many-branches,too-many-return-statements
177
179
  if constant is None:
178
- key = "Py_None"
180
+ return "Py_None"
179
181
  elif constant is True:
180
- key = "Py_True"
182
+ return "Py_True"
181
183
  elif constant is False:
182
- key = "Py_False"
184
+ return "Py_False"
183
185
  elif constant is Ellipsis:
184
- key = "Py_Ellipsis"
186
+ return "Py_Ellipsis"
185
187
  elif constant is NotImplemented:
186
- key = "Py_NotImplemented"
188
+ return "Py_NotImplemented"
187
189
  elif constant is sys.version_info:
188
- key = "Py_SysVersionInfo"
190
+ return "Py_SysVersionInfo"
189
191
  elif type(constant) is type:
190
192
  # TODO: Maybe make this a mapping in nuitka.Builtins
191
193
 
192
194
  if constant is None:
193
- key = "(PyObject *)Py_TYPE(Py_None)"
195
+ return "(PyObject *)Py_TYPE(Py_None)"
194
196
  elif constant is object:
195
- key = "(PyObject *)&PyBaseObject_Type"
197
+ return "(PyObject *)&PyBaseObject_Type"
196
198
  elif constant is staticmethod:
197
- key = "(PyObject *)&PyStaticMethod_Type"
199
+ return "(PyObject *)&PyStaticMethod_Type"
198
200
  elif constant is classmethod:
199
- key = "(PyObject *)&PyClassMethod_Type"
201
+ return "(PyObject *)&PyClassMethod_Type"
200
202
  elif constant is bytearray:
201
- key = "(PyObject *)&PyByteArray_Type"
203
+ return "(PyObject *)&PyByteArray_Type"
202
204
  elif constant is enumerate:
203
- key = "(PyObject *)&PyEnum_Type"
205
+ return "(PyObject *)&PyEnum_Type"
204
206
  elif constant is frozenset:
205
- key = "(PyObject *)&PyFrozenSet_Type"
207
+ return "(PyObject *)&PyFrozenSet_Type"
206
208
  elif python_version >= 0x270 and constant is memoryview:
207
- key = "(PyObject *)&PyMemoryView_Type"
209
+ return "(PyObject *)&PyMemoryView_Type"
208
210
  elif python_version < 0x300 and constant is basestring:
209
- key = "(PyObject *)&PyBaseString_Type"
211
+ return "(PyObject *)&PyBaseString_Type"
210
212
  elif python_version < 0x300 and constant is xrange:
211
- key = "(PyObject *)&PyRange_Type"
213
+ return "(PyObject *)&PyRange_Type"
212
214
  elif constant in builtin_anon_values:
213
- key = "(PyObject *)" + builtin_anon_codes[builtin_anon_values[constant]]
215
+ return (
216
+ "(PyObject *)" + builtin_anon_codes[builtin_anon_values[constant]]
217
+ )
214
218
  elif constant in builtin_exception_values_list:
215
- key = "(PyObject *)PyExc_%s" % constant.__name__
219
+ return "(PyObject *)PyExc_%s" % constant.__name__
216
220
  elif constant is ExceptionGroup:
217
- key = "(PyObject *)_PyInterpreterState_GET()->exc_state.PyExc_ExceptionGroup"
221
+ return "(PyObject *)_PyInterpreterState_GET()->exc_state.PyExc_ExceptionGroup"
218
222
  elif constant is BaseExceptionGroup:
219
- key = "(PyObject *)PyExc_BaseExceptionGroup"
223
+ return "(PyObject *)PyExc_BaseExceptionGroup"
220
224
  else:
221
225
  type_name = constant.__name__
222
226
 
@@ -225,15 +229,18 @@ class ConstantAccessor(object):
225
229
  elif constant is str:
226
230
  type_name = "string" if python_version < 0x300 else "unicode"
227
231
 
228
- key = "(PyObject *)&Py%s_Type" % type_name.capitalize()
232
+ return "(PyObject *)&Py%s_Type" % type_name.capitalize()
229
233
  else:
230
- key = "const_" + namifyConstant(constant)
234
+ return self._getConstantCode(constant)
231
235
 
232
- if key not in self.constants:
233
- self.constants.add(key)
234
- self.constants_writer.addConstantValue(constant)
236
+ def _getConstantCode(self, constant):
237
+ key = "const_" + namifyConstant(constant)
235
238
 
236
- key = "%s[%d]" % (self.top_level_name, self.constants.index(key))
239
+ if key not in self.constants:
240
+ self.constants.add(key)
241
+ self.constants_writer.addConstantValue(constant)
242
+
243
+ key = "%s[%d]" % (self.top_level_name, self.constants.index(key))
237
244
 
238
245
  # TODO: Make it returning, more clear.
239
246
  return key
@@ -256,6 +263,16 @@ class ConstantAccessor(object):
256
263
  return len(self.constants)
257
264
 
258
265
 
266
+ class ConstantAccessor(GlobalConstantAccessor):
267
+ def _getConstantCode(self, constant):
268
+ constant_type = type(constant)
269
+
270
+ if constant_type is tuple and not constant:
271
+ return "const_tuple_empty"
272
+
273
+ return GlobalConstantAccessor._getConstantCode(self, constant)
274
+
275
+
259
276
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
260
277
  # integrates with CPython, but also works on its own.
261
278
  #
nuitka/Version.py CHANGED
@@ -20,7 +20,7 @@
20
20
  """
21
21
 
22
22
  version_string = """\
23
- Nuitka V2.2.2
23
+ Nuitka V2.3
24
24
  Copyright (C) 2024 Kay Hayen."""
25
25
 
26
26