Nuitka-winsvc 2.3.9__cp311-cp311-win_amd64.whl → 2.4.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.3.9.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.1.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +29 -2
- nuitka/MainControl.py +62 -35
- nuitka/ModuleRegistry.py +11 -3
- nuitka/OptionParsing.py +78 -39
- nuitka/Options.py +142 -35
- nuitka/OutputDirectories.py +5 -0
- nuitka/PostProcessing.py +23 -14
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +26 -23
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +1 -0
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +5 -2
- nuitka/build/include/nuitka/allocator.h +27 -5
- nuitka/build/include/nuitka/calling.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +23 -23
- nuitka/build/include/nuitka/compiled_method.h +1 -1
- nuitka/build/include/nuitka/exception_groups.h +0 -2
- nuitka/build/include/nuitka/helper/attributes.h +7 -1
- nuitka/build/include/nuitka/helper/subscripts.h +1 -1
- nuitka/build/include/nuitka/helpers.h +7 -4
- nuitka/build/include/nuitka/prelude.h +6 -10
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +5 -5
- nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +4 -1
- nuitka/build/static_src/CompiledAsyncgenType.c +2 -4
- nuitka/build/static_src/CompiledCellType.c +7 -7
- nuitka/build/static_src/CompiledCodeHelpers.c +51 -36
- nuitka/build/static_src/CompiledCoroutineType.c +2 -4
- nuitka/build/static_src/CompiledFrameType.c +109 -82
- nuitka/build/static_src/CompiledFunctionType.c +36 -9
- nuitka/build/static_src/CompiledGeneratorType.c +12 -10
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2 -2
- nuitka/build/static_src/CompiledMethodType.c +14 -13
- nuitka/build/static_src/HelpersAttributes.c +13 -15
- nuitka/build/static_src/HelpersBuiltin.c +18 -9
- nuitka/build/static_src/HelpersCalling.c +13 -13
- nuitka/build/static_src/HelpersCallingGenerated.c +22 -22
- nuitka/build/static_src/HelpersComparisonEq.c +110 -110
- nuitka/build/static_src/HelpersComparisonEqUtils.c +1 -1
- nuitka/build/static_src/HelpersComparisonGe.c +110 -110
- nuitka/build/static_src/HelpersComparisonGt.c +110 -110
- nuitka/build/static_src/HelpersComparisonLe.c +110 -110
- nuitka/build/static_src/HelpersComparisonLt.c +110 -110
- nuitka/build/static_src/HelpersComparisonNe.c +110 -110
- nuitka/build/static_src/HelpersConstantsBlob.c +480 -481
- nuitka/build/static_src/HelpersDictionaries.c +9 -0
- nuitka/build/static_src/HelpersFiles.c +2 -2
- nuitka/build/static_src/HelpersFilesystemPaths.c +28 -13
- nuitka/build/static_src/HelpersHeapStorage.c +4 -0
- nuitka/build/static_src/HelpersImport.c +1 -1
- nuitka/build/static_src/HelpersLists.c +5 -1
- nuitka/build/static_src/HelpersMatching.c +95 -35
- nuitka/build/static_src/HelpersOperationInplaceAdd.c +23 -23
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -0
- nuitka/build/static_src/HelpersOperationInplaceBitand.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceBitxor.c +11 -11
- nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceLshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceMatmult.c +10 -10
- nuitka/build/static_src/HelpersOperationInplaceMod.c +47 -47
- nuitka/build/static_src/HelpersOperationInplaceMult.c +28 -28
- nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +17 -17
- nuitka/build/static_src/HelpersOperationInplacePow.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceRshift.c +9 -9
- nuitka/build/static_src/HelpersOperationInplaceSub.c +17 -17
- nuitka/build/static_src/HelpersOperationInplaceTruediv.c +17 -17
- nuitka/build/static_src/HelpersSequences.c +1 -1
- nuitka/build/static_src/HelpersTypes.c +8 -4
- nuitka/build/static_src/MainProgram.c +28 -9
- nuitka/build/static_src/MetaPathBasedLoader.c +126 -110
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +30 -1
- nuitka/build/static_src/OnefileBootstrap.c +34 -6
- nuitka/code_generation/AttributeCodes.py +12 -10
- nuitka/code_generation/CodeGeneration.py +6 -7
- nuitka/code_generation/ConstantCodes.py +53 -10
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +3 -4
- nuitka/code_generation/LoaderCodes.py +3 -0
- nuitka/code_generation/LocalsDictCodes.py +36 -14
- nuitka/code_generation/MatchCodes.py +23 -4
- nuitka/code_generation/ModuleCodes.py +0 -7
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +6 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesVariables.py +16 -2
- nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +2 -2
- nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +7 -7
- nuitka/freezer/DependsExe.py +3 -1
- nuitka/freezer/DllDependenciesMacOS.py +28 -14
- nuitka/freezer/IncludedDataFiles.py +12 -3
- nuitka/freezer/IncludedEntryPoints.py +8 -2
- nuitka/freezer/Onefile.py +6 -1
- nuitka/freezer/Standalone.py +9 -2
- nuitka/importing/Importing.py +14 -5
- nuitka/importing/Recursion.py +3 -0
- nuitka/nodes/AttributeNodesGenerated.py +21 -12
- nuitka/nodes/BuiltinOpenNodes.py +5 -0
- nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +11 -11
- nuitka/nodes/BuiltinRefNodes.py +41 -1
- nuitka/nodes/ChildrenHavingMixins.py +143 -355
- nuitka/nodes/ClassNodes.py +30 -12
- nuitka/nodes/CodeObjectSpecs.py +9 -0
- nuitka/nodes/ExpressionBasesGenerated.py +11 -11
- nuitka/nodes/FunctionNodes.py +11 -12
- nuitka/nodes/FutureSpecs.py +16 -3
- nuitka/nodes/GeneratorNodes.py +2 -2
- nuitka/nodes/HardImportNodesGenerated.py +11 -134
- nuitka/nodes/LocalsScopes.py +19 -23
- nuitka/nodes/MatchNodes.py +18 -7
- nuitka/nodes/ModuleAttributeNodes.py +1 -20
- nuitka/nodes/ModuleNodes.py +23 -6
- nuitka/nodes/NodeBases.py +13 -11
- nuitka/nodes/NodeMetaClasses.py +26 -10
- nuitka/nodes/ReturnNodes.py +1 -1
- nuitka/nodes/StatementBasesGenerated.py +11 -11
- nuitka/nodes/SubscriptNodes.py +4 -4
- nuitka/nodes/VariableAssignNodes.py +1 -1
- nuitka/nodes/VariableRefNodes.py +28 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +21 -1
- nuitka/optimizations/FunctionInlining.py +3 -6
- nuitka/optimizations/Optimization.py +13 -12
- nuitka/optimizations/TraceCollections.py +19 -4
- nuitka/plugins/PluginBase.py +121 -133
- nuitka/plugins/Plugins.py +91 -3
- nuitka/plugins/YamlPluginBase.py +121 -0
- nuitka/plugins/standard/AntiBloatPlugin.py +87 -28
- nuitka/plugins/standard/DataFilesPlugin.py +15 -6
- nuitka/plugins/standard/DelvewheelPlugin.py +7 -3
- nuitka/plugins/standard/DllFilesPlugin.py +5 -3
- nuitka/plugins/standard/ImplicitImports.py +34 -20
- nuitka/plugins/standard/MatplotlibPlugin.py +3 -1
- nuitka/plugins/standard/MultiprocessingPlugin.py +2 -2
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +11 -12
- nuitka/plugins/standard/SpacyPlugin.py +136 -0
- nuitka/plugins/standard/standard.nuitka-package.config.yml +491 -186
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +17 -0
- nuitka/reports/Reports.py +53 -5
- nuitka/specs/BuiltinParameterSpecs.py +1 -1
- nuitka/specs/HardImportSpecs.py +0 -6
- nuitka/tools/data_composer/DataComposer.py +29 -27
- nuitka/tools/environments/CreateEnvironment.py +1 -0
- nuitka/tools/environments/Virtualenv.py +25 -11
- nuitka/tools/general/find_module/FindModuleCode.py +13 -3
- nuitka/tools/onefile_compressor/OnefileCompressor.py +21 -4
- nuitka/tools/scanning/DisplayPackageDLLs.py +17 -3
- nuitka/tools/specialize/CTypeDescriptions.py +13 -7
- nuitka/tools/specialize/SpecializePython.py +18 -1
- nuitka/tools/testing/Common.py +19 -6
- nuitka/tools/testing/check_reference_counts/__main__.py +1 -1
- nuitka/tools/testing/run_nuitka_tests/__main__.py +0 -20
- nuitka/tools/watch/AutoStage.py +144 -0
- nuitka/tools/watch/__main__.py +79 -32
- nuitka/tree/Building.py +105 -104
- nuitka/tree/ComplexCallHelperFunctions.py +16 -26
- nuitka/tree/InternalModule.py +9 -1
- nuitka/tree/ReformulationAssignmentStatements.py +29 -59
- nuitka/tree/ReformulationClasses.py +10 -17
- nuitka/tree/ReformulationClasses3.py +69 -43
- nuitka/tree/ReformulationComparisonExpressions.py +6 -16
- nuitka/tree/ReformulationContractionExpressions.py +14 -23
- nuitka/tree/ReformulationDictionaryCreation.py +6 -10
- nuitka/tree/ReformulationExecStatements.py +10 -10
- nuitka/tree/ReformulationForLoopStatements.py +6 -12
- nuitka/tree/ReformulationFunctionStatements.py +22 -28
- nuitka/tree/ReformulationImportStatements.py +8 -10
- nuitka/tree/ReformulationLambdaExpressions.py +3 -6
- nuitka/tree/ReformulationMatchStatements.py +166 -60
- nuitka/tree/ReformulationMultidist.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +1 -1
- nuitka/tree/ReformulationPrintStatements.py +3 -6
- nuitka/tree/ReformulationSequenceCreation.py +13 -26
- nuitka/tree/ReformulationTryFinallyStatements.py +15 -0
- nuitka/tree/ReformulationWithStatements.py +12 -16
- nuitka/tree/SourceHandling.py +13 -8
- nuitka/tree/VariableClosure.py +5 -21
- nuitka/utils/Distributions.py +80 -11
- nuitka/utils/Download.py +38 -31
- nuitka/utils/Execution.py +21 -9
- nuitka/utils/FileOperations.py +55 -28
- nuitka/utils/Images.py +6 -1
- nuitka/utils/Importing.py +1 -1
- nuitka/utils/ModuleNames.py +11 -5
- nuitka/utils/ReExecute.py +17 -13
- nuitka/utils/SharedLibraries.py +69 -41
- nuitka/utils/Signing.py +3 -1
- nuitka/utils/StaticLibraries.py +51 -41
- nuitka/utils/Timing.py +1 -1
- nuitka/utils/Utils.py +29 -7
- /Nuitka_winsvc-2.3.9.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.1.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.9.dist-info → Nuitka_winsvc-2.4.1.dist-info}/top_level.txt +0 -0
nuitka/plugins/PluginBase.py
CHANGED
|
@@ -43,10 +43,14 @@ from nuitka.ModuleRegistry import (
|
|
|
43
43
|
getModuleInclusionInfoByName,
|
|
44
44
|
)
|
|
45
45
|
from nuitka.Options import (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
getCompanyName,
|
|
47
|
+
getFileVersion,
|
|
48
|
+
getProductFileVersion,
|
|
49
|
+
getProductName,
|
|
50
|
+
getProductVersion,
|
|
49
51
|
isDeploymentMode,
|
|
52
|
+
isOnefileMode,
|
|
53
|
+
isOnefileTempDirMode,
|
|
50
54
|
isStandaloneMode,
|
|
51
55
|
shallCreateAppBundle,
|
|
52
56
|
shallMakeModule,
|
|
@@ -70,7 +74,11 @@ from nuitka.utils.Distributions import (
|
|
|
70
74
|
getDistributionName,
|
|
71
75
|
isDistributionCondaPackage,
|
|
72
76
|
)
|
|
73
|
-
from nuitka.utils.Execution import
|
|
77
|
+
from nuitka.utils.Execution import (
|
|
78
|
+
NuitkaCalledProcessError,
|
|
79
|
+
check_output,
|
|
80
|
+
withEnvironmentVarsOverridden,
|
|
81
|
+
)
|
|
74
82
|
from nuitka.utils.FileOperations import (
|
|
75
83
|
changeFilenameExtension,
|
|
76
84
|
getFileContents,
|
|
@@ -84,6 +92,7 @@ from nuitka.utils.ModuleNames import (
|
|
|
84
92
|
)
|
|
85
93
|
from nuitka.utils.SharedLibraries import locateDLL, locateDLLsInDirectory
|
|
86
94
|
from nuitka.utils.SlotMetaClasses import getMetaClassBase
|
|
95
|
+
from nuitka.utils.StaticLibraries import getSystemStaticLibPythonPath
|
|
87
96
|
from nuitka.utils.Utils import (
|
|
88
97
|
getArchitecture,
|
|
89
98
|
isAndroidBasedLinux,
|
|
@@ -92,7 +101,6 @@ from nuitka.utils.Utils import (
|
|
|
92
101
|
isWin32Windows,
|
|
93
102
|
withNoWarning,
|
|
94
103
|
)
|
|
95
|
-
from nuitka.utils.Yaml import getYamlPackageConfiguration
|
|
96
104
|
|
|
97
105
|
_warned_unused_plugins = set()
|
|
98
106
|
|
|
@@ -119,6 +127,15 @@ def _getImportLibModule():
|
|
|
119
127
|
return importlib
|
|
120
128
|
|
|
121
129
|
|
|
130
|
+
def _makeEvaluationContext(logger, full_name, config_name):
|
|
131
|
+
context = TagContext(logger=logger, full_name=full_name, config_name=config_name)
|
|
132
|
+
context.update(control_tags)
|
|
133
|
+
|
|
134
|
+
context.update(_getEvaluationContext())
|
|
135
|
+
|
|
136
|
+
return context
|
|
137
|
+
|
|
138
|
+
|
|
122
139
|
def _getEvaluationContext():
|
|
123
140
|
# Using global here, as this is really a singleton, in the form of a module,
|
|
124
141
|
# pylint: disable=global-statement
|
|
@@ -137,16 +154,21 @@ def _getEvaluationContext():
|
|
|
137
154
|
"debian_python": isDebianPackagePython(),
|
|
138
155
|
"nuitka_python": isNuitkaPython(),
|
|
139
156
|
"standalone": isStandaloneMode(),
|
|
157
|
+
"onefile": isOnefileMode(),
|
|
158
|
+
"onefile_cached": not isOnefileTempDirMode(),
|
|
140
159
|
"module_mode": shallMakeModule(),
|
|
141
160
|
"deployment": isDeploymentMode(),
|
|
161
|
+
# Version information
|
|
162
|
+
"company": getCompanyName(),
|
|
163
|
+
"product": getProductName(),
|
|
164
|
+
"file_version": getFileVersion(),
|
|
165
|
+
"product_version": getProductVersion(),
|
|
166
|
+
"combined_version": getProductFileVersion(),
|
|
142
167
|
# Querying package versions.
|
|
143
168
|
"version": _getPackageVersion,
|
|
144
169
|
"version_str": _getPackageVersionStr,
|
|
145
170
|
"get_dist_name": _getDistributionNameFromPackageName,
|
|
146
171
|
"plugin": _isPluginActive,
|
|
147
|
-
"no_asserts": hasPythonFlagNoAsserts(),
|
|
148
|
-
"no_docstrings": hasPythonFlagNoDocStrings(),
|
|
149
|
-
"no_annotations": hasPythonFlagNoAnnotations(),
|
|
150
172
|
# Iterating packages
|
|
151
173
|
"iterate_modules": _iterate_module_names,
|
|
152
174
|
# Locating package directories
|
|
@@ -166,6 +188,8 @@ def _getEvaluationContext():
|
|
|
166
188
|
# Python version string
|
|
167
189
|
"python_version_str": python_version_str,
|
|
168
190
|
"python_version_full_str": python_version_full_str,
|
|
191
|
+
# Technical requirements
|
|
192
|
+
"static_libpython": getSystemStaticLibPythonPath() is not None,
|
|
169
193
|
# Builtins
|
|
170
194
|
"True": True,
|
|
171
195
|
"False": False,
|
|
@@ -1055,6 +1079,18 @@ Unwanted import of '%(unwanted)s' that %(problem)s '%(binding_name)s' encountere
|
|
|
1055
1079
|
# Virtual method, pylint: disable=no-self-use,unused-argument
|
|
1056
1080
|
return None
|
|
1057
1081
|
|
|
1082
|
+
def decideAnnotations(self, module_name):
|
|
1083
|
+
# Virtual method, pylint: disable=no-self-use,unused-argument
|
|
1084
|
+
return None
|
|
1085
|
+
|
|
1086
|
+
def decideDocStrings(self, module_name):
|
|
1087
|
+
# Virtual method, pylint: disable=no-self-use,unused-argument
|
|
1088
|
+
return None
|
|
1089
|
+
|
|
1090
|
+
def decideAsserts(self, module_name):
|
|
1091
|
+
# Virtual method, pylint: disable=no-self-use,unused-argument
|
|
1092
|
+
return None
|
|
1093
|
+
|
|
1058
1094
|
def getPreprocessorSymbols(self):
|
|
1059
1095
|
"""Decide which C defines to be used in compilation.
|
|
1060
1096
|
|
|
@@ -1245,7 +1281,7 @@ except ImportError:
|
|
|
1245
1281
|
return None
|
|
1246
1282
|
|
|
1247
1283
|
if Options.is_debug:
|
|
1248
|
-
self.info(cmd)
|
|
1284
|
+
self.info(cmd, keep_format=True)
|
|
1249
1285
|
|
|
1250
1286
|
raise
|
|
1251
1287
|
|
|
@@ -1386,16 +1422,22 @@ except ImportError:
|
|
|
1386
1422
|
for count, variable_config in enumerate(
|
|
1387
1423
|
self.config.get(full_name, section="variables")
|
|
1388
1424
|
):
|
|
1389
|
-
|
|
1390
|
-
|
|
1425
|
+
environment = variable_config.get("environment", {})
|
|
1426
|
+
setup_codes = variable_config.get("setup_code", [])
|
|
1427
|
+
if type(setup_codes) is str:
|
|
1428
|
+
setup_codes = setup_codes.splitlines()
|
|
1429
|
+
declarations = variable_config.get("declarations", {})
|
|
1391
1430
|
|
|
1392
|
-
if declarations
|
|
1431
|
+
if len(declarations) < 1:
|
|
1432
|
+
self.sysexit(
|
|
1433
|
+
"Error, no variable 'declarations' for %s makes no sense."
|
|
1434
|
+
% full_name
|
|
1435
|
+
)
|
|
1436
|
+
|
|
1437
|
+
if self.evaluateCondition(
|
|
1393
1438
|
full_name=full_name,
|
|
1394
1439
|
condition=variable_config.get("when", "True"),
|
|
1395
1440
|
):
|
|
1396
|
-
if type(setup_codes) is str:
|
|
1397
|
-
setup_codes = setup_codes.splitlines()
|
|
1398
|
-
|
|
1399
1441
|
setup_codes.extend(
|
|
1400
1442
|
"%s=%r" % (constant_name, constant_value)
|
|
1401
1443
|
for (
|
|
@@ -1404,11 +1446,31 @@ except ImportError:
|
|
|
1404
1446
|
) in self.getExpressionConstants(full_name=full_name).items()
|
|
1405
1447
|
)
|
|
1406
1448
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1449
|
+
env_variables = {}
|
|
1450
|
+
|
|
1451
|
+
for env_name, env_value in environment.items():
|
|
1452
|
+
env_variables[env_name] = self.evaluateExpressionOrConstant(
|
|
1453
|
+
full_name=full_name,
|
|
1454
|
+
expression=env_value,
|
|
1455
|
+
config_name="variables config #%d" % count,
|
|
1456
|
+
extra_context=None,
|
|
1457
|
+
single_value=True,
|
|
1458
|
+
)
|
|
1459
|
+
|
|
1460
|
+
with withEnvironmentVarsOverridden(env_variables):
|
|
1461
|
+
info = self.queryRuntimeInformationMultiple(
|
|
1462
|
+
"%s_variables_%s" % (full_name.asString(), count),
|
|
1463
|
+
setup_codes=setup_codes,
|
|
1464
|
+
values=tuple(declarations.items()),
|
|
1465
|
+
)
|
|
1466
|
+
|
|
1467
|
+
if Options.isExperimental("display-yaml-variables"):
|
|
1468
|
+
self.info("Evaluated %r" % info)
|
|
1469
|
+
|
|
1470
|
+
if info is None:
|
|
1471
|
+
self.sysexit(
|
|
1472
|
+
"Error, failed to evaluate variables for %s." % full_name
|
|
1473
|
+
)
|
|
1412
1474
|
|
|
1413
1475
|
variables.update(info.asDict())
|
|
1414
1476
|
|
|
@@ -1419,10 +1481,9 @@ except ImportError:
|
|
|
1419
1481
|
def evaluateExpression(
|
|
1420
1482
|
self, full_name, expression, config_name, extra_context, single_value
|
|
1421
1483
|
):
|
|
1422
|
-
context =
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
context.update(_getEvaluationContext())
|
|
1484
|
+
context = _makeEvaluationContext(
|
|
1485
|
+
logger=self, full_name=full_name, config_name=config_name
|
|
1486
|
+
)
|
|
1426
1487
|
|
|
1427
1488
|
def get_variable(variable_name):
|
|
1428
1489
|
assert type(variable_name) is str, variable_name
|
|
@@ -1521,12 +1582,10 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
|
|
|
1521
1582
|
if condition == "False":
|
|
1522
1583
|
return False
|
|
1523
1584
|
|
|
1524
|
-
|
|
1585
|
+
# TODO: Maybe add module name to config name?
|
|
1586
|
+
context = _makeEvaluationContext(
|
|
1525
1587
|
logger=self, full_name=full_name, config_name="'when' configuration"
|
|
1526
1588
|
)
|
|
1527
|
-
context.update(control_tags)
|
|
1528
|
-
|
|
1529
|
-
context.update(_getEvaluationContext())
|
|
1530
1589
|
|
|
1531
1590
|
def get_parameter(parameter_name, default):
|
|
1532
1591
|
result = Options.getModuleParameter(full_name, parameter_name)
|
|
@@ -1609,6 +1668,11 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
|
|
|
1609
1668
|
def info(cls, message, keep_format=False):
|
|
1610
1669
|
plugins_logger.info(message, prefix=cls.plugin_name, keep_format=keep_format)
|
|
1611
1670
|
|
|
1671
|
+
@classmethod
|
|
1672
|
+
def debug(cls, message, keep_format=False):
|
|
1673
|
+
if Options.is_debug:
|
|
1674
|
+
cls.info(message, keep_format=keep_format)
|
|
1675
|
+
|
|
1612
1676
|
@classmethod
|
|
1613
1677
|
def sysexit(cls, message, mnemonic=None, reporting=True):
|
|
1614
1678
|
plugins_logger.sysexit(
|
|
@@ -1616,96 +1680,46 @@ Error, expression '%s' for module '%s' did not evaluate to 'str', 'tuple[str]' o
|
|
|
1616
1680
|
)
|
|
1617
1681
|
|
|
1618
1682
|
|
|
1619
|
-
class
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
def __init__(self):
|
|
1623
|
-
self.config = getYamlPackageConfiguration()
|
|
1624
|
-
|
|
1625
|
-
def getYamlConfigItem(
|
|
1626
|
-
self, module_name, section, item_name, decide_relevant, default, recursive
|
|
1627
|
-
):
|
|
1628
|
-
while True:
|
|
1629
|
-
module_configs = self.config.get(module_name, section=section)
|
|
1630
|
-
|
|
1631
|
-
if module_configs is not None:
|
|
1632
|
-
for module_config in module_configs:
|
|
1633
|
-
config_item = module_config.get(item_name, default)
|
|
1683
|
+
class TagContext(dict):
|
|
1684
|
+
def __init__(self, logger, full_name, config_name):
|
|
1685
|
+
dict.__init__(self)
|
|
1634
1686
|
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1687
|
+
self.logger = logger
|
|
1688
|
+
self.full_name = full_name
|
|
1689
|
+
self.config_name = config_name
|
|
1638
1690
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
condition=module_config.get("when", "True"),
|
|
1642
|
-
):
|
|
1643
|
-
continue
|
|
1691
|
+
self.used_tags = OrderedSet()
|
|
1692
|
+
self.used_variables = OrderedSet()
|
|
1644
1693
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
yield config_item
|
|
1694
|
+
def __getitem__(self, key):
|
|
1695
|
+
try:
|
|
1696
|
+
self.used_tags.add(key)
|
|
1649
1697
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1698
|
+
return dict.__getitem__(self, key)
|
|
1699
|
+
except KeyError:
|
|
1700
|
+
if key.startswith("use_"):
|
|
1701
|
+
return False
|
|
1652
1702
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1703
|
+
if key == "no_asserts":
|
|
1704
|
+
# TODO: This should be better decoupled.
|
|
1705
|
+
from .Plugins import Plugins
|
|
1656
1706
|
|
|
1657
|
-
|
|
1658
|
-
self, module_name, section, item_name, decide_relevant, recursive
|
|
1659
|
-
):
|
|
1660
|
-
def dict_decide_relevant(item_dict):
|
|
1661
|
-
if not item_dict:
|
|
1662
|
-
return False
|
|
1707
|
+
return Plugins.decideAssertions(self.full_name) is False
|
|
1663
1708
|
|
|
1664
|
-
if
|
|
1665
|
-
|
|
1709
|
+
if key == "no_docstrings":
|
|
1710
|
+
from .Plugins import Plugins
|
|
1666
1711
|
|
|
1667
|
-
|
|
1668
|
-
if decide_relevant(key, value):
|
|
1669
|
-
return True
|
|
1712
|
+
return Plugins.decideDocStrings(self.full_name) is False
|
|
1670
1713
|
|
|
1671
|
-
|
|
1714
|
+
if key == "no_annotations":
|
|
1715
|
+
from .Plugins import Plugins
|
|
1672
1716
|
|
|
1673
|
-
|
|
1674
|
-
module_name=module_name,
|
|
1675
|
-
section=section,
|
|
1676
|
-
item_name=item_name,
|
|
1677
|
-
decide_relevant=dict_decide_relevant,
|
|
1678
|
-
default={},
|
|
1679
|
-
recursive=recursive,
|
|
1680
|
-
):
|
|
1681
|
-
if recursive:
|
|
1682
|
-
for key, value in item_config[1].items():
|
|
1683
|
-
if decide_relevant(key, value):
|
|
1684
|
-
yield item_config[0], key, value
|
|
1685
|
-
else:
|
|
1686
|
-
for key, value in item_config.items():
|
|
1687
|
-
if decide_relevant(key, value):
|
|
1688
|
-
yield key, value
|
|
1717
|
+
return Plugins.decideAnnotations(self.full_name) is False
|
|
1689
1718
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
module_name=module_name,
|
|
1695
|
-
section=section,
|
|
1696
|
-
item_name=item_name,
|
|
1697
|
-
decide_relevant=None,
|
|
1698
|
-
default=(),
|
|
1699
|
-
recursive=recursive,
|
|
1700
|
-
):
|
|
1701
|
-
if recursive:
|
|
1702
|
-
for value in item_config[1]:
|
|
1703
|
-
if decide_relevant is None or decide_relevant(value):
|
|
1704
|
-
yield item_config[0], value
|
|
1705
|
-
else:
|
|
1706
|
-
for value in item_config:
|
|
1707
|
-
if decide_relevant is None or decide_relevant(value):
|
|
1708
|
-
yield value
|
|
1719
|
+
self.logger.sysexit(
|
|
1720
|
+
"Identifier '%s' in %s of module '%s' is unknown."
|
|
1721
|
+
% (key, self.config_name, self.full_name)
|
|
1722
|
+
)
|
|
1709
1723
|
|
|
1710
1724
|
|
|
1711
1725
|
def standalone_only(func):
|
|
@@ -1724,32 +1738,6 @@ def standalone_only(func):
|
|
|
1724
1738
|
return wrapped
|
|
1725
1739
|
|
|
1726
1740
|
|
|
1727
|
-
class TagContext(dict):
|
|
1728
|
-
def __init__(self, logger, full_name, config_name):
|
|
1729
|
-
dict.__init__(self)
|
|
1730
|
-
|
|
1731
|
-
self.logger = logger
|
|
1732
|
-
self.full_name = full_name
|
|
1733
|
-
self.config_name = config_name
|
|
1734
|
-
|
|
1735
|
-
self.used_tags = OrderedSet()
|
|
1736
|
-
self.used_variables = OrderedSet()
|
|
1737
|
-
|
|
1738
|
-
def __getitem__(self, key):
|
|
1739
|
-
try:
|
|
1740
|
-
self.used_tags.add(key)
|
|
1741
|
-
|
|
1742
|
-
return dict.__getitem__(self, key)
|
|
1743
|
-
except KeyError:
|
|
1744
|
-
if key.startswith("use_"):
|
|
1745
|
-
return False
|
|
1746
|
-
|
|
1747
|
-
self.logger.sysexit(
|
|
1748
|
-
"Identifier '%s' in %s of module '%s' is unknown."
|
|
1749
|
-
% (key, self.config_name, self.full_name)
|
|
1750
|
-
)
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
1741
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
1754
1742
|
# integrates with CPython, but also works on its own.
|
|
1755
1743
|
#
|
nuitka/plugins/Plugins.py
CHANGED
|
@@ -106,7 +106,7 @@ def _addActivePlugin(plugin_class, args, force=False):
|
|
|
106
106
|
else:
|
|
107
107
|
plugin_args = {}
|
|
108
108
|
|
|
109
|
-
with withPluginProblemReporting(plugin_class, "
|
|
109
|
+
with withPluginProblemReporting(plugin_class, "plugin initialization", ()):
|
|
110
110
|
plugin_instance = plugin_class(**plugin_args)
|
|
111
111
|
|
|
112
112
|
assert isinstance(plugin_instance, NuitkaPluginBase), plugin_instance
|
|
@@ -824,8 +824,9 @@ class Plugins(object):
|
|
|
824
824
|
|
|
825
825
|
for desc in description:
|
|
826
826
|
if desc is None:
|
|
827
|
-
|
|
828
|
-
|
|
827
|
+
continue
|
|
828
|
+
|
|
829
|
+
if len(desc) == 2:
|
|
829
830
|
code, reason = desc
|
|
830
831
|
flags = ()
|
|
831
832
|
else:
|
|
@@ -1394,6 +1395,93 @@ class Plugins(object):
|
|
|
1394
1395
|
for value in plugin.getExtraConstantDefaultPopulation():
|
|
1395
1396
|
yield value
|
|
1396
1397
|
|
|
1398
|
+
@classmethod
|
|
1399
|
+
def _decideWithoutDisagreement(
|
|
1400
|
+
cls,
|
|
1401
|
+
method_name,
|
|
1402
|
+
call_per_plugin,
|
|
1403
|
+
legal_values,
|
|
1404
|
+
abstain_values,
|
|
1405
|
+
get_default_value,
|
|
1406
|
+
):
|
|
1407
|
+
result = abstain_values[0]
|
|
1408
|
+
plugin_name = None
|
|
1409
|
+
|
|
1410
|
+
for plugin in getActivePlugins():
|
|
1411
|
+
value = call_per_plugin(plugin)
|
|
1412
|
+
|
|
1413
|
+
if value not in legal_values:
|
|
1414
|
+
plugin.sysexit(
|
|
1415
|
+
"Error, can only return '%s' from '%s' not %r"
|
|
1416
|
+
% (legal_values, method_name, value)
|
|
1417
|
+
)
|
|
1418
|
+
|
|
1419
|
+
if value in abstain_values:
|
|
1420
|
+
continue
|
|
1421
|
+
|
|
1422
|
+
if value != result:
|
|
1423
|
+
if result in abstain_values:
|
|
1424
|
+
result = value
|
|
1425
|
+
plugin_name = plugin.plugin_name
|
|
1426
|
+
else:
|
|
1427
|
+
plugin.sysexit(
|
|
1428
|
+
"Error, conflicting value '%s' with plug-in '%s' value '%s'."
|
|
1429
|
+
% (value, plugin_name, result)
|
|
1430
|
+
)
|
|
1431
|
+
if result in abstain_values:
|
|
1432
|
+
result = get_default_value()
|
|
1433
|
+
|
|
1434
|
+
return result
|
|
1435
|
+
|
|
1436
|
+
decide_annotations_cache = {}
|
|
1437
|
+
|
|
1438
|
+
@classmethod
|
|
1439
|
+
def decideAnnotations(cls, module_name):
|
|
1440
|
+
# For Python2 it's not a thing.
|
|
1441
|
+
if str is bytes:
|
|
1442
|
+
return False
|
|
1443
|
+
|
|
1444
|
+
if module_name not in cls.decide_annotations_cache:
|
|
1445
|
+
cls.decide_annotations_cache[module_name] = cls._decideWithoutDisagreement(
|
|
1446
|
+
call_per_plugin=lambda plugin: plugin.decideAnnotations(module_name),
|
|
1447
|
+
legal_values=(None, True, False),
|
|
1448
|
+
abstain_values=(None,),
|
|
1449
|
+
method_name="decideAnnotations",
|
|
1450
|
+
get_default_value=lambda: not Options.hasPythonFlagNoAnnotations(),
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
return cls.decide_annotations_cache[module_name]
|
|
1454
|
+
|
|
1455
|
+
decide_doc_strings_cache = {}
|
|
1456
|
+
|
|
1457
|
+
@classmethod
|
|
1458
|
+
def decideDocStrings(cls, module_name):
|
|
1459
|
+
if module_name not in cls.decide_doc_strings_cache:
|
|
1460
|
+
cls.decide_doc_strings_cache[module_name] = cls._decideWithoutDisagreement(
|
|
1461
|
+
call_per_plugin=lambda plugin: plugin.decideDocStrings(module_name),
|
|
1462
|
+
legal_values=(None, True, False),
|
|
1463
|
+
abstain_values=(None,),
|
|
1464
|
+
method_name="decideDocStrings",
|
|
1465
|
+
get_default_value=lambda: not Options.hasPythonFlagNoDocStrings(),
|
|
1466
|
+
)
|
|
1467
|
+
|
|
1468
|
+
return cls.decide_doc_strings_cache[module_name]
|
|
1469
|
+
|
|
1470
|
+
decide_assertions_cache = {}
|
|
1471
|
+
|
|
1472
|
+
@classmethod
|
|
1473
|
+
def decideAssertions(cls, module_name):
|
|
1474
|
+
if module_name not in cls.decide_assertions_cache:
|
|
1475
|
+
cls.decide_assertions_cache[module_name] = cls._decideWithoutDisagreement(
|
|
1476
|
+
call_per_plugin=lambda plugin: plugin.decideAssertions(module_name),
|
|
1477
|
+
legal_values=(None, True, False),
|
|
1478
|
+
abstain_values=(None,),
|
|
1479
|
+
method_name="decideAssertions",
|
|
1480
|
+
get_default_value=lambda: not Options.hasPythonFlagNoAsserts(),
|
|
1481
|
+
)
|
|
1482
|
+
|
|
1483
|
+
return cls.decide_assertions_cache[module_name]
|
|
1484
|
+
|
|
1397
1485
|
@classmethod
|
|
1398
1486
|
def decideAllowOutsideDependencies(cls, module_name):
|
|
1399
1487
|
result = None
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plugins: Welcome to Nuitka! This is your shortest way to become part of it.
|
|
6
|
+
|
|
7
|
+
This is to provide the base class for all Yaml plugins. These deal with the
|
|
8
|
+
configuration files of Nuitka.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from nuitka.utils.Yaml import getYamlPackageConfiguration
|
|
12
|
+
|
|
13
|
+
from .PluginBase import NuitkaPluginBase
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NuitkaYamlPluginBase(NuitkaPluginBase):
|
|
17
|
+
"""Nuitka base class for all plugins that use yaml config"""
|
|
18
|
+
|
|
19
|
+
def __init__(self):
|
|
20
|
+
self.config = getYamlPackageConfiguration()
|
|
21
|
+
|
|
22
|
+
def getYamlConfigItem(
|
|
23
|
+
self, module_name, section, item_name, decide_relevant, default, recursive
|
|
24
|
+
):
|
|
25
|
+
while True:
|
|
26
|
+
module_configs = self.config.get(module_name, section=section)
|
|
27
|
+
|
|
28
|
+
if module_configs is not None:
|
|
29
|
+
for module_config in module_configs:
|
|
30
|
+
config_item = module_config.get(item_name, default)
|
|
31
|
+
|
|
32
|
+
# Avoid condition, if the item is not relevant
|
|
33
|
+
if decide_relevant is not None and not decide_relevant(config_item):
|
|
34
|
+
continue
|
|
35
|
+
|
|
36
|
+
if not self.evaluateCondition(
|
|
37
|
+
full_name=module_name,
|
|
38
|
+
condition=module_config.get("when", "True"),
|
|
39
|
+
):
|
|
40
|
+
continue
|
|
41
|
+
|
|
42
|
+
if recursive:
|
|
43
|
+
yield module_name, config_item
|
|
44
|
+
else:
|
|
45
|
+
yield config_item
|
|
46
|
+
|
|
47
|
+
if not recursive:
|
|
48
|
+
break
|
|
49
|
+
|
|
50
|
+
module_name = module_name.getPackageName()
|
|
51
|
+
if not module_name:
|
|
52
|
+
break
|
|
53
|
+
|
|
54
|
+
def getYamlConfigItemItems(
|
|
55
|
+
self, module_name, section, item_name, decide_relevant, recursive
|
|
56
|
+
):
|
|
57
|
+
def dict_decide_relevant(item_dict):
|
|
58
|
+
if not item_dict:
|
|
59
|
+
return False
|
|
60
|
+
|
|
61
|
+
if decide_relevant is None:
|
|
62
|
+
return True
|
|
63
|
+
|
|
64
|
+
for key, value in item_dict.items():
|
|
65
|
+
if decide_relevant(key, value):
|
|
66
|
+
return True
|
|
67
|
+
|
|
68
|
+
return False
|
|
69
|
+
|
|
70
|
+
for item_config in self.getYamlConfigItem(
|
|
71
|
+
module_name=module_name,
|
|
72
|
+
section=section,
|
|
73
|
+
item_name=item_name,
|
|
74
|
+
decide_relevant=dict_decide_relevant,
|
|
75
|
+
default={},
|
|
76
|
+
recursive=recursive,
|
|
77
|
+
):
|
|
78
|
+
if recursive:
|
|
79
|
+
for key, value in item_config[1].items():
|
|
80
|
+
if decide_relevant(key, value):
|
|
81
|
+
yield item_config[0], key, value
|
|
82
|
+
else:
|
|
83
|
+
for key, value in item_config.items():
|
|
84
|
+
if decide_relevant(key, value):
|
|
85
|
+
yield key, value
|
|
86
|
+
|
|
87
|
+
def getYamlConfigItemSet(
|
|
88
|
+
self, module_name, section, item_name, decide_relevant, recursive
|
|
89
|
+
):
|
|
90
|
+
for item_config in self.getYamlConfigItem(
|
|
91
|
+
module_name=module_name,
|
|
92
|
+
section=section,
|
|
93
|
+
item_name=item_name,
|
|
94
|
+
decide_relevant=None,
|
|
95
|
+
default=(),
|
|
96
|
+
recursive=recursive,
|
|
97
|
+
):
|
|
98
|
+
if recursive:
|
|
99
|
+
for value in item_config[1]:
|
|
100
|
+
if decide_relevant is None or decide_relevant(value):
|
|
101
|
+
yield item_config[0], value
|
|
102
|
+
else:
|
|
103
|
+
for value in item_config:
|
|
104
|
+
if decide_relevant is None or decide_relevant(value):
|
|
105
|
+
yield value
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
109
|
+
# integrates with CPython, but also works on its own.
|
|
110
|
+
#
|
|
111
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
112
|
+
# you may not use this file except in compliance with the License.
|
|
113
|
+
# You may obtain a copy of the License at
|
|
114
|
+
#
|
|
115
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
116
|
+
#
|
|
117
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
118
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
119
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
120
|
+
# See the License for the specific language governing permissions and
|
|
121
|
+
# limitations under the License.
|