Nuitka-winsvc 2.1.6__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.
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +232 -223
- nuitka/Errors.py +4 -0
- nuitka/HardImportRegistry.py +18 -1
- nuitka/MainControl.py +27 -30
- nuitka/OptionParsing.py +32 -30
- nuitka/Options.py +26 -13
- nuitka/OutputDirectories.py +7 -4
- nuitka/PostProcessing.py +9 -7
- nuitka/Progress.py +3 -3
- nuitka/PythonVersions.py +2 -2
- nuitka/TreeXML.py +1 -1
- nuitka/Version.py +1 -1
- nuitka/build/Backend.scons +2 -1
- nuitka/build/DataComposerInterface.py +1 -0
- nuitka/build/Onefile.scons +2 -1
- nuitka/build/SconsCaching.py +64 -46
- nuitka/build/SconsCompilerSettings.py +19 -6
- nuitka/build/SconsHacks.py +0 -1
- nuitka/build/SconsInterface.py +84 -5
- nuitka/build/SconsProgress.py +0 -1
- nuitka/build/SconsUtils.py +8 -4
- nuitka/build/include/nuitka/allocator.h +8 -3
- nuitka/build/include/nuitka/compiled_cell.h +8 -0
- nuitka/build/include/nuitka/exceptions.h +554 -179
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helper/ints.h +15 -2
- nuitka/build/include/nuitka/helper/lists.h +4 -1
- nuitka/build/include/nuitka/helper/raising.h +12 -0
- nuitka/build/include/nuitka/helper/tuples.h +5 -1
- nuitka/build/include/nuitka/helpers.h +4 -0
- nuitka/build/include/nuitka/importing.h +3 -4
- nuitka/build/include/nuitka/jit_sources.h +25 -0
- nuitka/build/include/nuitka/prelude.h +38 -11
- nuitka/build/include/nuitka/printing.h +3 -0
- nuitka/build/include/nuitka/threading.h +2 -6
- nuitka/build/include/nuitka/type_aliases.h +27 -0
- nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
- nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
- nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
- nuitka/build/static_src/CompiledCodeHelpers.c +24 -14
- nuitka/build/static_src/CompiledCoroutineType.c +96 -114
- nuitka/build/static_src/CompiledFrameType.c +14 -11
- nuitka/build/static_src/CompiledFunctionType.c +34 -7
- nuitka/build/static_src/CompiledGeneratorType.c +248 -142
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
- nuitka/build/static_src/CompiledMethodType.c +8 -7
- nuitka/build/static_src/HelpersAttributes.c +2 -19
- nuitka/build/static_src/HelpersBuiltin.c +2 -1
- nuitka/build/static_src/HelpersComparisonEq.c +32 -18
- nuitka/build/static_src/HelpersComparisonGe.c +50 -36
- nuitka/build/static_src/HelpersComparisonGt.c +50 -36
- nuitka/build/static_src/HelpersComparisonLe.c +50 -36
- nuitka/build/static_src/HelpersComparisonLt.c +50 -36
- nuitka/build/static_src/HelpersComparisonNe.c +32 -18
- nuitka/build/static_src/HelpersDeepcopy.c +6 -8
- nuitka/build/static_src/HelpersDictionaries.c +8 -3
- nuitka/build/static_src/HelpersExceptions.c +36 -22
- nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
- nuitka/build/static_src/HelpersImportHard.c +15 -0
- nuitka/build/static_src/HelpersJitSources.c +46 -0
- nuitka/build/static_src/HelpersLists.c +40 -0
- nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
- nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
- nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
- nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
- nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
- nuitka/build/static_src/HelpersProfiling.c +3 -4
- nuitka/build/static_src/HelpersRaising.c +62 -1
- nuitka/build/static_src/HelpersStrings.c +203 -8
- nuitka/build/static_src/HelpersTypes.c +42 -0
- nuitka/build/static_src/MainProgram.c +1 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
- nuitka/build/static_src/OnefileBootstrap.c +3 -3
- nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
- nuitka/code_generation/BuiltinCodes.py +1 -0
- nuitka/code_generation/CodeGeneration.py +11 -0
- nuitka/code_generation/CodeHelpers.py +5 -3
- nuitka/code_generation/CodeObjectCodes.py +10 -6
- nuitka/code_generation/ComparisonCodes.py +19 -3
- nuitka/code_generation/ConstantCodes.py +5 -0
- nuitka/code_generation/Contexts.py +22 -6
- nuitka/code_generation/Emission.py +1 -0
- nuitka/code_generation/ErrorCodes.py +8 -16
- nuitka/code_generation/EvalCodes.py +5 -3
- nuitka/code_generation/ExceptionCodes.py +8 -1
- nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
- nuitka/code_generation/FrameCodes.py +5 -3
- nuitka/code_generation/FunctionCodes.py +0 -1
- nuitka/code_generation/GeneratorCodes.py +3 -3
- nuitka/code_generation/GlobalConstants.py +0 -2
- nuitka/code_generation/ImportCodes.py +2 -0
- nuitka/code_generation/JitCodes.py +44 -0
- nuitka/code_generation/ListCodes.py +11 -17
- nuitka/code_generation/MatchCodes.py +0 -1
- nuitka/code_generation/ModuleCodes.py +2 -1
- nuitka/code_generation/Namify.py +0 -1
- nuitka/code_generation/NetworkxCodes.py +51 -0
- nuitka/code_generation/OperationCodes.py +8 -6
- nuitka/code_generation/PackageResourceCodes.py +7 -5
- nuitka/code_generation/TensorflowCodes.py +54 -0
- nuitka/code_generation/TypeAliasCodes.py +71 -0
- nuitka/code_generation/VariableCodes.py +7 -5
- nuitka/code_generation/VariableDeclarations.py +1 -0
- nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
- nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
- nuitka/code_generation/c_types/CTypeVoids.py +1 -0
- nuitka/code_generation/templates/CodeTemplatesConstants.py +14 -0
- nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +4 -1
- nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
- nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
- nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
- nuitka/containers/Namedtuples.py +0 -1
- nuitka/finalizations/Finalization.py +1 -0
- nuitka/finalizations/FinalizeMarkups.py +0 -1
- nuitka/freezer/DllDependenciesMacOS.py +60 -13
- nuitka/freezer/DllDependenciesPosix.py +0 -1
- nuitka/freezer/IncludedDataFiles.py +46 -15
- nuitka/freezer/IncludedEntryPoints.py +5 -3
- nuitka/freezer/Standalone.py +6 -1
- nuitka/importing/ImportCache.py +2 -2
- nuitka/importing/ImportResolving.py +80 -78
- nuitka/importing/Importing.py +34 -1
- nuitka/nodes/AttributeNodesGenerated.py +21 -6
- nuitka/nodes/BuiltinComplexNodes.py +1 -0
- nuitka/nodes/BuiltinFormatNodes.py +1 -0
- nuitka/nodes/BuiltinIteratorNodes.py +5 -3
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
- nuitka/nodes/BuiltinRefNodes.py +8 -1
- nuitka/nodes/BuiltinVarsNodes.py +0 -1
- nuitka/nodes/ChildrenHavingMixins.py +906 -186
- nuitka/nodes/CodeObjectSpecs.py +1 -1
- nuitka/nodes/ConstantRefNodes.py +38 -0
- nuitka/nodes/CtypesNodes.py +0 -1
- nuitka/nodes/DictionaryNodes.py +0 -1
- nuitka/nodes/ExceptionNodes.py +10 -0
- nuitka/nodes/ExpressionBases.py +15 -9
- nuitka/nodes/ExpressionBasesGenerated.py +32 -15
- nuitka/nodes/FunctionNodes.py +50 -5
- nuitka/nodes/HardImportNodesGenerated.py +245 -60
- nuitka/nodes/ImportHardNodes.py +27 -13
- nuitka/nodes/ImportNodes.py +90 -70
- nuitka/nodes/InjectCNodes.py +0 -1
- nuitka/nodes/ModuleNodes.py +10 -5
- nuitka/nodes/NetworkxNodes.py +45 -0
- nuitka/nodes/OperatorNodesUnary.py +1 -0
- nuitka/nodes/OsSysNodes.py +0 -1
- nuitka/nodes/PackageMetadataNodes.py +0 -1
- nuitka/nodes/PackageResourceNodes.py +10 -6
- nuitka/nodes/StatementBasesGenerated.py +107 -60
- nuitka/nodes/StringConcatenationNodes.py +1 -0
- nuitka/nodes/TensorflowNodes.py +38 -0
- nuitka/nodes/TypeNodes.py +21 -0
- nuitka/nodes/VariableRefNodes.py +1 -0
- nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
- nuitka/optimizations/Optimization.py +7 -6
- nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
- nuitka/optimizations/Tags.py +0 -1
- nuitka/optimizations/TraceCollections.py +6 -55
- nuitka/optimizations/ValueTraces.py +49 -1
- nuitka/plugins/PluginBase.py +26 -4
- nuitka/plugins/Plugins.py +49 -12
- nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
- nuitka/plugins/standard/DataFilesPlugin.py +2 -6
- nuitka/plugins/standard/DillPlugin.py +3 -3
- nuitka/plugins/standard/DllFilesPlugin.py +29 -23
- nuitka/plugins/standard/GiPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +8 -7
- nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
- nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
- nuitka/plugins/standard/PmwPlugin.py +10 -9
- nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
- nuitka/plugins/standard/TensorflowPlugin.py +1 -0
- nuitka/plugins/standard/TorchPlugin.py +1 -0
- nuitka/plugins/standard/TrioPlugin.py +1 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +242 -34
- nuitka/reports/CompilationReportReader.py +0 -1
- nuitka/reports/Reports.py +49 -5
- nuitka/specs/BuiltinParameterSpecs.py +10 -2
- nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
- nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
- nuitka/specs/HardImportSpecs.py +34 -1
- nuitka/specs/ParameterSpecs.py +11 -9
- nuitka/tools/environments/Virtualenv.py +0 -1
- nuitka/tools/specialize/CTypeDescriptions.py +15 -11
- nuitka/tools/specialize/SpecializeC.py +11 -9
- nuitka/tools/specialize/SpecializePython.py +57 -30
- nuitka/tools/testing/Common.py +24 -7
- nuitka/tools/testing/OutputComparison.py +4 -0
- nuitka/tools/testing/Pythons.py +0 -1
- nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
- nuitka/tools/watch/GitHub.py +4 -1
- nuitka/tools/watch/__main__.py +22 -1
- nuitka/tree/Building.py +3 -0
- nuitka/tree/InternalModule.py +0 -1
- nuitka/tree/ReformulationAssertStatements.py +1 -0
- nuitka/tree/ReformulationAssignmentStatements.py +26 -3
- nuitka/tree/ReformulationClasses3.py +23 -26
- nuitka/tree/ReformulationContractionExpressions.py +5 -3
- nuitka/tree/ReformulationDictionaryCreation.py +6 -5
- nuitka/tree/ReformulationExecStatements.py +8 -6
- nuitka/tree/ReformulationFunctionStatements.py +10 -6
- nuitka/tree/SourceHandling.py +8 -0
- nuitka/tree/TreeHelpers.py +6 -3
- nuitka/utils/AppDirs.py +6 -2
- nuitka/utils/CStrings.py +1 -1
- nuitka/utils/CommandLineOptions.py +0 -1
- nuitka/utils/Distributions.py +3 -3
- nuitka/utils/Download.py +5 -1
- nuitka/utils/Execution.py +6 -3
- nuitka/utils/FileOperations.py +61 -34
- nuitka/utils/Importing.py +4 -4
- nuitka/utils/InstanceCounters.py +1 -0
- nuitka/utils/MacOSApp.py +1 -0
- nuitka/utils/Shebang.py +1 -0
- nuitka/utils/Utils.py +39 -1
- nuitka/utils/WindowsFileUsage.py +4 -3
- {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
|
@@ -38,7 +38,6 @@ from nuitka.nodes.DictionaryNodes import (
|
|
|
38
38
|
ExpressionDictOperationGet2,
|
|
39
39
|
ExpressionDictOperationIn,
|
|
40
40
|
StatementDictOperationRemove,
|
|
41
|
-
StatementDictOperationUpdate,
|
|
42
41
|
)
|
|
43
42
|
from nuitka.nodes.ExceptionNodes import (
|
|
44
43
|
ExpressionBuiltinMakeException,
|
|
@@ -88,12 +87,12 @@ from .InternalModule import (
|
|
|
88
87
|
makeInternalHelperFunctionBody,
|
|
89
88
|
once_decorator,
|
|
90
89
|
)
|
|
90
|
+
from .ReformulationDictionaryCreation import buildDictionaryUnpacking
|
|
91
91
|
from .ReformulationSequenceCreation import buildTupleUnpacking
|
|
92
92
|
from .ReformulationTryExceptStatements import makeTryExceptSingleHandlerNode
|
|
93
93
|
from .ReformulationTryFinallyStatements import makeTryFinallyStatement
|
|
94
94
|
from .TreeHelpers import (
|
|
95
95
|
buildFrameNode,
|
|
96
|
-
buildNode,
|
|
97
96
|
buildNodeTuple,
|
|
98
97
|
extractDocFromBody,
|
|
99
98
|
getKind,
|
|
@@ -373,11 +372,6 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
373
372
|
source_ref=decorator.getSourceReference(),
|
|
374
373
|
)
|
|
375
374
|
|
|
376
|
-
if node.keywords and node.keywords[-1].arg is None:
|
|
377
|
-
keywords = node.keywords[:-1]
|
|
378
|
-
else:
|
|
379
|
-
keywords = node.keywords
|
|
380
|
-
|
|
381
375
|
statements = []
|
|
382
376
|
|
|
383
377
|
if node.bases:
|
|
@@ -417,32 +411,35 @@ def buildClassNode3(provider, node, source_ref):
|
|
|
417
411
|
)
|
|
418
412
|
)
|
|
419
413
|
|
|
414
|
+
# TODO: It's not really clear, since when those in the middle keywords are accepted
|
|
415
|
+
# and not a SyntaxError, and if then we might have to raise it.
|
|
416
|
+
keyword_keys = tuple(keyword.arg for keyword in node.keywords)
|
|
417
|
+
keyword_values = tuple(keyword.value for keyword in node.keywords)
|
|
418
|
+
|
|
419
|
+
if None in keyword_keys:
|
|
420
|
+
assert python_version >= 0x350
|
|
421
|
+
|
|
422
|
+
make_keywords_dict = buildDictionaryUnpacking(
|
|
423
|
+
provider,
|
|
424
|
+
keys=keyword_keys,
|
|
425
|
+
values=keyword_values,
|
|
426
|
+
source_ref=source_ref,
|
|
427
|
+
)
|
|
428
|
+
else:
|
|
429
|
+
make_keywords_dict = makeDictCreationOrConstant2(
|
|
430
|
+
keys=keyword_keys,
|
|
431
|
+
values=buildNodeTuple(provider, keyword_values, source_ref),
|
|
432
|
+
source_ref=source_ref,
|
|
433
|
+
)
|
|
434
|
+
|
|
420
435
|
statements.append(
|
|
421
436
|
makeStatementAssignmentVariable(
|
|
422
437
|
variable=tmp_class_decl_dict,
|
|
423
|
-
source=
|
|
424
|
-
keys=[keyword.arg for keyword in keywords],
|
|
425
|
-
values=[
|
|
426
|
-
buildNode(provider, keyword.value, source_ref)
|
|
427
|
-
for keyword in keywords
|
|
428
|
-
],
|
|
429
|
-
source_ref=source_ref,
|
|
430
|
-
),
|
|
438
|
+
source=make_keywords_dict,
|
|
431
439
|
source_ref=source_ref,
|
|
432
440
|
)
|
|
433
441
|
)
|
|
434
442
|
|
|
435
|
-
if node.keywords and node.keywords[-1].arg is None:
|
|
436
|
-
statements.append(
|
|
437
|
-
StatementDictOperationUpdate(
|
|
438
|
-
dict_arg=ExpressionVariableRef(
|
|
439
|
-
variable=tmp_class_decl_dict, source_ref=source_ref
|
|
440
|
-
),
|
|
441
|
-
value=buildNode(provider, node.keywords[-1].value, source_ref),
|
|
442
|
-
source_ref=source_ref,
|
|
443
|
-
)
|
|
444
|
-
)
|
|
445
|
-
|
|
446
443
|
# Check if there are bases, and if there are, go with the type of the
|
|
447
444
|
# first base class as a metaclass unless it was specified in the class
|
|
448
445
|
# decl dict of course.
|
|
@@ -204,9 +204,11 @@ def buildDictContractionNode(provider, node, source_ref):
|
|
|
204
204
|
provider=provider,
|
|
205
205
|
node=node,
|
|
206
206
|
name="<dictcontraction>",
|
|
207
|
-
emit_class=
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
emit_class=(
|
|
208
|
+
StatementDictOperationSet
|
|
209
|
+
if python_version < 0x380
|
|
210
|
+
else StatementDictOperationSetKeyValue
|
|
211
|
+
),
|
|
210
212
|
start_value={},
|
|
211
213
|
source_ref=source_ref,
|
|
212
214
|
)
|
|
@@ -71,7 +71,10 @@ def buildDictionaryNode(provider, node, source_ref):
|
|
|
71
71
|
for key in node.keys:
|
|
72
72
|
if key is None:
|
|
73
73
|
return buildDictionaryUnpacking(
|
|
74
|
-
provider=provider,
|
|
74
|
+
provider=provider,
|
|
75
|
+
keys=node.keys,
|
|
76
|
+
values=node.values,
|
|
77
|
+
source_ref=source_ref,
|
|
75
78
|
)
|
|
76
79
|
|
|
77
80
|
return makeExpressionMakeDictOrConstant(
|
|
@@ -266,10 +269,8 @@ def buildDictionaryUnpackingArgs(provider, keys, values, source_ref):
|
|
|
266
269
|
return tuple(result)
|
|
267
270
|
|
|
268
271
|
|
|
269
|
-
def buildDictionaryUnpacking(provider,
|
|
270
|
-
helper_args = buildDictionaryUnpackingArgs(
|
|
271
|
-
provider, node.keys, node.values, source_ref
|
|
272
|
-
)
|
|
272
|
+
def buildDictionaryUnpacking(provider, keys, values, source_ref):
|
|
273
|
+
helper_args = buildDictionaryUnpackingArgs(provider, keys, values, source_ref)
|
|
273
274
|
|
|
274
275
|
result = makeExpressionFunctionCall(
|
|
275
276
|
function=makeExpressionFunctionCreation(
|
|
@@ -142,15 +142,17 @@ def wrapEvalGlobalsAndLocals(
|
|
|
142
142
|
return (
|
|
143
143
|
ExpressionTempVariableRef(
|
|
144
144
|
variable=globals_keeper_variable,
|
|
145
|
-
source_ref=
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
source_ref=(
|
|
146
|
+
source_ref
|
|
147
|
+
if globals_node is None
|
|
148
|
+
else globals_node.getSourceReference()
|
|
149
|
+
),
|
|
148
150
|
),
|
|
149
151
|
ExpressionTempVariableRef(
|
|
150
152
|
variable=locals_keeper_variable,
|
|
151
|
-
source_ref=
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
source_ref=(
|
|
154
|
+
source_ref if locals_node is None else locals_node.getSourceReference()
|
|
155
|
+
),
|
|
154
156
|
),
|
|
155
157
|
makeStatementsSequence(pre_statements, False, source_ref),
|
|
156
158
|
makeStatementsSequence(post_statements, False, source_ref),
|
|
@@ -826,12 +826,16 @@ def buildFunctionWithParsing(
|
|
|
826
826
|
parameters = ParameterSpec(
|
|
827
827
|
ps_name=name,
|
|
828
828
|
ps_normal_args=extractNormalArgs(node.args.args),
|
|
829
|
-
ps_pos_only_args=
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
829
|
+
ps_pos_only_args=(
|
|
830
|
+
[extractArg(arg) for arg in node.args.posonlyargs]
|
|
831
|
+
if python_version >= 0x380
|
|
832
|
+
else ()
|
|
833
|
+
),
|
|
834
|
+
ps_kw_only_args=(
|
|
835
|
+
[extractArg(arg) for arg in node.args.kwonlyargs]
|
|
836
|
+
if python_version >= 0x300
|
|
837
|
+
else ()
|
|
838
|
+
),
|
|
835
839
|
ps_list_star_arg=extractArg(node.args.vararg),
|
|
836
840
|
ps_dict_star_arg=extractArg(node.args.kwarg),
|
|
837
841
|
ps_default_count=len(node.args.defaults),
|
nuitka/tree/SourceHandling.py
CHANGED
|
@@ -285,6 +285,7 @@ That will make use the correct Python version for Nuitka.
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
def readSourceLine(source_ref):
|
|
288
|
+
"""Read a single source line, mainly for use in error reporting only."""
|
|
288
289
|
import linecache
|
|
289
290
|
|
|
290
291
|
return linecache.getline(
|
|
@@ -292,6 +293,13 @@ def readSourceLine(source_ref):
|
|
|
292
293
|
)
|
|
293
294
|
|
|
294
295
|
|
|
296
|
+
def readSourceLines(source_ref):
|
|
297
|
+
"""Read a source lines with linecache, for use with cached function source finding."""
|
|
298
|
+
import linecache
|
|
299
|
+
|
|
300
|
+
return linecache.getlines(source_ref.filename)
|
|
301
|
+
|
|
302
|
+
|
|
295
303
|
def writeSourceCode(filename, source_code):
|
|
296
304
|
# Prevent accidental overwriting. When this happens the collision detection
|
|
297
305
|
# or something else has failed.
|
nuitka/tree/TreeHelpers.py
CHANGED
|
@@ -128,7 +128,7 @@ def detectFunctionBodyKind(nodes, start_value=None):
|
|
|
128
128
|
for name, field in ast.iter_fields(node):
|
|
129
129
|
if name in ("name", "body"):
|
|
130
130
|
pass
|
|
131
|
-
elif name in ("bases", "decorator_list", "keywords"):
|
|
131
|
+
elif name in ("bases", "decorator_list", "keywords", "type_params"):
|
|
132
132
|
for child in field:
|
|
133
133
|
_check(child)
|
|
134
134
|
elif name == "starargs":
|
|
@@ -145,7 +145,7 @@ def detectFunctionBodyKind(nodes, start_value=None):
|
|
|
145
145
|
for name, field in ast.iter_fields(node):
|
|
146
146
|
if name in ("name", "body"):
|
|
147
147
|
pass
|
|
148
|
-
elif name in ("bases", "decorator_list"):
|
|
148
|
+
elif name in ("bases", "decorator_list", "type_params"):
|
|
149
149
|
for child in field:
|
|
150
150
|
_check(child)
|
|
151
151
|
elif name == "args":
|
|
@@ -197,7 +197,10 @@ def detectFunctionBodyKind(nodes, start_value=None):
|
|
|
197
197
|
if name in ("name", "body", "comparators"):
|
|
198
198
|
pass
|
|
199
199
|
elif name == "generators":
|
|
200
|
-
|
|
200
|
+
if python_version < 0x3B0:
|
|
201
|
+
_check(field[0].iter)
|
|
202
|
+
else:
|
|
203
|
+
_check(field[0])
|
|
201
204
|
elif name in ("body", "elt"):
|
|
202
205
|
_check(field)
|
|
203
206
|
else:
|
nuitka/utils/AppDirs.py
CHANGED
|
@@ -71,10 +71,14 @@ please consider making a PR for a general solution that adds support for it, or
|
|
|
71
71
|
return _cache_dir
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def
|
|
74
|
+
def getCacheDirEnvironmentVariableName(cache_basename):
|
|
75
75
|
env_name = cache_basename.replace("-", "_").upper()
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
return "NUITKA_CACHE_DIR_" + env_name
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def getCacheDir(cache_basename):
|
|
81
|
+
cache_dir = os.getenv(getCacheDirEnvironmentVariableName(cache_basename))
|
|
78
82
|
if cache_dir is None:
|
|
79
83
|
cache_dir = os.path.join(_getCacheDir(), cache_basename)
|
|
80
84
|
|
nuitka/utils/CStrings.py
CHANGED
|
@@ -142,7 +142,7 @@ def encodePythonIdentifierToC(value):
|
|
|
142
142
|
else:
|
|
143
143
|
return "$$%d$" % ord(c)
|
|
144
144
|
|
|
145
|
-
return
|
|
145
|
+
return re.sub("[^a-zA-Z0-9_]", r, value)
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
nuitka/utils/Distributions.py
CHANGED
|
@@ -358,9 +358,9 @@ def getDistributionInstallerName(distribution_name):
|
|
|
358
358
|
)
|
|
359
359
|
|
|
360
360
|
if installer_name:
|
|
361
|
-
_distribution_to_installer[
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
_distribution_to_installer[distribution_name] = (
|
|
362
|
+
installer_name.strip().lower()
|
|
363
|
+
)
|
|
364
364
|
elif isAnacondaPython():
|
|
365
365
|
_distribution_to_installer[distribution_name] = "conda"
|
|
366
366
|
elif isPdmPackageInstallation(distribution):
|
nuitka/utils/Download.py
CHANGED
|
@@ -40,8 +40,12 @@ def getDownload(name, url, download_path):
|
|
|
40
40
|
raise
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
def getDownloadCacheName():
|
|
44
|
+
return "downloads"
|
|
45
|
+
|
|
46
|
+
|
|
43
47
|
def getDownloadCacheDir():
|
|
44
|
-
return getCacheDir(
|
|
48
|
+
return getCacheDir(getDownloadCacheName())
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
def getCachedDownload(
|
nuitka/utils/Execution.py
CHANGED
|
@@ -7,7 +7,6 @@ Basically a layer for os, subprocess, shutil to come together. It can find
|
|
|
7
7
|
binaries (needed for exec) and run them capturing outputs.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
import os
|
|
12
11
|
from contextlib import contextmanager
|
|
13
12
|
|
|
@@ -107,6 +106,10 @@ def check_output(*popenargs, **kwargs):
|
|
|
107
106
|
Note: We use same name as in Python stdlib, violating our rules to
|
|
108
107
|
make it more recognizable what this does.
|
|
109
108
|
"""
|
|
109
|
+
logger = kwargs.pop("logger", None)
|
|
110
|
+
|
|
111
|
+
if logger is not None:
|
|
112
|
+
logger.info("Executing command '%s'." % popenargs[0], keep_format=True)
|
|
110
113
|
|
|
111
114
|
if "stdout" in kwargs:
|
|
112
115
|
raise ValueError("stdout argument not allowed, it will be overridden.")
|
|
@@ -141,7 +144,7 @@ def check_call(*popenargs, **kwargs):
|
|
|
141
144
|
logger = kwargs.pop("logger", None)
|
|
142
145
|
|
|
143
146
|
if logger is not None:
|
|
144
|
-
logger.info("Executing command '%s'." % popenargs[0])
|
|
147
|
+
logger.info("Executing command '%s'." % popenargs[0], keep_format=True)
|
|
145
148
|
|
|
146
149
|
try:
|
|
147
150
|
subprocess.check_call(*popenargs, **kwargs)
|
|
@@ -156,7 +159,7 @@ def callProcess(*popenargs, **kwargs):
|
|
|
156
159
|
logger = kwargs.pop("logger", None)
|
|
157
160
|
|
|
158
161
|
if logger is not None:
|
|
159
|
-
logger.info("Executing command '%s'." % popenargs[0])
|
|
162
|
+
logger.info("Executing command '%s'." % popenargs[0], keep_format=True)
|
|
160
163
|
|
|
161
164
|
return subprocess.call(*popenargs, **kwargs)
|
|
162
165
|
|
nuitka/utils/FileOperations.py
CHANGED
|
@@ -97,6 +97,9 @@ def areSamePaths(path1, path2):
|
|
|
97
97
|
even short paths, it then becomes a mere string compare after that.
|
|
98
98
|
"""
|
|
99
99
|
|
|
100
|
+
if path1 == path2:
|
|
101
|
+
return True
|
|
102
|
+
|
|
100
103
|
path1 = os.path.abspath(os.path.normpath(path1))
|
|
101
104
|
path2 = os.path.abspath(os.path.normpath(path2))
|
|
102
105
|
|
|
@@ -186,7 +189,11 @@ def makePath(path):
|
|
|
186
189
|
|
|
187
190
|
with withFileLock("creating directory %s" % path):
|
|
188
191
|
if not os.path.isdir(path):
|
|
189
|
-
|
|
192
|
+
try:
|
|
193
|
+
os.makedirs(path)
|
|
194
|
+
except OSError:
|
|
195
|
+
if not os.path.exists(path):
|
|
196
|
+
raise
|
|
190
197
|
|
|
191
198
|
|
|
192
199
|
def makeContainingPath(filename):
|
|
@@ -236,9 +243,14 @@ def _getRealPathWindows(path):
|
|
|
236
243
|
if str is not bytes:
|
|
237
244
|
result = result.decode("utf8")
|
|
238
245
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
if result.startswith("UNC\\"):
|
|
247
|
+
# Avoid network mounts being converted to UNC shared paths by newer
|
|
248
|
+
# Python versions, many tools won't work with those.
|
|
249
|
+
_real_path_windows_cache[path] = path
|
|
250
|
+
else:
|
|
251
|
+
_real_path_windows_cache[path] = os.path.join(
|
|
252
|
+
os.path.dirname(path), result.rstrip("\r\n")
|
|
253
|
+
)
|
|
242
254
|
else:
|
|
243
255
|
_real_path_windows_cache[path] = path
|
|
244
256
|
|
|
@@ -270,37 +282,16 @@ def getDirectoryRealPath(path):
|
|
|
270
282
|
return path
|
|
271
283
|
|
|
272
284
|
|
|
273
|
-
def
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
Args:
|
|
277
|
-
path: path to get realpath of
|
|
278
|
-
|
|
279
|
-
Returns:
|
|
280
|
-
path with symlinks resolved
|
|
281
|
-
|
|
282
|
-
Notes:
|
|
283
|
-
Workaround for Windows symlinks are applied, this works recursive and
|
|
284
|
-
assumes that the path given itself is a file and not a directory, and
|
|
285
|
-
doesn't handle file symlinks at the end on older Python currently, but
|
|
286
|
-
we shouldn't deal with those.
|
|
287
|
-
"""
|
|
288
|
-
orig_path = path
|
|
289
|
-
path = os.path.realpath(path)
|
|
290
|
-
|
|
291
|
-
# Avoid network mounts being converted to UNC shared paths ny newer
|
|
292
|
-
# Python versions, many tools won't work with those.
|
|
293
|
-
if os.name == "nt" and path.startswith("\\\\"):
|
|
285
|
+
def _restoreWindowsPath(orig_path, path):
|
|
286
|
+
if path.startswith("\\\\"):
|
|
294
287
|
drive, _remaining_path = os.path.splitdrive(orig_path)
|
|
295
288
|
|
|
296
|
-
if drive:
|
|
289
|
+
if drive and not drive.startswith("\\\\"):
|
|
297
290
|
drive_real_path = os.path.realpath(drive + "\\")
|
|
298
291
|
assert path.startswith(drive_real_path)
|
|
299
292
|
|
|
300
293
|
path = drive + path[len(drive_real_path) :]
|
|
301
|
-
|
|
302
|
-
# Attempt to resolve Windows symlinks older Python
|
|
303
|
-
if os.name == "nt":
|
|
294
|
+
else:
|
|
304
295
|
path = path.strip(os.path.sep)
|
|
305
296
|
|
|
306
297
|
if os.path.sep in path:
|
|
@@ -321,6 +312,32 @@ def getFilenameRealPath(path):
|
|
|
321
312
|
return path
|
|
322
313
|
|
|
323
314
|
|
|
315
|
+
def getFilenameRealPath(path):
|
|
316
|
+
"""Get os.path.realpath with Python2 and Windows symlink workaround applied.
|
|
317
|
+
|
|
318
|
+
Args:
|
|
319
|
+
path: path to get realpath of
|
|
320
|
+
|
|
321
|
+
Returns:
|
|
322
|
+
path with symlinks resolved
|
|
323
|
+
|
|
324
|
+
Notes:
|
|
325
|
+
Workaround for Windows symlinks are applied, this works recursive and
|
|
326
|
+
assumes that the path given itself is a file and not a directory, and
|
|
327
|
+
doesn't handle file symlinks at the end on older Python currently, but
|
|
328
|
+
we shouldn't deal with those.
|
|
329
|
+
"""
|
|
330
|
+
orig_path = path
|
|
331
|
+
path = os.path.realpath(path)
|
|
332
|
+
|
|
333
|
+
# Avoid network mounts being converted to UNC shared paths by newer
|
|
334
|
+
# Python versions, many tools won't work with those.
|
|
335
|
+
if os.name == "nt":
|
|
336
|
+
path = _restoreWindowsPath(orig_path=orig_path, path=path)
|
|
337
|
+
|
|
338
|
+
return path
|
|
339
|
+
|
|
340
|
+
|
|
324
341
|
def listDir(path):
|
|
325
342
|
"""Give a sorted listing of a path.
|
|
326
343
|
|
|
@@ -478,9 +495,9 @@ def getDllBasename(path):
|
|
|
478
495
|
if compare_path.endswith(suffix):
|
|
479
496
|
return path[: -len(suffix)]
|
|
480
497
|
|
|
481
|
-
# Linux
|
|
482
|
-
#
|
|
483
|
-
#
|
|
498
|
+
# Linux is not case sensitive, but lets still do it properly, sometimes, it
|
|
499
|
+
# is done macOS too. So we split on the normcase, but only to find out what
|
|
500
|
+
# is going on there.
|
|
484
501
|
if ".so." in compare_path:
|
|
485
502
|
return path[: len(compare_path.split(".so.")[0])]
|
|
486
503
|
|
|
@@ -694,6 +711,13 @@ def hasFilenameExtension(path, extensions):
|
|
|
694
711
|
return extension in extensions
|
|
695
712
|
|
|
696
713
|
|
|
714
|
+
def addFilenameExtension(path, extension):
|
|
715
|
+
if not hasFilenameExtension(path, extension):
|
|
716
|
+
path += extension
|
|
717
|
+
|
|
718
|
+
return path
|
|
719
|
+
|
|
720
|
+
|
|
697
721
|
def removeDirectory(path, ignore_errors):
|
|
698
722
|
"""Remove a directory recursively.
|
|
699
723
|
|
|
@@ -933,10 +957,13 @@ def copyTree(source_path, dest_path):
|
|
|
933
957
|
if python_version >= 0x380:
|
|
934
958
|
# Python 3.8+ has dirs_exist_ok
|
|
935
959
|
return shutil.copytree(source_path, dest_path, dirs_exist_ok=True)
|
|
960
|
+
else:
|
|
936
961
|
|
|
937
|
-
|
|
962
|
+
from distutils.dir_util import ( # Older Python only, pylint: disable=I0021,import-error
|
|
963
|
+
copy_tree,
|
|
964
|
+
)
|
|
938
965
|
|
|
939
|
-
|
|
966
|
+
return copy_tree(source_path, dest_path)
|
|
940
967
|
|
|
941
968
|
|
|
942
969
|
def copyFileWithPermissions(source_path, dest_path, dist_dir):
|
nuitka/utils/Importing.py
CHANGED
|
@@ -40,7 +40,7 @@ def _importFilePy3OldWay(filename):
|
|
|
40
40
|
|
|
41
41
|
def importFilePy2(filename):
|
|
42
42
|
"""Import a file for Python version 2."""
|
|
43
|
-
import imp
|
|
43
|
+
import imp # Python2 only, pylint: disable=I0021,import-error
|
|
44
44
|
|
|
45
45
|
basename = os.path.splitext(os.path.basename(filename))[0]
|
|
46
46
|
return imp.load_source(basename, filename)
|
|
@@ -76,7 +76,7 @@ def getSharedLibrarySuffixes():
|
|
|
76
76
|
|
|
77
77
|
if _shared_library_suffixes is None:
|
|
78
78
|
if python_version < 0x300:
|
|
79
|
-
import imp
|
|
79
|
+
import imp # Python2 only, pylint: disable=I0021,import-error
|
|
80
80
|
|
|
81
81
|
_shared_library_suffixes = []
|
|
82
82
|
|
|
@@ -223,7 +223,7 @@ def importFromCompileTime(module_name, must_exist):
|
|
|
223
223
|
|
|
224
224
|
def isBuiltinModuleName(module_name):
|
|
225
225
|
if python_version < 0x300:
|
|
226
|
-
import imp as _imp
|
|
226
|
+
import imp as _imp # Python2 only, pylint: disable=I0021,import-error
|
|
227
227
|
else:
|
|
228
228
|
import _imp
|
|
229
229
|
|
|
@@ -255,7 +255,7 @@ builtin_module_names = set(
|
|
|
255
255
|
|
|
256
256
|
def getModuleFilenameSuffixes():
|
|
257
257
|
if python_version < 0x3C0:
|
|
258
|
-
import imp
|
|
258
|
+
import imp # Older Python only, pylint: disable=I0021,import-error
|
|
259
259
|
|
|
260
260
|
for suffix, _mode, module_type in imp.get_suffixes():
|
|
261
261
|
if module_type == imp.C_EXTENSION:
|
nuitka/utils/InstanceCounters.py
CHANGED
nuitka/utils/MacOSApp.py
CHANGED
nuitka/utils/Shebang.py
CHANGED
nuitka/utils/Utils.py
CHANGED
|
@@ -128,9 +128,47 @@ def getWindowsRelease():
|
|
|
128
128
|
if not isWin32OrPosixWindows():
|
|
129
129
|
return None
|
|
130
130
|
|
|
131
|
+
class OsVersionInfoEx(ctypes.Structure):
|
|
132
|
+
_fields_ = [
|
|
133
|
+
("dwOSVersionInfoSize", ctypes.c_ulong),
|
|
134
|
+
("dwMajorVersion", ctypes.c_ulong),
|
|
135
|
+
("dwMinorVersion", ctypes.c_ulong),
|
|
136
|
+
("dwBuildNumber", ctypes.c_ulong),
|
|
137
|
+
("dwPlatformId", ctypes.c_ulong),
|
|
138
|
+
("szCSDVersion", ctypes.c_wchar * 128),
|
|
139
|
+
("wServicePackMajor", ctypes.c_ushort),
|
|
140
|
+
("wServicePackMinor", ctypes.c_ushort),
|
|
141
|
+
("wSuiteMask", ctypes.c_ushort),
|
|
142
|
+
("wProductType", ctypes.c_byte),
|
|
143
|
+
("wReserved", ctypes.c_byte),
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
def __init__(self):
|
|
147
|
+
self.dwOSVersionInfoSize = ctypes.sizeof( # pylint: disable=invalid-name
|
|
148
|
+
self
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
os_version_value = OsVersionInfoEx()
|
|
152
|
+
|
|
153
|
+
result = ctypes.windll.ntdll.RtlGetVersion(ctypes.byref(os_version_value))
|
|
154
|
+
if result != 0:
|
|
155
|
+
raiseWindowsError("Failed to get OS version")
|
|
156
|
+
|
|
157
|
+
version = os_version_value.dwMajorVersion
|
|
158
|
+
|
|
159
|
+
if os_version_value.dwBuildNumber >= 21996 and version == 10:
|
|
160
|
+
version = 11
|
|
161
|
+
|
|
162
|
+
return version
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def getMacOSRelease():
|
|
166
|
+
if not isMacOS():
|
|
167
|
+
return None
|
|
168
|
+
|
|
131
169
|
import platform
|
|
132
170
|
|
|
133
|
-
return platform.
|
|
171
|
+
return platform.mac_ver()[0]
|
|
134
172
|
|
|
135
173
|
|
|
136
174
|
def isDebianBasedLinux():
|
nuitka/utils/WindowsFileUsage.py
CHANGED
|
@@ -16,7 +16,7 @@ STATUS_INVALID_HANDLE = 0xC0000008
|
|
|
16
16
|
STATUS_BUFFER_TOO_SMALL = 0xC0000023
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def getWindowsAllProcessHandles():
|
|
20
20
|
"""Return all process system handles."""
|
|
21
21
|
|
|
22
22
|
i = 2048
|
|
@@ -184,13 +184,14 @@ def getWindowsAllProcessFileHandles():
|
|
|
184
184
|
|
|
185
185
|
ObjectTypeInformation = 2
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
# spell-checker: ignore psapi
|
|
188
|
+
psapi = ctypes.WinDLL("psapi.dll")
|
|
188
189
|
psapi.GetProcessImageFileNameW.restype = ctypes.wintypes.DWORD
|
|
189
190
|
|
|
190
191
|
this_process = ctypes.windll.kernel32.GetCurrentProcess()
|
|
191
192
|
this_process_id = ctypes.windll.kernel32.GetCurrentProcessId()
|
|
192
193
|
|
|
193
|
-
for process, handles in
|
|
194
|
+
for process, handles in getWindowsAllProcessHandles().items():
|
|
194
195
|
# Ignore ourselves, we do not matter normally.
|
|
195
196
|
|
|
196
197
|
if this_process_id == process:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|