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.
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/RECORD +234 -225
- 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 +9 -5
- nuitka/build/include/nuitka/allocator.h +8 -3
- nuitka/build/include/nuitka/compiled_cell.h +8 -0
- nuitka/build/include/nuitka/constants.h +2 -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 +5 -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/HelpersFiles.c +9 -0
- 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 +1 -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 +15 -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 +9 -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 -54
- 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 +62 -35
- 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.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-2.1.5.data → Nuitka_winsvc-2.2.1.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.1.5.dist-info → Nuitka_winsvc-2.2.1.dist-info}/top_level.txt +0 -0
nuitka/nodes/ImportHardNodes.py
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
""" Nodes representing more trusted imports. """
|
|
5
5
|
|
|
6
|
-
from nuitka.importing.Importing import
|
|
6
|
+
from nuitka.importing.Importing import (
|
|
7
|
+
locateModule,
|
|
8
|
+
makeModuleUsageAttempt,
|
|
9
|
+
makeParentModuleUsagesAttempts,
|
|
10
|
+
)
|
|
7
11
|
from nuitka.utils.ModuleNames import ModuleName
|
|
8
12
|
|
|
9
13
|
from .ExpressionBases import ExpressionBase
|
|
@@ -12,7 +16,13 @@ from .ExpressionBases import ExpressionBase
|
|
|
12
16
|
class ExpressionImportHardBase(ExpressionBase):
|
|
13
17
|
# Base classes can be abstract, pylint: disable=abstract-method
|
|
14
18
|
#
|
|
15
|
-
__slots__ = (
|
|
19
|
+
__slots__ = (
|
|
20
|
+
"module_name",
|
|
21
|
+
"finding",
|
|
22
|
+
"module_kind",
|
|
23
|
+
"module_filename",
|
|
24
|
+
"module_usages",
|
|
25
|
+
)
|
|
16
26
|
|
|
17
27
|
def __init__(self, module_name, source_ref):
|
|
18
28
|
ExpressionBase.__init__(self, source_ref)
|
|
@@ -34,17 +44,21 @@ class ExpressionImportHardBase(ExpressionBase):
|
|
|
34
44
|
assert self.finding != "not-found", self.module_name
|
|
35
45
|
assert _module_name == self.module_name, (self.module_name, _module_name)
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
self.module_usages = makeParentModuleUsagesAttempts(
|
|
48
|
+
makeModuleUsageAttempt(
|
|
49
|
+
module_name=self.module_name,
|
|
50
|
+
filename=self.module_filename,
|
|
51
|
+
module_kind=self.module_kind,
|
|
52
|
+
finding=self.finding,
|
|
53
|
+
level=0,
|
|
54
|
+
source_ref=self.source_ref,
|
|
55
|
+
reason="import",
|
|
56
|
+
)
|
|
46
57
|
)
|
|
47
58
|
|
|
59
|
+
def getModuleUsageAttempts(self):
|
|
60
|
+
return self.module_usages
|
|
61
|
+
|
|
48
62
|
|
|
49
63
|
class ExpressionImportModuleNameHardBase(ExpressionImportHardBase):
|
|
50
64
|
"""Hard import names base class."""
|
|
@@ -96,7 +110,7 @@ class ExpressionImportModuleNameHardMaybeExists(ExpressionImportModuleNameHardBa
|
|
|
96
110
|
trace_collection.onExceptionRaiseExit(AttributeError)
|
|
97
111
|
|
|
98
112
|
# Trace the module usage attempt.
|
|
99
|
-
trace_collection.
|
|
113
|
+
trace_collection.onModuleUsageAttempts(self.getModuleUsageAttempts())
|
|
100
114
|
|
|
101
115
|
return self, None, None
|
|
102
116
|
|
|
@@ -122,7 +136,7 @@ class ExpressionImportModuleNameHardExists(ExpressionImportModuleNameHardBase):
|
|
|
122
136
|
trace_collection.onExceptionRaiseExit(ImportError)
|
|
123
137
|
|
|
124
138
|
# Trace the module usage attempt.
|
|
125
|
-
trace_collection.
|
|
139
|
+
trace_collection.onModuleUsageAttempts(self.getModuleUsageAttempts())
|
|
126
140
|
|
|
127
141
|
# As good as it gets.
|
|
128
142
|
return self, None, None
|
nuitka/nodes/ImportNodes.py
CHANGED
|
@@ -37,6 +37,7 @@ from nuitka.importing.Importing import (
|
|
|
37
37
|
isPackageDir,
|
|
38
38
|
locateModule,
|
|
39
39
|
makeModuleUsageAttempt,
|
|
40
|
+
makeParentModuleUsagesAttempts,
|
|
40
41
|
)
|
|
41
42
|
from nuitka.importing.ImportResolving import resolveModuleName
|
|
42
43
|
from nuitka.importing.Recursion import decideRecursion
|
|
@@ -47,6 +48,7 @@ from nuitka.Options import (
|
|
|
47
48
|
shallMakeModule,
|
|
48
49
|
shallWarnUnusualCode,
|
|
49
50
|
)
|
|
51
|
+
from nuitka.plugins.Plugins import Plugins
|
|
50
52
|
from nuitka.PythonVersions import python_version
|
|
51
53
|
from nuitka.specs.BuiltinParameterSpecs import (
|
|
52
54
|
BuiltinParameterSpec,
|
|
@@ -139,6 +141,7 @@ class ExpressionImportModuleFixed(ExpressionBase):
|
|
|
139
141
|
"found_module_filename",
|
|
140
142
|
"module_kind",
|
|
141
143
|
"finding",
|
|
144
|
+
"module_usages",
|
|
142
145
|
)
|
|
143
146
|
|
|
144
147
|
def __init__(self, module_name, value_name, source_ref):
|
|
@@ -157,6 +160,18 @@ class ExpressionImportModuleFixed(ExpressionBase):
|
|
|
157
160
|
self.finding,
|
|
158
161
|
) = self._attemptFollow()
|
|
159
162
|
|
|
163
|
+
self.module_usages = makeParentModuleUsagesAttempts(
|
|
164
|
+
makeModuleUsageAttempt(
|
|
165
|
+
module_name=self.found_module_name,
|
|
166
|
+
filename=self.found_module_filename,
|
|
167
|
+
finding=self.finding,
|
|
168
|
+
module_kind=self.module_kind,
|
|
169
|
+
level=0,
|
|
170
|
+
source_ref=self.source_ref,
|
|
171
|
+
reason="import",
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
|
|
160
175
|
# TODO: This is called in constructor only, is it, then inline it.
|
|
161
176
|
def _attemptFollow(self):
|
|
162
177
|
found_module_name, found_module_filename, module_kind, finding = locateModule(
|
|
@@ -218,23 +233,15 @@ class ExpressionImportModuleFixed(ExpressionBase):
|
|
|
218
233
|
else:
|
|
219
234
|
return tshape_module
|
|
220
235
|
|
|
221
|
-
def
|
|
222
|
-
return
|
|
223
|
-
module_name=self.found_module_name,
|
|
224
|
-
filename=self.found_module_filename,
|
|
225
|
-
finding=self.finding,
|
|
226
|
-
module_kind=self.module_kind,
|
|
227
|
-
level=0,
|
|
228
|
-
source_ref=self.source_ref,
|
|
229
|
-
reason="import",
|
|
230
|
-
)
|
|
236
|
+
def getModuleUsageAttempts(self):
|
|
237
|
+
return self.module_usages
|
|
231
238
|
|
|
232
239
|
def computeExpressionRaw(self, trace_collection):
|
|
233
240
|
if self.mayRaiseException(BaseException):
|
|
234
241
|
trace_collection.onExceptionRaiseExit(BaseException)
|
|
235
242
|
|
|
236
243
|
# Trace the module usage attempt.
|
|
237
|
-
trace_collection.
|
|
244
|
+
trace_collection.onModuleUsageAttempts(self.getModuleUsageAttempts())
|
|
238
245
|
|
|
239
246
|
# Nothing to do about it.
|
|
240
247
|
return self, None, None
|
|
@@ -263,6 +270,7 @@ class ExpressionImportModuleBuiltin(ExpressionBase):
|
|
|
263
270
|
"value_name",
|
|
264
271
|
"module_kind",
|
|
265
272
|
"builtin_module",
|
|
273
|
+
"module_usages",
|
|
266
274
|
)
|
|
267
275
|
|
|
268
276
|
def __init__(self, module_name, value_name, source_ref):
|
|
@@ -284,6 +292,18 @@ class ExpressionImportModuleBuiltin(ExpressionBase):
|
|
|
284
292
|
assert _finding == "built-in", _finding
|
|
285
293
|
assert _module_kind is None, _module_kind
|
|
286
294
|
|
|
295
|
+
self.module_usages = makeParentModuleUsagesAttempts(
|
|
296
|
+
makeModuleUsageAttempt(
|
|
297
|
+
module_name=self.module_name,
|
|
298
|
+
filename=None,
|
|
299
|
+
finding="built-in",
|
|
300
|
+
module_kind=None,
|
|
301
|
+
level=0,
|
|
302
|
+
source_ref=self.source_ref,
|
|
303
|
+
reason="import",
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
|
|
287
307
|
@staticmethod
|
|
288
308
|
def getTypeShape():
|
|
289
309
|
return tshape_module_builtin
|
|
@@ -310,23 +330,15 @@ class ExpressionImportModuleBuiltin(ExpressionBase):
|
|
|
310
330
|
def mayRaiseException(self, exception_type):
|
|
311
331
|
return isNonRaisingBuiltinModule(self.module_name) is not False
|
|
312
332
|
|
|
313
|
-
def
|
|
314
|
-
return
|
|
315
|
-
module_name=self.module_name,
|
|
316
|
-
filename=None,
|
|
317
|
-
finding="built-in",
|
|
318
|
-
module_kind=None,
|
|
319
|
-
level=0,
|
|
320
|
-
source_ref=self.source_ref,
|
|
321
|
-
reason="import",
|
|
322
|
-
)
|
|
333
|
+
def getModuleUsageAttempts(self):
|
|
334
|
+
return self.module_usages
|
|
323
335
|
|
|
324
336
|
def computeExpressionRaw(self, trace_collection):
|
|
325
337
|
if self.mayRaiseException(BaseException):
|
|
326
338
|
trace_collection.onExceptionRaiseExit(BaseException)
|
|
327
339
|
|
|
328
340
|
# Trace the module usage attempt.
|
|
329
|
-
trace_collection.
|
|
341
|
+
trace_collection.onModuleUsageAttempts(self.getModuleUsageAttempts())
|
|
330
342
|
|
|
331
343
|
# Nothing to do about it.
|
|
332
344
|
return self, None, None
|
|
@@ -428,7 +440,7 @@ class ExpressionImportModuleHard(
|
|
|
428
440
|
trace_collection.onExceptionRaiseExit(BaseException)
|
|
429
441
|
|
|
430
442
|
# Trace the module usage attempt.
|
|
431
|
-
trace_collection.
|
|
443
|
+
trace_collection.onModuleUsageAttempts(self.getModuleUsageAttempts())
|
|
432
444
|
|
|
433
445
|
return self, None, None
|
|
434
446
|
|
|
@@ -479,11 +491,11 @@ class ExpressionImportModuleHard(
|
|
|
479
491
|
def _computeExpressionAttribute(
|
|
480
492
|
self, lookup_node, attribute_name, trace_collection, is_import
|
|
481
493
|
):
|
|
482
|
-
# Return driven handling of many cases
|
|
494
|
+
# Return driven handling of many cases
|
|
495
|
+
# pylint: disable=too-many-branches,too-many-return-statements
|
|
483
496
|
|
|
484
|
-
if self.
|
|
497
|
+
if self.allowed:
|
|
485
498
|
full_name = self.value_name.getChildNamed(attribute_name)
|
|
486
|
-
|
|
487
499
|
full_name = ModuleName(hard_modules_aliases.get(full_name, full_name))
|
|
488
500
|
|
|
489
501
|
if isHardModule(full_name):
|
|
@@ -501,9 +513,12 @@ class ExpressionImportModuleHard(
|
|
|
501
513
|
% (self.value_name, attribute_name),
|
|
502
514
|
)
|
|
503
515
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
516
|
+
if self.value_name in hard_modules_trust:
|
|
517
|
+
trust = hard_modules_trust[self.value_name].get(
|
|
518
|
+
attribute_name, trust_undefined
|
|
519
|
+
)
|
|
520
|
+
else:
|
|
521
|
+
trust = trust_undefined
|
|
507
522
|
|
|
508
523
|
if trust is trust_importable:
|
|
509
524
|
# TODO: Change this is a hard module import itself, currently these are not all trusted
|
|
@@ -512,8 +527,10 @@ class ExpressionImportModuleHard(
|
|
|
512
527
|
trace_collection.onExceptionRaiseExit(BaseException)
|
|
513
528
|
elif trust is trust_may_exist:
|
|
514
529
|
trace_collection.onExceptionRaiseExit(BaseException)
|
|
515
|
-
elif
|
|
516
|
-
|
|
530
|
+
elif (
|
|
531
|
+
trust is not trust_undefined
|
|
532
|
+
and self.module is not None
|
|
533
|
+
and not hasattr(self.module, attribute_name)
|
|
517
534
|
):
|
|
518
535
|
# TODO: Unify with below branches.
|
|
519
536
|
trace_collection.onExceptionRaiseExit(ImportError)
|
|
@@ -573,7 +590,7 @@ class ExpressionImportModuleHard(
|
|
|
573
590
|
self.value_name,
|
|
574
591
|
attribute_name,
|
|
575
592
|
)
|
|
576
|
-
elif trust is trust_constant:
|
|
593
|
+
elif trust is trust_constant and self.module is not None:
|
|
577
594
|
# Make sure it's actually there, and not becoming the getattr default by accident.
|
|
578
595
|
assert hasattr(self.module, attribute_name), self
|
|
579
596
|
|
|
@@ -795,6 +812,30 @@ addModuleSingleAttributeNodeFactory(
|
|
|
795
812
|
)
|
|
796
813
|
|
|
797
814
|
|
|
815
|
+
def _makeParentImportModuleUsages(module_name, source_ref):
|
|
816
|
+
for parent_package_name in module_name.getParentPackageNames():
|
|
817
|
+
(
|
|
818
|
+
_parent_package_name,
|
|
819
|
+
parent_module_filename,
|
|
820
|
+
parent_module_kind,
|
|
821
|
+
parent_module_finding,
|
|
822
|
+
) = locateModule(
|
|
823
|
+
module_name=parent_package_name,
|
|
824
|
+
parent_package=None,
|
|
825
|
+
level=0,
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
yield makeModuleUsageAttempt(
|
|
829
|
+
module_name=parent_package_name,
|
|
830
|
+
filename=parent_module_filename,
|
|
831
|
+
finding=parent_module_finding,
|
|
832
|
+
module_kind=parent_module_kind,
|
|
833
|
+
level=0,
|
|
834
|
+
source_ref=source_ref,
|
|
835
|
+
reason="import path parent",
|
|
836
|
+
)
|
|
837
|
+
|
|
838
|
+
|
|
798
839
|
class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBase):
|
|
799
840
|
__slots__ = (
|
|
800
841
|
"follow_attempted",
|
|
@@ -850,7 +891,7 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
850
891
|
return level_value
|
|
851
892
|
|
|
852
893
|
def _attemptFollow(self, module_name):
|
|
853
|
-
# Complex stuff, pylint: disable=too-many-branches
|
|
894
|
+
# Complex stuff, pylint: disable=too-many-branches
|
|
854
895
|
|
|
855
896
|
# Without the level value, we don't know what it is.
|
|
856
897
|
level_value = self._getLevelValue()
|
|
@@ -885,7 +926,15 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
885
926
|
level=level_value,
|
|
886
927
|
)
|
|
887
928
|
|
|
888
|
-
|
|
929
|
+
# Allow for the import look ahead, to change what modules are
|
|
930
|
+
# considered hard imports.
|
|
931
|
+
Plugins.onModuleUsageLookAhead(
|
|
932
|
+
module_name=module_name_found,
|
|
933
|
+
module_filename=module_filename,
|
|
934
|
+
module_kind=module_kind,
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
self.used_modules = makeParentModuleUsagesAttempts(
|
|
889
938
|
makeModuleUsageAttempt(
|
|
890
939
|
module_name=module_name_found,
|
|
891
940
|
filename=module_filename,
|
|
@@ -895,7 +944,7 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
895
944
|
source_ref=self.source_ref,
|
|
896
945
|
reason="import",
|
|
897
946
|
)
|
|
898
|
-
|
|
947
|
+
)
|
|
899
948
|
|
|
900
949
|
if self.finding != "not-found":
|
|
901
950
|
module_name = module_name_found
|
|
@@ -929,6 +978,8 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
929
978
|
level=1, # Relative import
|
|
930
979
|
)
|
|
931
980
|
|
|
981
|
+
self.used_modules = list(self.used_modules)
|
|
982
|
+
|
|
932
983
|
self.used_modules.append(
|
|
933
984
|
makeModuleUsageAttempt(
|
|
934
985
|
module_name=name_import_module_name,
|
|
@@ -937,44 +988,14 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
937
988
|
finding=name_import_finding,
|
|
938
989
|
level=1,
|
|
939
990
|
source_ref=self.source_ref,
|
|
940
|
-
reason="import",
|
|
991
|
+
reason="import fromlist",
|
|
941
992
|
)
|
|
942
993
|
)
|
|
943
994
|
|
|
995
|
+
self.used_modules = tuple(self.used_modules)
|
|
996
|
+
|
|
944
997
|
return module_filename
|
|
945
998
|
else:
|
|
946
|
-
while True:
|
|
947
|
-
module_name = module_name.getPackageName()
|
|
948
|
-
|
|
949
|
-
if not module_name:
|
|
950
|
-
break
|
|
951
|
-
|
|
952
|
-
(
|
|
953
|
-
found_module_name,
|
|
954
|
-
module_filename,
|
|
955
|
-
module_kind,
|
|
956
|
-
finding,
|
|
957
|
-
) = locateModule(
|
|
958
|
-
module_name=module_name,
|
|
959
|
-
parent_package=parent_package,
|
|
960
|
-
level=level_value,
|
|
961
|
-
)
|
|
962
|
-
|
|
963
|
-
self.used_modules.append(
|
|
964
|
-
makeModuleUsageAttempt(
|
|
965
|
-
module_name=found_module_name,
|
|
966
|
-
filename=module_filename,
|
|
967
|
-
module_kind=module_kind,
|
|
968
|
-
finding=finding,
|
|
969
|
-
level=level_value,
|
|
970
|
-
source_ref=self.source_ref,
|
|
971
|
-
reason="import",
|
|
972
|
-
)
|
|
973
|
-
)
|
|
974
|
-
|
|
975
|
-
if finding != "not-found":
|
|
976
|
-
break
|
|
977
|
-
|
|
978
999
|
return None
|
|
979
1000
|
|
|
980
1001
|
def _getImportedValueName(self, imported_module_name):
|
|
@@ -999,8 +1020,7 @@ class ExpressionBuiltinImport(ChildrenExpressionBuiltinImportMixin, ExpressionBa
|
|
|
999
1020
|
trace_collection.onExceptionRaiseExit(RuntimeError)
|
|
1000
1021
|
|
|
1001
1022
|
# Trace the module usage attempts.
|
|
1002
|
-
|
|
1003
|
-
trace_collection.onModuleUsageAttempt(module_usage_attempt)
|
|
1023
|
+
trace_collection.onModuleUsageAttempts(self.used_modules)
|
|
1004
1024
|
|
|
1005
1025
|
# We stay here.
|
|
1006
1026
|
return self, None, None
|
nuitka/nodes/InjectCNodes.py
CHANGED
nuitka/nodes/ModuleNodes.py
CHANGED
|
@@ -131,7 +131,7 @@ class PythonModuleBase(NodeBase):
|
|
|
131
131
|
)
|
|
132
132
|
|
|
133
133
|
def getCodeName(self):
|
|
134
|
-
#
|
|
134
|
+
# Virtual method, pylint: disable=no-self-use
|
|
135
135
|
return None
|
|
136
136
|
|
|
137
137
|
def getCompileTimeFilename(self):
|
|
@@ -450,7 +450,10 @@ class CompiledPythonModule(
|
|
|
450
450
|
# For code name of modules, we need to translate to C identifiers,
|
|
451
451
|
# removing characters illegal for that.
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
if self.code_name is None:
|
|
454
|
+
self.code_name = encodePythonIdentifierToC(self.module_name)
|
|
455
|
+
|
|
456
|
+
return self.code_name
|
|
454
457
|
|
|
455
458
|
@staticmethod
|
|
456
459
|
def getChildQualname(function_name):
|
|
@@ -540,9 +543,11 @@ class CompiledPythonModule(
|
|
|
540
543
|
|
|
541
544
|
self.trace_collection = TraceCollectionModule(
|
|
542
545
|
self,
|
|
543
|
-
very_trusted_module_variables=
|
|
544
|
-
|
|
545
|
-
|
|
546
|
+
very_trusted_module_variables=(
|
|
547
|
+
old_collection.getVeryTrustedModuleVariables()
|
|
548
|
+
if old_collection is not None
|
|
549
|
+
else {}
|
|
550
|
+
),
|
|
546
551
|
)
|
|
547
552
|
|
|
548
553
|
module_body = self.subnode_body
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
""" Nodes that represent networkx functions
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from nuitka.HardImportRegistry import addModuleDynamicHard
|
|
9
|
+
|
|
10
|
+
# TODO: Disabled for now, keyword only arguments and star list argument are
|
|
11
|
+
# having ordering issues for call matching and code generation.
|
|
12
|
+
|
|
13
|
+
if False: # pylint: disable=using-constant-test
|
|
14
|
+
from .HardImportNodesGenerated import ( # pylint: disable=no-name-in-module
|
|
15
|
+
ExpressionNetworkxUtilsDecoratorsArgmapCallBase,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
addModuleDynamicHard(module_name="networkx.utils.decorators")
|
|
19
|
+
|
|
20
|
+
class ExpressionNetworkxUtilsDecoratorsArgmapCall(
|
|
21
|
+
ExpressionNetworkxUtilsDecoratorsArgmapCallBase
|
|
22
|
+
):
|
|
23
|
+
kind = "EXPRESSION_NETWORKX_UTILS_DECORATORS_ARGMAP_CALL"
|
|
24
|
+
|
|
25
|
+
def replaceWithCompileTimeValue(self, trace_collection):
|
|
26
|
+
# TODO: The node generation should allow for this to not be necessary
|
|
27
|
+
trace_collection.onExceptionRaiseExit(BaseException)
|
|
28
|
+
|
|
29
|
+
return self, None, None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
33
|
+
# integrates with CPython, but also works on its own.
|
|
34
|
+
#
|
|
35
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
# you may not use this file except in compliance with the License.
|
|
37
|
+
# You may obtain a copy of the License at
|
|
38
|
+
#
|
|
39
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
+
#
|
|
41
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
42
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
+
# See the License for the specific language governing permissions and
|
|
45
|
+
# limitations under the License.
|
nuitka/nodes/OsSysNodes.py
CHANGED
|
@@ -28,9 +28,11 @@ from .NodeBases import SideEffectsFromChildrenMixin
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class ExpressionPkgutilGetDataCall(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
(
|
|
32
|
+
ExpressionBytesShapeExactMixin
|
|
33
|
+
if str is not bytes
|
|
34
|
+
else ExpressionStrShapeExactMixin
|
|
35
|
+
),
|
|
34
36
|
SideEffectsFromChildrenMixin,
|
|
35
37
|
ExpressionPkgutilGetDataCallBase,
|
|
36
38
|
):
|
|
@@ -45,9 +47,11 @@ class ExpressionPkgutilGetDataCall(
|
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
class ExpressionPkgResourcesResourceStringCall(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
(
|
|
51
|
+
ExpressionBytesShapeExactMixin
|
|
52
|
+
if str is not bytes
|
|
53
|
+
else ExpressionStrShapeExactMixin
|
|
54
|
+
),
|
|
51
55
|
SideEffectsFromChildrenMixin,
|
|
52
56
|
ExpressionPkgResourcesResourceStringCallBase,
|
|
53
57
|
):
|