Nuitka-winsvc 2.1.5__cp311-cp311-win_amd64.whl → 2.2.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 (234) hide show
  1. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +234 -225
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +9 -5
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/constants.h +2 -0
  26. nuitka/build/include/nuitka/exceptions.h +554 -179
  27. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  28. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  29. nuitka/build/include/nuitka/helper/ints.h +15 -2
  30. nuitka/build/include/nuitka/helper/lists.h +4 -1
  31. nuitka/build/include/nuitka/helper/raising.h +12 -0
  32. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  33. nuitka/build/include/nuitka/helpers.h +5 -0
  34. nuitka/build/include/nuitka/importing.h +3 -4
  35. nuitka/build/include/nuitka/jit_sources.h +25 -0
  36. nuitka/build/include/nuitka/prelude.h +38 -11
  37. nuitka/build/include/nuitka/printing.h +3 -0
  38. nuitka/build/include/nuitka/threading.h +2 -6
  39. nuitka/build/include/nuitka/type_aliases.h +27 -0
  40. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  41. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  42. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  43. nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
  44. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  45. nuitka/build/static_src/CompiledFrameType.c +14 -11
  46. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  47. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  48. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  49. nuitka/build/static_src/CompiledMethodType.c +8 -7
  50. nuitka/build/static_src/HelpersAttributes.c +2 -19
  51. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  52. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  53. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  57. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  58. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  59. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  60. nuitka/build/static_src/HelpersExceptions.c +36 -22
  61. nuitka/build/static_src/HelpersFiles.c +9 -0
  62. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  63. nuitka/build/static_src/HelpersImportHard.c +15 -0
  64. nuitka/build/static_src/HelpersJitSources.c +46 -0
  65. nuitka/build/static_src/HelpersLists.c +40 -0
  66. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  67. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  68. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  69. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  70. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  71. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  72. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  73. nuitka/build/static_src/HelpersProfiling.c +3 -4
  74. nuitka/build/static_src/HelpersRaising.c +62 -1
  75. nuitka/build/static_src/HelpersStrings.c +203 -8
  76. nuitka/build/static_src/HelpersTypes.c +42 -0
  77. nuitka/build/static_src/MainProgram.c +1 -1
  78. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  79. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  80. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  81. nuitka/code_generation/BuiltinCodes.py +1 -0
  82. nuitka/code_generation/CodeGeneration.py +11 -0
  83. nuitka/code_generation/CodeHelpers.py +5 -3
  84. nuitka/code_generation/CodeObjectCodes.py +10 -6
  85. nuitka/code_generation/ComparisonCodes.py +19 -3
  86. nuitka/code_generation/ConstantCodes.py +5 -0
  87. nuitka/code_generation/Contexts.py +22 -6
  88. nuitka/code_generation/Emission.py +1 -0
  89. nuitka/code_generation/ErrorCodes.py +8 -16
  90. nuitka/code_generation/EvalCodes.py +5 -3
  91. nuitka/code_generation/ExceptionCodes.py +8 -1
  92. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  93. nuitka/code_generation/FrameCodes.py +5 -3
  94. nuitka/code_generation/FunctionCodes.py +0 -1
  95. nuitka/code_generation/GeneratorCodes.py +3 -3
  96. nuitka/code_generation/GlobalConstants.py +1 -2
  97. nuitka/code_generation/ImportCodes.py +2 -0
  98. nuitka/code_generation/JitCodes.py +44 -0
  99. nuitka/code_generation/ListCodes.py +11 -17
  100. nuitka/code_generation/MatchCodes.py +0 -1
  101. nuitka/code_generation/ModuleCodes.py +2 -1
  102. nuitka/code_generation/Namify.py +0 -1
  103. nuitka/code_generation/NetworkxCodes.py +51 -0
  104. nuitka/code_generation/OperationCodes.py +8 -6
  105. nuitka/code_generation/PackageResourceCodes.py +7 -5
  106. nuitka/code_generation/TensorflowCodes.py +54 -0
  107. nuitka/code_generation/TypeAliasCodes.py +71 -0
  108. nuitka/code_generation/VariableCodes.py +7 -5
  109. nuitka/code_generation/VariableDeclarations.py +1 -0
  110. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  111. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  112. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  113. nuitka/code_generation/templates/CodeTemplatesConstants.py +15 -0
  114. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  115. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  116. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  117. nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
  118. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  119. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  120. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  121. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  122. nuitka/containers/Namedtuples.py +0 -1
  123. nuitka/finalizations/Finalization.py +1 -0
  124. nuitka/finalizations/FinalizeMarkups.py +0 -1
  125. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  126. nuitka/freezer/DllDependenciesPosix.py +0 -1
  127. nuitka/freezer/IncludedDataFiles.py +46 -15
  128. nuitka/freezer/IncludedEntryPoints.py +5 -3
  129. nuitka/freezer/Standalone.py +6 -1
  130. nuitka/importing/ImportCache.py +2 -2
  131. nuitka/importing/ImportResolving.py +80 -78
  132. nuitka/importing/Importing.py +34 -1
  133. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  134. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  135. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  136. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  137. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  138. nuitka/nodes/BuiltinRefNodes.py +8 -1
  139. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  140. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  141. nuitka/nodes/CodeObjectSpecs.py +1 -1
  142. nuitka/nodes/ConstantRefNodes.py +38 -0
  143. nuitka/nodes/CtypesNodes.py +0 -1
  144. nuitka/nodes/DictionaryNodes.py +0 -1
  145. nuitka/nodes/ExceptionNodes.py +10 -0
  146. nuitka/nodes/ExpressionBases.py +15 -9
  147. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  148. nuitka/nodes/FunctionNodes.py +50 -5
  149. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  150. nuitka/nodes/ImportHardNodes.py +27 -13
  151. nuitka/nodes/ImportNodes.py +90 -70
  152. nuitka/nodes/InjectCNodes.py +0 -1
  153. nuitka/nodes/ModuleNodes.py +10 -5
  154. nuitka/nodes/NetworkxNodes.py +45 -0
  155. nuitka/nodes/OperatorNodesUnary.py +1 -0
  156. nuitka/nodes/OsSysNodes.py +0 -1
  157. nuitka/nodes/PackageMetadataNodes.py +0 -1
  158. nuitka/nodes/PackageResourceNodes.py +10 -6
  159. nuitka/nodes/StatementBasesGenerated.py +107 -60
  160. nuitka/nodes/StringConcatenationNodes.py +1 -0
  161. nuitka/nodes/TensorflowNodes.py +38 -0
  162. nuitka/nodes/TypeNodes.py +21 -0
  163. nuitka/nodes/VariableRefNodes.py +1 -0
  164. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  165. nuitka/optimizations/Optimization.py +7 -6
  166. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  167. nuitka/optimizations/Tags.py +0 -1
  168. nuitka/optimizations/TraceCollections.py +6 -55
  169. nuitka/optimizations/ValueTraces.py +49 -1
  170. nuitka/plugins/PluginBase.py +26 -4
  171. nuitka/plugins/Plugins.py +49 -12
  172. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  173. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  174. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  175. nuitka/plugins/standard/DillPlugin.py +3 -3
  176. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  177. nuitka/plugins/standard/GiPlugin.py +1 -0
  178. nuitka/plugins/standard/ImplicitImports.py +9 -7
  179. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  180. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  181. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  182. nuitka/plugins/standard/PmwPlugin.py +10 -9
  183. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  184. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  185. nuitka/plugins/standard/TorchPlugin.py +1 -0
  186. nuitka/plugins/standard/TrioPlugin.py +1 -0
  187. nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -54
  188. nuitka/reports/CompilationReportReader.py +0 -1
  189. nuitka/reports/Reports.py +49 -5
  190. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  191. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  192. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  193. nuitka/specs/HardImportSpecs.py +34 -1
  194. nuitka/specs/ParameterSpecs.py +11 -9
  195. nuitka/tools/environments/Virtualenv.py +0 -1
  196. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  197. nuitka/tools/specialize/SpecializeC.py +11 -9
  198. nuitka/tools/specialize/SpecializePython.py +57 -30
  199. nuitka/tools/testing/Common.py +24 -7
  200. nuitka/tools/testing/OutputComparison.py +4 -0
  201. nuitka/tools/testing/Pythons.py +0 -1
  202. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  203. nuitka/tools/watch/GitHub.py +4 -1
  204. nuitka/tools/watch/__main__.py +22 -1
  205. nuitka/tree/Building.py +3 -0
  206. nuitka/tree/InternalModule.py +0 -1
  207. nuitka/tree/ReformulationAssertStatements.py +1 -0
  208. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  209. nuitka/tree/ReformulationClasses3.py +23 -26
  210. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  211. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  212. nuitka/tree/ReformulationExecStatements.py +8 -6
  213. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  214. nuitka/tree/SourceHandling.py +8 -0
  215. nuitka/tree/TreeHelpers.py +6 -3
  216. nuitka/utils/AppDirs.py +6 -2
  217. nuitka/utils/CStrings.py +1 -1
  218. nuitka/utils/CommandLineOptions.py +0 -1
  219. nuitka/utils/Distributions.py +3 -3
  220. nuitka/utils/Download.py +5 -1
  221. nuitka/utils/Execution.py +6 -3
  222. nuitka/utils/FileOperations.py +62 -35
  223. nuitka/utils/Importing.py +4 -4
  224. nuitka/utils/InstanceCounters.py +1 -0
  225. nuitka/utils/MacOSApp.py +1 -0
  226. nuitka/utils/Shebang.py +1 -0
  227. nuitka/utils/Utils.py +39 -1
  228. nuitka/utils/WindowsFileUsage.py +4 -3
  229. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
  230. {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
  231. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
  232. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
  233. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
  234. {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
@@ -30,6 +30,7 @@ from .SconsProgress import updateSconsProgressBar
30
30
  from .SconsUtils import (
31
31
  getExecutablePath,
32
32
  getSconsReportValue,
33
+ isZigName,
33
34
  setEnvironmentVariable,
34
35
  )
35
36
 
@@ -100,21 +101,17 @@ def _injectCcache(env, cc_path, python_prefix, assume_yes_for_downloads):
100
101
 
101
102
  else:
102
103
  scons_details_logger.info(
103
- "Using ccache '%s' from NUITKA_CCACHE_BINARY environment variable."
104
+ "Using ccache '%s' from 'NUITKA_CCACHE_BINARY' environment variable."
104
105
  % ccache_binary
105
106
  )
106
107
 
107
108
  if ccache_binary is not None and os.path.exists(ccache_binary):
108
- # Make sure the
109
109
  # In case we are on Windows, make sure the Anaconda form runs outside of Anaconda
110
110
  # environment, by adding DLL folder to PATH.
111
111
  assert areSamePaths(
112
112
  getExecutablePath(os.path.basename(env.the_compiler), env=env), cc_path
113
113
  )
114
114
 
115
- # We use absolute paths for CC, pass it like this, as ccache does not like absolute.
116
- env["CXX"] = env["CC"] = '"%s" "%s"' % (ccache_binary, cc_path)
117
-
118
115
  # Spare ccache the detection of the compiler, seems it will also misbehave when it's
119
116
  # prefixed with "ccache" on old gcc versions in terms of detecting need for C++ linkage.
120
117
  env["LINK"] = '"%s"' % cc_path
@@ -126,58 +123,79 @@ def _injectCcache(env, cc_path, python_prefix, assume_yes_for_downloads):
126
123
  "Providing real CC path '%s' via PATH extension." % cc_path
127
124
  )
128
125
 
126
+ values = [ccache_binary, cc_path]
127
+
128
+ if isZigName(env.the_cc_name):
129
+ values.append("c++" if env.c11_mode else "cc")
130
+
131
+ # We use absolute paths for CC, pass it like this, as ccache does not like absolute.
132
+ env["CXX"] = env["CC"] = " ".join('"%s"' % value for value in values)
133
+
134
+ return True
135
+
136
+ return False
137
+
129
138
 
130
139
  def enableCcache(
131
- env,
132
- source_dir,
133
- python_prefix,
134
- assume_yes_for_downloads,
140
+ env, source_dir, python_prefix, assume_yes_for_downloads, disable_ccache
135
141
  ):
136
- # The ccache needs absolute path, otherwise it will not work.
137
- ccache_logfile = os.path.abspath(
138
- os.path.join(source_dir, "ccache-%d.txt" % os.getpid())
139
- )
142
+ inject_ccache = not disable_ccache
140
143
 
141
- setEnvironmentVariable(env, "CCACHE_LOGFILE", ccache_logfile)
142
- env["CCACHE_LOGFILE"] = ccache_logfile
143
-
144
- # Unless asked to do otherwise, store ccache files in our own directory.
145
- if "CCACHE_DIR" not in os.environ:
146
- ccache_dir = getCacheDir("ccache")
147
- makePath(ccache_dir)
148
- ccache_dir = getExternalUsePath(ccache_dir)
149
- setEnvironmentVariable(env, "CCACHE_DIR", ccache_dir)
150
- env["CCACHE_DIR"] = ccache_dir
151
-
152
- if "CLCACHE_MEMCACHED" in os.environ:
153
- scons_logger.warning(
154
- "The setting of 'CLCACHE_MEMCACHED' environment is not supported with clcache."
144
+ if inject_ccache:
145
+ # The ccache needs absolute path, otherwise it will not work.
146
+ ccache_logfile = os.path.abspath(
147
+ os.path.join(source_dir, "ccache-%d.txt" % os.getpid())
155
148
  )
156
- setEnvironmentVariable(env, "CLCACHE_MEMCACHED", None)
157
149
 
158
- # We know the include files we created are safe to use.
159
- setEnvironmentVariable(
160
- env, "CCACHE_SLOPPINESS", "include_file_ctime,include_file_mtime"
161
- )
150
+ setEnvironmentVariable(env, "CCACHE_LOGFILE", ccache_logfile)
151
+ env["CCACHE_LOGFILE"] = ccache_logfile
162
152
 
163
- # First check if it's not already supposed to be a ccache, then do nothing.
164
- cc_path = getExecutablePath(env.the_compiler, env=env)
153
+ # Unless asked to do otherwise, store ccache files in our own directory.
154
+ if "CCACHE_DIR" not in os.environ:
155
+ ccache_dir = getCacheDir("ccache")
156
+ makePath(ccache_dir)
157
+ ccache_dir = getExternalUsePath(ccache_dir)
158
+ setEnvironmentVariable(env, "CCACHE_DIR", ccache_dir)
159
+ env["CCACHE_DIR"] = ccache_dir
165
160
 
166
- cc_is_link, cc_link_path = getLinkTarget(cc_path)
167
- if cc_is_link and os.path.basename(cc_link_path) == "ccache":
168
- scons_details_logger.info(
169
- "Chosen compiler %s is pointing to ccache %s already."
170
- % (cc_path, cc_link_path)
161
+ if "CLCACHE_MEMCACHED" in os.environ:
162
+ scons_logger.warning(
163
+ "The setting of 'CLCACHE_MEMCACHED' environment is not supported with clcache."
164
+ )
165
+ setEnvironmentVariable(env, "CLCACHE_MEMCACHED", None)
166
+
167
+ # We know the include files we created are safe to use.
168
+ setEnvironmentVariable(
169
+ env, "CCACHE_SLOPPINESS", "include_file_ctime,include_file_mtime"
171
170
  )
172
171
 
173
- return True
172
+ # First check if it's not already supposed to be a ccache, then do nothing.
173
+ cc_path = getExecutablePath(env.the_compiler, env=env)
174
174
 
175
- return _injectCcache(
176
- env=env,
177
- cc_path=cc_path,
178
- python_prefix=python_prefix,
179
- assume_yes_for_downloads=assume_yes_for_downloads,
180
- )
175
+ cc_is_link, cc_link_path = getLinkTarget(cc_path)
176
+ if cc_is_link and os.path.basename(cc_link_path) == "ccache":
177
+ scons_details_logger.info(
178
+ "Chosen compiler %s is pointing to ccache %s already."
179
+ % (cc_path, cc_link_path)
180
+ )
181
+
182
+ inject_ccache = False
183
+
184
+ if inject_ccache:
185
+ inject_ccache = _injectCcache(
186
+ env=env,
187
+ cc_path=cc_path,
188
+ python_prefix=python_prefix,
189
+ assume_yes_for_downloads=assume_yes_for_downloads,
190
+ )
191
+
192
+ # If we failed to inject zig argument into ccache command line, we need to
193
+ # do it now.
194
+ if isZigName(env.the_cc_name) and inject_ccache is False:
195
+ env["CXX"] = env["CC"] = '"%s" "%s"' % (
196
+ cc_path,
197
+ "cc" if env.c11_mode else "c++",
198
+ )
181
199
 
182
200
 
183
201
  def enableClcache(env, source_dir):
@@ -34,6 +34,7 @@ from .SconsUtils import (
34
34
  getMsvcVersionString,
35
35
  isClangName,
36
36
  isGccName,
37
+ isZigName,
37
38
  raiseNoCompilerFoundErrorExit,
38
39
  setEnvironmentVariable,
39
40
  )
@@ -99,6 +100,10 @@ def _enableC11Settings(env):
99
100
  c11_mode = True
100
101
  elif env.clang_mode:
101
102
  c11_mode = True
103
+
104
+ # For now, zig doesn't support C11 mode in the form needed by Nuitka
105
+ if isZigName(env.the_cc_name):
106
+ c11_mode = False
102
107
  elif env.gcc_mode and env.gcc_version >= (5,):
103
108
  c11_mode = True
104
109
  else:
@@ -721,9 +726,13 @@ def setupCCompiler(env, lto_mode, pgo_mode, job_count, onefile_compile):
721
726
  # thing, and Nuitka-Python is not affected.
722
727
  env.Append(
723
728
  LINKFLAGS=[
724
- "-O3"
725
- if env.nuitka_python or os.name == "nt" or not env.static_libpython
726
- else "-O2"
729
+ (
730
+ "-O3"
731
+ if env.nuitka_python
732
+ or os.name == "nt"
733
+ or not env.static_libpython
734
+ else "-O2"
735
+ )
727
736
  ]
728
737
  )
729
738
 
@@ -740,9 +749,13 @@ def setupCCompiler(env, lto_mode, pgo_mode, job_count, onefile_compile):
740
749
  if env.gcc_mode:
741
750
  env.Append(
742
751
  CCFLAGS=[
743
- "-O3"
744
- if env.nuitka_python or os.name == "nt" or not env.static_libpython
745
- else "-O2"
752
+ (
753
+ "-O3"
754
+ if env.nuitka_python
755
+ or os.name == "nt"
756
+ or not env.static_libpython
757
+ else "-O2"
758
+ )
746
759
  ]
747
760
  )
748
761
  elif env.msvc_mode:
@@ -12,7 +12,6 @@ version.
12
12
 
13
13
  """
14
14
 
15
-
16
15
  import os
17
16
  import re
18
17
 
@@ -30,17 +30,22 @@ from nuitka.PythonVersions import (
30
30
  python_version,
31
31
  python_version_str,
32
32
  )
33
+ from nuitka.utils.AppDirs import getCacheDirEnvironmentVariableName
34
+ from nuitka.utils.Download import getDownloadCacheDir, getDownloadCacheName
33
35
  from nuitka.utils.Execution import (
34
36
  getExecutablePath,
35
37
  withEnvironmentVarsOverridden,
36
38
  )
37
39
  from nuitka.utils.FileOperations import (
40
+ changeFilenameExtension,
38
41
  deleteFile,
39
42
  getDirectoryRealPath,
40
43
  getExternalUsePath,
41
44
  getWindowsShortPathName,
42
45
  hasFilenameExtension,
43
46
  listDir,
47
+ makePath,
48
+ putTextFileContents,
44
49
  withDirectoryChange,
45
50
  )
46
51
  from nuitka.utils.InstalledPythons import findInstalledPython
@@ -105,7 +110,16 @@ def _getPythonForSconsExePath():
105
110
  if python_exe is not None:
106
111
  return python_exe
107
112
 
108
- scons_supported_pythons = ("3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11")
113
+ scons_supported_pythons = (
114
+ "3.5",
115
+ "3.6",
116
+ "3.7",
117
+ "3.8",
118
+ "3.9",
119
+ "3.10",
120
+ "3.11",
121
+ "3.12",
122
+ )
109
123
  if not isWin32Windows():
110
124
  scons_supported_pythons += ("2.7", "2.6")
111
125
 
@@ -159,6 +173,14 @@ def _setupSconsEnvironment2():
159
173
 
160
174
  os.environ["NUITKA_PACKAGE_DIR"] = os.path.abspath(nuitka.__path__[0])
161
175
 
176
+ # When downloading in Scons, use the external path.
177
+ if isWin32Windows():
178
+ download_cache_dir = getDownloadCacheDir()
179
+ makePath(download_cache_dir)
180
+ os.environ[getCacheDirEnvironmentVariableName(getDownloadCacheName())] = (
181
+ getExternalUsePath(download_cache_dir)
182
+ )
183
+
162
184
  yield
163
185
 
164
186
  if old_pythonpath is not None:
@@ -247,6 +269,61 @@ def _buildSconsCommand(options, scons_filename):
247
269
  return scons_command
248
270
 
249
271
 
272
+ def _createSconsDebugScript(source_dir, scons_command):
273
+ # we wrote debug shell script only if build process called, not "--version" call.
274
+ scons_debug_python_name = "scons-debug.py"
275
+
276
+ putTextFileContents(
277
+ filename=os.path.join(source_dir, scons_debug_python_name),
278
+ contents="""\
279
+ # -*- coding: utf-8 -*-
280
+
281
+ import sys
282
+ import os
283
+ import subprocess
284
+
285
+ exit_code = subprocess.call(
286
+ %(scons_command)r,
287
+ env=%(env)r,
288
+ shell=False
289
+ )"""
290
+ % {"scons_command": scons_command, "env": dict(os.environ)},
291
+ encoding="utf8",
292
+ )
293
+
294
+ if isWin32Windows():
295
+ script_extension = ".bat"
296
+
297
+ script_prelude = """\
298
+ cd "%~dp0"
299
+ """
300
+ else:
301
+ script_extension = ".sh"
302
+
303
+ script_prelude = """\
304
+ #!/bin/bash
305
+ cd "${0%/*}"
306
+ """
307
+
308
+ putTextFileContents(
309
+ filename=os.path.join(
310
+ source_dir,
311
+ changeFilenameExtension(scons_debug_python_name, script_extension),
312
+ ),
313
+ contents="""\
314
+ %(script_prelude)s
315
+
316
+ '%(scons_python)s' '%(scons_debug_script_name)s'
317
+ """
318
+ % {
319
+ "script_prelude": script_prelude,
320
+ "scons_python": scons_command[0],
321
+ "scons_debug_script_name": scons_debug_python_name,
322
+ },
323
+ encoding="utf8",
324
+ )
325
+
326
+
250
327
  def runScons(options, env_values, scons_filename):
251
328
  with _setupSconsEnvironment():
252
329
  env_values["_NUITKA_BUILD_DEFINITIONS_CATALOG"] = ",".join(env_values.keys())
@@ -287,6 +364,12 @@ def runScons(options, env_values, scons_filename):
287
364
  Tracing.flushStandardOutputs()
288
365
 
289
366
  with withEnvironmentVarsOverridden(env_values):
367
+ # Create debug script to quickly re-run this step only.
368
+ if source_dir is not None:
369
+ _createSconsDebugScript(
370
+ source_dir=source_dir, scons_command=scons_command
371
+ )
372
+
290
373
  try:
291
374
  result = subprocess.call(scons_command, shell=False, cwd=source_dir)
292
375
  except KeyboardInterrupt:
@@ -464,12 +547,8 @@ def setCommonSconsOptions(options):
464
547
 
465
548
  if product_version is None:
466
549
  product_version = file_version
467
- if product_version is not None:
468
- product_version = ".".join(str(d) for d in product_version)
469
550
  if file_version is None:
470
551
  file_version = product_version
471
- else:
472
- file_version = ".".join(str(d) for d in file_version)
473
552
 
474
553
  if product_version != file_version:
475
554
  effective_version = "%s-%s" % (
@@ -7,7 +7,6 @@ This does only the interfacing with tracing and collection of information.
7
7
 
8
8
  """
9
9
 
10
-
11
10
  from nuitka.Progress import (
12
11
  closeProgressBar,
13
12
  enableProgressBar,
@@ -205,9 +205,9 @@ def createEnvironment(
205
205
  import SCons.Tool.msvc # pylint: disable=I0021,import-error
206
206
 
207
207
  SCons.Tool.MSCommon.vc.msvc_setup_env = lambda *args: None
208
- SCons.Tool.msvc.msvc_exists = (
209
- SCons.Tool.MSCommon.vc.msvc_exists
210
- ) = lambda *args: False
208
+ SCons.Tool.msvc.msvc_exists = SCons.Tool.MSCommon.vc.msvc_exists = (
209
+ lambda *args: False
210
+ )
211
211
  else:
212
212
  # Everything else should use default, that is MSVC tools, but not MinGW64.
213
213
  tools = ["default"]
@@ -315,7 +315,7 @@ def getExecutablePath(filename, env):
315
315
 
316
316
  full = os.path.normpath(os.path.join(path_element, filename))
317
317
 
318
- if os.path.exists(full):
318
+ if os.path.isfile(full):
319
319
  return full
320
320
 
321
321
  return None
@@ -537,7 +537,11 @@ def isGccName(cc_name):
537
537
 
538
538
 
539
539
  def isClangName(cc_name):
540
- return "clang" in cc_name and "-cl" not in cc_name
540
+ return ("clang" in cc_name and "-cl" not in cc_name) or isZigName(cc_name)
541
+
542
+
543
+ def isZigName(cc_name):
544
+ return "zig" in cc_name
541
545
 
542
546
 
543
547
  def cheapCopyFile(src, dst):
@@ -13,7 +13,7 @@
13
13
  #define _PyObject_GC_IS_TRACKED(obj) (1)
14
14
  #endif
15
15
 
16
- #if PYTHON_VERSION >= 0x380
16
+ #if PYTHON_VERSION >= 0x380 && PYTHON_VERSION < 0x3c0
17
17
  // Need to make Py_DECREF a macro again that doesn't call an API
18
18
  static inline void _Nuitka_Py_DECREF(PyObject *ob) {
19
19
  assert(ob != NULL && ob->ob_refcnt >= 0);
@@ -80,11 +80,16 @@ static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type) { ob->ob_type
80
80
  // After Python 3.9 this was moved into the DLL potentially, making
81
81
  // it expensive to call.
82
82
  #if PYTHON_VERSION >= 0x390
83
- static void Nuitka_Py_NewReference(PyObject *op) {
83
+ static inline void Nuitka_Py_NewReferenceNoTotal(PyObject *op) { Py_SET_REFCNT(op, 1); }
84
+ static inline void Nuitka_Py_NewReference(PyObject *op) {
84
85
  #ifdef Py_REF_DEBUG
86
+ #if PYTHON_VERSION < 0x3c0
85
87
  _Py_RefTotal++;
88
+ #else
89
+ _PyInterpreterState_GET()->object_state.reftotal++;
90
+ #endif
86
91
  #endif
87
- Py_SET_REFCNT(op, 1);
92
+ op->ob_refcnt = 1;
88
93
  }
89
94
  #else
90
95
  #define Nuitka_Py_NewReference(op) _Py_NewReference(op)
@@ -38,6 +38,14 @@ extern int count_allocated_Nuitka_Cell_Type;
38
38
  extern int count_released_Nuitka_Cell_Type;
39
39
  #endif
40
40
 
41
+ NUITKA_MAY_BE_UNUSED static inline void Nuitka_Cell_SET(struct Nuitka_CellObject *cell_object, PyObject *value) {
42
+ CHECK_OBJECT_X(value);
43
+ CHECK_OBJECT(cell_object);
44
+
45
+ assert(Nuitka_Cell_Check((PyObject *)cell_object));
46
+ cell_object->ob_ref = value;
47
+ }
48
+
41
49
  #endif
42
50
 
43
51
  // Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -141,6 +141,8 @@ extern PyObject **global_constants;
141
141
  #define const_str_plain_abspath global_constants[42]
142
142
  // 'isabs'
143
143
  #define const_str_plain_isabs global_constants[42]
144
+ // 'normpath'
145
+ #define const_str_plain_normpath global_constants[42]
144
146
  // 'path'
145
147
  #define const_str_plain_path global_constants[42]
146
148
  // '__newobj__'