Nuitka-winsvc 1.6.6__cp310-cp310-win_amd64.whl → 1.7.5__cp310-cp310-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 (84) hide show
  1. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/RECORD +84 -81
  3. nuitka/Builtins.py +7 -1
  4. nuitka/MainControl.py +4 -0
  5. nuitka/OptionParsing.py +5 -3
  6. nuitka/Options.py +17 -2
  7. nuitka/Serialization.py +28 -5
  8. nuitka/Version.py +2 -2
  9. nuitka/build/Backend.scons +16 -3
  10. nuitka/build/CCompilerVersion.scons +1 -1
  11. nuitka/build/DataComposerInterface.py +15 -9
  12. nuitka/build/Onefile.scons +1 -1
  13. nuitka/build/SconsCompilerSettings.py +1 -0
  14. nuitka/build/SconsProgress.py +11 -2
  15. nuitka/build/SconsSpawn.py +15 -15
  16. nuitka/build/include/nuitka/builtins.h +2 -0
  17. nuitka/build/include/nuitka/filesystem_paths.h +4 -0
  18. nuitka/build/include/nuitka/helper/attributes.h +3 -0
  19. nuitka/build/include/nuitka/helper/import_hard.h +6 -0
  20. nuitka/build/include/nuitka/helpers.h +1 -1
  21. nuitka/build/include/nuitka/safe_string_ops.h +10 -3
  22. nuitka/build/static_src/CompiledCodeHelpers.c +0 -200
  23. nuitka/build/static_src/HelpersAttributes.c +185 -8
  24. nuitka/build/static_src/HelpersFilesystemPaths.c +528 -7
  25. nuitka/build/static_src/HelpersImportHard.c +38 -0
  26. nuitka/build/static_src/HelpersSafeStrings.c +6 -278
  27. nuitka/build/static_src/MainProgram.c +273 -73
  28. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +6 -0
  29. nuitka/build/static_src/OnefileBootstrap.c +19 -36
  30. nuitka/build/static_src/OnefileSplashScreen.cpp +1 -0
  31. nuitka/code_generation/AttributeCodes.py +42 -23
  32. nuitka/code_generation/CodeGeneration.py +4 -0
  33. nuitka/code_generation/FunctionCodes.py +18 -3
  34. nuitka/code_generation/GlobalConstants.py +8 -1
  35. nuitka/code_generation/PackageResourceCodes.py +40 -0
  36. nuitka/code_generation/templates/CodeTemplatesModules.py +1 -7
  37. nuitka/freezer/DllDependenciesMacOS.py +18 -1
  38. nuitka/freezer/IncludedDataFiles.py +6 -10
  39. nuitka/importing/ImportResolving.py +6 -0
  40. nuitka/importing/Recursion.py +24 -68
  41. nuitka/nodes/AttributeNodes.py +72 -19
  42. nuitka/nodes/ChildrenHavingMixins.py +203 -234
  43. nuitka/nodes/ExpressionBasesGenerated.py +136 -0
  44. nuitka/nodes/HardImportNodesGenerated.py +94 -0
  45. nuitka/nodes/ImportHardNodes.py +3 -3
  46. nuitka/nodes/ImportNodes.py +14 -4
  47. nuitka/nodes/ModuleNodes.py +4 -2
  48. nuitka/nodes/PackageMetadataNodes.py +12 -10
  49. nuitka/nodes/PackageResourceNodes.py +115 -0
  50. nuitka/nodes/TypeNodes.py +5 -1
  51. nuitka/plugins/PluginBase.py +32 -8
  52. nuitka/plugins/Plugins.py +44 -7
  53. nuitka/plugins/standard/AntiBloatPlugin.py +166 -72
  54. nuitka/plugins/standard/DataFilesPlugin.py +10 -0
  55. nuitka/plugins/standard/DllFilesPlugin.py +1 -2
  56. nuitka/plugins/standard/MatplotlibPlugin.py +24 -22
  57. nuitka/plugins/standard/MultiprocessingPlugin.py +5 -12
  58. nuitka/plugins/standard/OptionsNannyPlugin.py +2 -2
  59. nuitka/plugins/standard/PySidePyQtPlugin.py +18 -6
  60. nuitka/plugins/standard/PywebViewPlugin.py +4 -2
  61. nuitka/plugins/standard/TkinterPlugin.py +3 -0
  62. nuitka/plugins/standard/TransformersPlugin.py +11 -1
  63. nuitka/plugins/standard/TrioPlugin.py +6 -66
  64. nuitka/plugins/standard/standard.nuitka-package.config.yml +367 -21
  65. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +16 -4
  66. nuitka/specs/HardImportSpecs.py +6 -0
  67. nuitka/tools/data_composer/DataComposer.py +25 -27
  68. nuitka/tools/general/find_module/FindModuleCode.py +5 -2
  69. nuitka/tools/podman/Podman.py +53 -0
  70. nuitka/tools/podman/__init__.py +18 -0
  71. nuitka/tools/podman/__main__.py +255 -0
  72. nuitka/tools/specialize/SpecializePython.py +37 -3
  73. nuitka/tools/testing/RuntimeTracing.py +4 -0
  74. nuitka/tree/Building.py +1 -1
  75. nuitka/tree/ReformulationFunctionStatements.py +137 -10
  76. nuitka/utils/Execution.py +11 -1
  77. nuitka/utils/ModuleNames.py +1 -1
  78. nuitka/utils/SharedLibraries.py +7 -7
  79. {Nuitka_winsvc-1.6.6.data → Nuitka_winsvc-1.7.5.data}/scripts/nuitka-run.bat +0 -0
  80. {Nuitka_winsvc-1.6.6.data → Nuitka_winsvc-1.7.5.data}/scripts/nuitka.bat +0 -0
  81. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/LICENSE.txt +0 -0
  82. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/WHEEL +0 -0
  83. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/entry_points.txt +0 -0
  84. {Nuitka_winsvc-1.6.6.dist-info → Nuitka_winsvc-1.7.5.dist-info}/top_level.txt +0 -0
@@ -22,6 +22,8 @@ source code comments with Developer Manual sections.
22
22
 
23
23
  """
24
24
 
25
+ import ast
26
+
25
27
  from nuitka.nodes.AsyncgenNodes import (
26
28
  ExpressionAsyncgenObjectBody,
27
29
  ExpressionMakeAsyncgenObject,
@@ -33,10 +35,12 @@ from nuitka.nodes.BuiltinIteratorNodes import (
33
35
  from nuitka.nodes.BuiltinNextNodes import ExpressionSpecialUnpack
34
36
  from nuitka.nodes.BuiltinRefNodes import makeExpressionBuiltinTypeRef
35
37
  from nuitka.nodes.CodeObjectSpecs import CodeObjectSpec
38
+ from nuitka.nodes.ConstantRefNodes import makeConstantRefNode
36
39
  from nuitka.nodes.CoroutineNodes import (
37
40
  ExpressionCoroutineObjectBody,
38
41
  ExpressionMakeCoroutineObject,
39
42
  )
43
+ from nuitka.nodes.ExecEvalNodes import ExpressionBuiltinExec
40
44
  from nuitka.nodes.FunctionNodes import (
41
45
  ExpressionFunctionBody,
42
46
  ExpressionFunctionRef,
@@ -50,6 +54,7 @@ from nuitka.nodes.GeneratorNodes import (
50
54
  from nuitka.nodes.LocalsDictNodes import StatementSetLocalsDictionary
51
55
  from nuitka.nodes.OutlineNodes import ExpressionOutlineFunction
52
56
  from nuitka.nodes.ReturnNodes import StatementReturn, StatementReturnNone
57
+ from nuitka.nodes.StatementNodes import StatementExpressionOnly
53
58
  from nuitka.nodes.VariableAssignNodes import makeStatementAssignmentVariable
54
59
  from nuitka.nodes.VariableNameNodes import (
55
60
  ExpressionVariableNameRef,
@@ -61,10 +66,11 @@ from nuitka.nodes.VariableRefNodes import (
61
66
  )
62
67
  from nuitka.nodes.VariableReleaseNodes import makeStatementReleaseVariable
63
68
  from nuitka.Options import hasPythonFlagNoAnnotations
64
- from nuitka.plugins.Plugins import Plugins
69
+ from nuitka.plugins.Plugins import Plugins, hasActivePlugin
65
70
  from nuitka.PythonVersions import python_version
66
71
  from nuitka.specs.ParameterSpecs import ParameterSpec
67
72
 
73
+ from .ReformulationExecStatements import wrapEvalGlobalsAndLocals
68
74
  from .ReformulationTryFinallyStatements import makeTryFinallyStatement
69
75
  from .SyntaxErrors import raiseSyntaxError
70
76
  from .TreeHelpers import (
@@ -78,6 +84,7 @@ from .TreeHelpers import (
78
84
  getKind,
79
85
  makeCallNode,
80
86
  makeDictCreationOrConstant2,
87
+ makeStatementsSequence,
81
88
  makeStatementsSequenceFromStatement,
82
89
  mangleName,
83
90
  )
@@ -130,15 +137,125 @@ def _injectDecorator(decorators, inject, acceptable, source_ref):
130
137
  )
131
138
 
132
139
 
140
+ _has_pyqt_plugin = None
141
+
142
+
143
+ def decideFunctionCompilationMode(decorators):
144
+ """Decide how to compile a function based on decorator names."""
145
+
146
+ global _has_pyqt_plugin # singleton, pylint: disable=global-statement
147
+
148
+ if _has_pyqt_plugin is None:
149
+ _has_pyqt_plugin = hasActivePlugin("pyqt5") or hasActivePlugin("pyqt6")
150
+
151
+ # TODO: Expose the interface to plugins, so we don't hardcode stuff for
152
+ # specific plugins here, but for performance I guess, we would have to add a
153
+ # registry for the plugins to use, so not every decorator name is being
154
+ # called for every plugin.
155
+ if _has_pyqt_plugin:
156
+ for decorator in decorators:
157
+ if (
158
+ decorator.isExpressionCall()
159
+ and decorator.subnode_called.isExpressionVariableNameRef()
160
+ ):
161
+ if decorator.subnode_called.variable_name == "pyqtSlot":
162
+ return "bytecode"
163
+
164
+ return "compiled"
165
+
166
+
167
+ def _buildBytecodeOrSourceFunction(provider, node, compilation_mode, source_ref):
168
+ # TODO: We should have a compile() builtin usage here, lookup "co_code" and
169
+ # support that as a constant value. We then would have the "bytecode" only
170
+ # in the binary, right now "bytecode" and "source" make no difference. For
171
+ # commercial, we need to protect this constant just like all the others, and
172
+ # ideally maybe, we add (delayed creation) code objects from blobs for use
173
+ # by compiled code, while doing this. pylint: disable=unused-argument
174
+ source_code = ast.unparse(node)
175
+
176
+ source = makeConstantRefNode(
177
+ constant=source_code,
178
+ source_ref=source_ref,
179
+ user_provided=True,
180
+ )
181
+
182
+ # if compilation_mode == "bytecode":
183
+ # source = ExpressionBuiltinCompile(
184
+ # source_code=source,
185
+ # filename=makeConstantRefNode(constant="<exec>", source_ref=source_ref),
186
+ # mode=makeConstantRefNode(constant="exec", source_ref=source_ref),
187
+ # flags=None,
188
+ # dont_inherit=None,
189
+ # optimize=None,
190
+ # source_ref=source_ref
191
+ # )
192
+
193
+ # This is actually for the globals locals usage to be default values of the
194
+ # scope.
195
+
196
+ temp_scope = provider.allocateTempScope("function_exec")
197
+
198
+ globals_ref, locals_ref, tried, final = wrapEvalGlobalsAndLocals(
199
+ provider=provider,
200
+ globals_node=None,
201
+ locals_node=None,
202
+ temp_scope=temp_scope,
203
+ source_ref=source_ref,
204
+ )
205
+
206
+ tried = makeStatementsSequence(
207
+ statements=(
208
+ tried,
209
+ (
210
+ StatementExpressionOnly(
211
+ expression=ExpressionBuiltinExec(
212
+ source_code=source,
213
+ globals_arg=globals_ref,
214
+ locals_arg=locals_ref,
215
+ source_ref=source_ref,
216
+ ),
217
+ source_ref=source_ref,
218
+ )
219
+ ),
220
+ ),
221
+ allow_none=False,
222
+ source_ref=source_ref,
223
+ )
224
+
225
+ # Hack: Allow some APIs to work already
226
+ # tried.parent = provider
227
+
228
+ return makeTryFinallyStatement(
229
+ provider=provider,
230
+ tried=tried,
231
+ final=final,
232
+ source_ref=source_ref,
233
+ )
234
+
235
+
133
236
  def buildFunctionNode(provider, node, source_ref):
134
- # Functions have way too many details, pylint: disable=too-many-locals
237
+ # Functions have way too many details, pylint: disable=too-many-branches,too-many-locals
135
238
 
136
239
  assert getKind(node) == "FunctionDef"
137
240
 
241
+ decorators = buildNodeList(
242
+ provider=provider, nodes=reversed(node.decorator_list), source_ref=source_ref
243
+ )
244
+
245
+ compilation_mode = decideFunctionCompilationMode(decorators)
246
+
138
247
  Plugins.onFunctionBodyParsing(
139
248
  provider=provider, function_name=node.name, body=node.body
140
249
  )
141
250
 
251
+ if compilation_mode != "compiled":
252
+ return _buildBytecodeOrSourceFunction(
253
+ provider=provider,
254
+ node=node,
255
+ compilation_mode=compilation_mode,
256
+ source_ref=source_ref,
257
+ )
258
+
142
259
  function_statement_nodes, function_doc = extractDocFromBody(node)
143
260
 
144
261
  function_kind, flags = detectFunctionBodyKind(nodes=function_statement_nodes)
@@ -196,10 +313,6 @@ def buildFunctionNode(provider, node, source_ref):
196
313
  )
197
314
  )
198
315
 
199
- decorators = buildNodeList(
200
- provider=provider, nodes=reversed(node.decorator_list), source_ref=source_ref
201
- )
202
-
203
316
  defaults = buildNodeTuple(
204
317
  provider=provider, nodes=node.args.defaults, source_ref=source_ref
205
318
  )
@@ -298,10 +411,24 @@ def buildAsyncFunctionNode(provider, node, source_ref):
298
411
  # many details each, pylint: disable=too-many-locals
299
412
  assert getKind(node) == "AsyncFunctionDef"
300
413
 
414
+ decorators = buildNodeList(
415
+ provider=provider, nodes=reversed(node.decorator_list), source_ref=source_ref
416
+ )
417
+
418
+ compilation_mode = decideFunctionCompilationMode(decorators)
419
+
301
420
  Plugins.onFunctionBodyParsing(
302
421
  provider=provider, function_name=node.name, body=node.body
303
422
  )
304
423
 
424
+ if compilation_mode != "compiled":
425
+ return _buildBytecodeOrSourceFunction(
426
+ provider=provider,
427
+ node=node,
428
+ compilation_mode=compilation_mode,
429
+ source_ref=source_ref,
430
+ )
431
+
305
432
  function_statement_nodes, function_doc = extractDocFromBody(node)
306
433
 
307
434
  function_kind, flags = detectFunctionBodyKind(
@@ -342,10 +469,6 @@ def buildAsyncFunctionNode(provider, node, source_ref):
342
469
  for variable in creator_function_body.getProvidedVariables():
343
470
  function_body.getVariableForReference(variable.getName())
344
471
 
345
- decorators = buildNodeList(
346
- provider=provider, nodes=reversed(node.decorator_list), source_ref=source_ref
347
- )
348
-
349
472
  defaults = buildNodeTuple(
350
473
  provider=provider, nodes=node.args.defaults, source_ref=source_ref
351
474
  )
@@ -461,6 +584,10 @@ def buildParameterKwDefaults(provider, node, function_body, source_ref):
461
584
  def buildParameterAnnotations(provider, node, source_ref):
462
585
  # Too many branches, because there is too many cases, pylint: disable=too-many-branches
463
586
 
587
+ # The ast uses funny names a bunch.
588
+ # spellchecker: ignore varnames,elts,posonlyargs,kwonlyargs,varargannotation,vararg
589
+ # spellchecker: ignore kwargannotation
590
+
464
591
  # Build annotations. We are hiding here, that it is a Python3 only feature.
465
592
  if python_version < 0x300 or hasPythonFlagNoAnnotations():
466
593
  return None
nuitka/utils/Execution.py CHANGED
@@ -152,6 +152,11 @@ def check_call(*popenargs, **kwargs):
152
152
  Note: We use same name as in Python stdlib, violating our rules to
153
153
  make it more recognizable what this does.
154
154
  """
155
+ logger = kwargs.pop("logger", None)
156
+
157
+ if logger is not None:
158
+ logger.info("Executing command '%s'." % popenargs[0])
159
+
155
160
  try:
156
161
  subprocess.check_call(*popenargs, **kwargs)
157
162
  except OSError:
@@ -162,7 +167,12 @@ def check_call(*popenargs, **kwargs):
162
167
 
163
168
  def callProcess(*popenargs, **kwargs):
164
169
  """Call a process and return result code."""
165
- subprocess.call(*popenargs, **kwargs)
170
+ logger = kwargs.pop("logger", None)
171
+
172
+ if logger is not None:
173
+ logger.info("Executing command '%s'." % popenargs[0])
174
+
175
+ return subprocess.call(*popenargs, **kwargs)
166
176
 
167
177
 
168
178
  @contextmanager
@@ -192,7 +192,7 @@ class ModuleName(str):
192
192
  """
193
193
 
194
194
  for package_name in package_names:
195
- if type(package_name) in (tuple, list):
195
+ if type(package_name) in (tuple, list, set):
196
196
  if self.hasOneOfNamespaces(*package_name):
197
197
  return True
198
198
  elif self.hasNamespace(package_name):
@@ -23,11 +23,11 @@ import os
23
23
  import re
24
24
  import sys
25
25
 
26
- from nuitka import Options
27
26
  from nuitka.__past__ import WindowsError # pylint: disable=I0021,redefined-builtin
28
27
  from nuitka.__past__ import unicode
29
28
  from nuitka.containers.OrderedDicts import OrderedDict
30
29
  from nuitka.containers.OrderedSets import OrderedSet
30
+ from nuitka.Options import getMacOSTargetArch, isShowInclusion, isUnstripped
31
31
  from nuitka.PythonVersions import python_version
32
32
  from nuitka.Tracing import inclusion_logger, postprocessing_logger
33
33
 
@@ -410,7 +410,7 @@ def _setSharedLibraryRPATHDarwin(filename, rpath):
410
410
 
411
411
 
412
412
  def setSharedLibraryRPATH(filename, rpath):
413
- if Options.isShowInclusion():
413
+ if isShowInclusion():
414
414
  inclusion_logger.info(
415
415
  "Setting 'RPATH' value '%s' for '%s'." % (rpath, filename)
416
416
  )
@@ -581,7 +581,7 @@ def hasUniversalOrMatchingMacOSArchitecture(filename):
581
581
 
582
582
  file_output = _getFileCommandOutput(filename)
583
583
 
584
- return "universal" in file_output or Options.getMacOSTargetArch() in file_output
584
+ return "universal" in file_output or getMacOSTargetArch() in file_output
585
585
 
586
586
 
587
587
  # spell-checker: ignore lipo
@@ -594,7 +594,7 @@ _lipo_usage = (
594
594
  def makeMacOSThinBinary(dest_path, original_path):
595
595
  file_output = _getFileCommandOutput(dest_path)
596
596
 
597
- macos_target_arch = Options.getMacOSTargetArch()
597
+ macos_target_arch = getMacOSTargetArch()
598
598
 
599
599
  if "universal" in file_output:
600
600
  executeToolChecked(
@@ -631,7 +631,7 @@ def copyDllFile(source_path, dist_dir, dest_path, executable):
631
631
  if isWin32Windows() and python_version < 0x300:
632
632
  _removeSxsFromDLL(target_filename)
633
633
 
634
- if isMacOS() and Options.getMacOSTargetArch() != "universal":
634
+ if isMacOS() and getMacOSTargetArch() != "universal":
635
635
  makeMacOSThinBinary(dest_path=target_filename, original_path=source_path)
636
636
 
637
637
  if isLinux():
@@ -641,7 +641,7 @@ def copyDllFile(source_path, dist_dir, dest_path, executable):
641
641
  rpath = os.path.join("$ORIGIN", *([".."] * count))
642
642
  setSharedLibraryRPATH(target_filename, rpath)
643
643
 
644
- if isWin32Windows() and Options.is_debug:
644
+ if isWin32Windows() and isUnstripped():
645
645
  pdb_filename = changeFilenameExtension(path=source_path, extension=".pdb")
646
646
 
647
647
  if os.path.exists(pdb_filename):
@@ -765,7 +765,7 @@ def getDllExportedSymbols(logger, filename):
765
765
  if isLinux():
766
766
  output = executeToolChecked(
767
767
  logger=logger,
768
- command=("nm", "-D", "--without-symbol-versions", filename),
768
+ command=("nm", "-D", filename),
769
769
  absence_message=_nm_usage,
770
770
  )
771
771