Nuitka-winsvc 2.3.11__cp311-cp311-win_amd64.whl → 2.4.5__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.11.data/scripts/nuitka-run.bat → Nuitka_winsvc-2.4.5.data/scripts/nuitka-run.cmd +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/RECORD +213 -210
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/WHEEL +1 -1
- nuitka/CacheCleanup.py +6 -1
- nuitka/HardImportRegistry.py +30 -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/Progress.py +2 -1
- nuitka/PythonFlavors.py +22 -4
- nuitka/PythonVersions.py +18 -0
- nuitka/Tracing.py +1 -0
- nuitka/TreeXML.py +6 -3
- nuitka/Version.py +1 -1
- nuitka/__main__.py +55 -10
- nuitka/__past__.py +5 -0
- nuitka/build/Backend.scons +6 -1
- nuitka/build/CCompilerVersion.scons +1 -0
- nuitka/build/Onefile.scons +4 -0
- nuitka/build/SconsCaching.py +2 -1
- nuitka/build/SconsCompilerSettings.py +1 -0
- nuitka/build/SconsHacks.py +5 -1
- nuitka/build/SconsInterface.py +2 -0
- nuitka/build/SconsUtils.py +4 -1
- 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 +10 -3
- nuitka/build/include/nuitka/prelude.h +6 -15
- nuitka/build/include/nuitka/printing.h +2 -0
- nuitka/build/include/nuitka/unfreezing.h +11 -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 +49 -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 +16 -7
- 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/HelpersFilesystemPaths.c +28 -13
- 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/InspectPatcher.c +14 -2
- nuitka/build/static_src/MainProgram.c +20 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +163 -140
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +13 -4
- nuitka/build/static_src/OnefileBootstrap.c +100 -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/Emission.py +1 -1
- nuitka/code_generation/GlobalConstants.py +6 -6
- nuitka/code_generation/Indentation.py +4 -5
- 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 +1 -8
- nuitka/code_generation/Namify.py +2 -0
- nuitka/code_generation/PackageResourceCodes.py +5 -1
- nuitka/code_generation/templates/CodeTemplatesConstants.py +22 -4
- nuitka/code_generation/templates/CodeTemplatesLoader.py +1 -1
- nuitka/code_generation/templates/CodeTemplatesModules.py +27 -9
- 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 +5 -12
- nuitka/freezer/IncludedDataFiles.py +15 -4
- 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 +7 -11
- 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 +3 -2
- 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/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 +92 -4
- 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 +489 -182
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +6 -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 +8 -0
- 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 +21 -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 +13 -2
- 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 +32 -8
- 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.11.data/scripts/nuitka.bat → /Nuitka_winsvc-2.4.5.data/scripts/nuitka.cmd +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-2.3.11.dist-info → Nuitka_winsvc-2.4.5.dist-info}/top_level.txt +0 -0
nuitka/nodes/ClassNodes.py
CHANGED
|
@@ -117,17 +117,15 @@ class ExpressionClassBodyBase(ExpressionOutlineFunctionBase):
|
|
|
117
117
|
return True
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
kind = "EXPRESSION_CLASS_BODY_P3"
|
|
120
|
+
class ExpressionClassMappingBody(MarkNeedsAnnotationsMixin, ExpressionClassBodyBase):
|
|
121
|
+
"""For use in cases, where the Python3 class is possibly a mapping."""
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
kind = "EXPRESSION_CLASS_MAPPING_BODY"
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
__slots__ += ("qualname_setup",)
|
|
125
|
+
__slots__ = ("needs_annotations_dict", "qualname_setup")
|
|
128
126
|
|
|
129
127
|
# Force creation with proper type.
|
|
130
|
-
locals_kind = "
|
|
128
|
+
locals_kind = "python_mapping_class"
|
|
131
129
|
|
|
132
130
|
def __init__(self, provider, name, doc, source_ref):
|
|
133
131
|
ExpressionClassBodyBase.__init__(
|
|
@@ -140,16 +138,15 @@ class ExpressionClassBodyP3(MarkNeedsAnnotationsMixin, ExpressionClassBodyBase):
|
|
|
140
138
|
|
|
141
139
|
MarkNeedsAnnotationsMixin.__init__(self)
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
self.qualname_setup = None
|
|
141
|
+
self.qualname_setup = None
|
|
145
142
|
|
|
146
143
|
|
|
147
|
-
class
|
|
148
|
-
kind = "
|
|
144
|
+
class ExpressionClassDictBodyP2(ExpressionDictShapeExactMixin, ExpressionClassBodyBase):
|
|
145
|
+
kind = "EXPRESSION_CLASS_DICT_BODY_P2"
|
|
149
146
|
|
|
150
147
|
__slots__ = ()
|
|
151
148
|
|
|
152
|
-
locals_kind = "
|
|
149
|
+
locals_kind = "python_dict_class"
|
|
153
150
|
|
|
154
151
|
def __init__(self, provider, name, doc, source_ref):
|
|
155
152
|
ExpressionClassBodyBase.__init__(
|
|
@@ -161,6 +158,27 @@ class ExpressionClassBodyP2(ExpressionDictShapeExactMixin, ExpressionClassBodyBa
|
|
|
161
158
|
)
|
|
162
159
|
|
|
163
160
|
|
|
161
|
+
class ExpressionClassDictBody(MarkNeedsAnnotationsMixin, ExpressionClassDictBodyP2):
|
|
162
|
+
"""For use in cases, where it's compile time pre-optimization determined to be a dictionary."""
|
|
163
|
+
|
|
164
|
+
kind = "EXPRESSION_CLASS_DICT_BODY"
|
|
165
|
+
|
|
166
|
+
__slots__ = ("needs_annotations_dict", "qualname_setup")
|
|
167
|
+
|
|
168
|
+
def __init__(self, provider, name, doc, source_ref):
|
|
169
|
+
ExpressionClassDictBodyP2.__init__(
|
|
170
|
+
self,
|
|
171
|
+
provider=provider,
|
|
172
|
+
name=name,
|
|
173
|
+
doc=doc,
|
|
174
|
+
source_ref=source_ref,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
MarkNeedsAnnotationsMixin.__init__(self)
|
|
178
|
+
|
|
179
|
+
self.qualname_setup = None
|
|
180
|
+
|
|
181
|
+
|
|
164
182
|
class ExpressionSelectMetaclass(ChildrenHavingMetaclassBasesMixin, ExpressionBase):
|
|
165
183
|
kind = "EXPRESSION_SELECT_METACLASS"
|
|
166
184
|
|
nuitka/nodes/CodeObjectSpecs.py
CHANGED
|
@@ -8,6 +8,7 @@ objects, as well as tracebacks. They might be shared.
|
|
|
8
8
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
+
from nuitka.utils.Hashing import getStringHash
|
|
11
12
|
from nuitka.utils.InstanceCounters import (
|
|
12
13
|
counted_del,
|
|
13
14
|
counted_init,
|
|
@@ -132,6 +133,14 @@ class CodeObjectSpec(object):
|
|
|
132
133
|
"code_flags": ",".join(self.future_spec.asFlags()),
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
def getHash(self):
|
|
137
|
+
return getStringHash(
|
|
138
|
+
"|".join(
|
|
139
|
+
"%s=%s" % (key, value)
|
|
140
|
+
for key, value in sorted(self.getDetails().items())
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
|
|
135
144
|
def getCodeObjectKind(self):
|
|
136
145
|
return self.co_kind
|
|
137
146
|
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
WARNING, this code is GENERATED. Modify the template ChildrenHavingMixin.py.j2 instead!
|
|
12
12
|
|
|
13
|
-
spell-checker: ignore __prepare__ append args autograph
|
|
14
|
-
spell-checker: ignore
|
|
15
|
-
spell-checker: ignore
|
|
16
|
-
spell-checker: ignore
|
|
13
|
+
spell-checker: ignore __prepare__ append args autograph capitalize casefold center chars
|
|
14
|
+
spell-checker: ignore clear copy count decode default delete dist distribution_name encode
|
|
15
|
+
spell-checker: ignore encoding end endswith errors exit_code expandtabs
|
|
16
|
+
spell-checker: ignore experimental_attributes experimental_autograph_options
|
|
17
17
|
spell-checker: ignore experimental_compile experimental_follow_type_hints
|
|
18
|
-
spell-checker: ignore experimental_implements experimental_relax_shapes extend
|
|
19
|
-
spell-checker: ignore
|
|
20
|
-
spell-checker: ignore
|
|
21
|
-
spell-checker: ignore
|
|
22
|
-
spell-checker: ignore
|
|
23
|
-
spell-checker: ignore
|
|
24
|
-
spell-checker: ignore
|
|
18
|
+
spell-checker: ignore experimental_implements experimental_relax_shapes extend fillchar
|
|
19
|
+
spell-checker: ignore find format format_map formatmap fromkeys func get group handle
|
|
20
|
+
spell-checker: ignore has_key haskey index input_signature insert isalnum isalpha isascii
|
|
21
|
+
spell-checker: ignore isdecimal isdigit isidentifier islower isnumeric isprintable isspace
|
|
22
|
+
spell-checker: ignore istitle isupper item items iterable iteritems iterkeys itervalues
|
|
23
|
+
spell-checker: ignore jit_compile join keepends key keys kwargs ljust lower lstrip
|
|
24
|
+
spell-checker: ignore maketrans maxsplit mode name new old p package
|
|
25
25
|
spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
|
|
26
26
|
spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
|
|
27
27
|
spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
|
nuitka/nodes/FunctionNodes.py
CHANGED
|
@@ -86,11 +86,8 @@ class ExpressionFunctionBodyBase(
|
|
|
86
86
|
"flags",
|
|
87
87
|
)
|
|
88
88
|
|
|
89
|
-
if python_version >= 0x340:
|
|
90
|
-
__slots__ += ("qualname_provider",)
|
|
91
|
-
|
|
92
89
|
if python_version >= 0x300:
|
|
93
|
-
__slots__ += ("non_local_declarations"
|
|
90
|
+
__slots__ += ("qualname_provider", "non_local_declarations")
|
|
94
91
|
|
|
95
92
|
# Might be None initially in some cases.
|
|
96
93
|
named_children = ("body|optional+setter",)
|
|
@@ -118,13 +115,12 @@ class ExpressionFunctionBodyBase(
|
|
|
118
115
|
# officially a child yet. Important during building.
|
|
119
116
|
self.parent = provider
|
|
120
117
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
if python_version >= 0x300:
|
|
119
|
+
# Python3: Might be overridden by global statement on the class name.
|
|
120
|
+
# TODO: Make this class only code.
|
|
124
121
|
self.qualname_provider = provider
|
|
125
122
|
|
|
126
|
-
|
|
127
|
-
if python_version >= 0x300:
|
|
123
|
+
# Non-local declarations if any.
|
|
128
124
|
self.non_local_declarations = None
|
|
129
125
|
|
|
130
126
|
@staticmethod
|
|
@@ -571,7 +567,7 @@ class ExpressionFunctionBody(
|
|
|
571
567
|
"parameters",
|
|
572
568
|
)
|
|
573
569
|
|
|
574
|
-
if python_version >=
|
|
570
|
+
if python_version >= 0x300:
|
|
575
571
|
__slots__ += ("qualname_setup",)
|
|
576
572
|
|
|
577
573
|
def __init__(
|
|
@@ -613,7 +609,7 @@ class ExpressionFunctionBody(
|
|
|
613
609
|
# Indicator if the function is used outside of where it's defined.
|
|
614
610
|
self.cross_module_use = False
|
|
615
611
|
|
|
616
|
-
if python_version >=
|
|
612
|
+
if python_version >= 0x300:
|
|
617
613
|
self.qualname_setup = None
|
|
618
614
|
|
|
619
615
|
self.parameters = parameters
|
nuitka/nodes/FutureSpecs.py
CHANGED
|
@@ -24,6 +24,9 @@ _future_annotations_default = python_version >= 0x400
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class FutureSpec(object):
|
|
27
|
+
# We are using a bunch of flags here, Python decides them and then we add
|
|
28
|
+
# even more modes ourselves, pylint: disable=too-many-instance-attributes
|
|
29
|
+
|
|
27
30
|
__slots__ = (
|
|
28
31
|
"future_division",
|
|
29
32
|
"unicode_literals",
|
|
@@ -32,10 +35,11 @@ class FutureSpec(object):
|
|
|
32
35
|
"barry_bdfl",
|
|
33
36
|
"generator_stop",
|
|
34
37
|
"future_annotations",
|
|
38
|
+
"use_annotations",
|
|
35
39
|
)
|
|
36
40
|
|
|
37
41
|
@counted_init
|
|
38
|
-
def __init__(self):
|
|
42
|
+
def __init__(self, use_annotations):
|
|
39
43
|
self.future_division = _future_division_default
|
|
40
44
|
self.unicode_literals = False
|
|
41
45
|
self.absolute_import = _future_absolute_import_default
|
|
@@ -44,6 +48,9 @@ class FutureSpec(object):
|
|
|
44
48
|
self.generator_stop = _future_generator_stop_default
|
|
45
49
|
self.future_annotations = _future_annotations_default
|
|
46
50
|
|
|
51
|
+
# Attaching our special modes here still.
|
|
52
|
+
self.use_annotations = use_annotations
|
|
53
|
+
|
|
47
54
|
if isCountingInstances():
|
|
48
55
|
__del__ = counted_del()
|
|
49
56
|
|
|
@@ -51,7 +58,7 @@ class FutureSpec(object):
|
|
|
51
58
|
return "<FutureSpec %s>" % ",".join(self.asFlags())
|
|
52
59
|
|
|
53
60
|
def clone(self):
|
|
54
|
-
result = FutureSpec()
|
|
61
|
+
result = FutureSpec(use_annotations=self.use_annotations)
|
|
55
62
|
|
|
56
63
|
result.future_division = self.future_division
|
|
57
64
|
result.unicode_literals = self.unicode_literals
|
|
@@ -96,6 +103,9 @@ class FutureSpec(object):
|
|
|
96
103
|
def enableFutureAnnotations(self):
|
|
97
104
|
self.future_annotations = True
|
|
98
105
|
|
|
106
|
+
def shallUseAnnotations(self):
|
|
107
|
+
return self.use_annotations
|
|
108
|
+
|
|
99
109
|
def isFutureAnnotations(self):
|
|
100
110
|
return self.future_annotations
|
|
101
111
|
|
|
@@ -137,7 +147,10 @@ def fromFlags(flags):
|
|
|
137
147
|
if "" in flags:
|
|
138
148
|
flags.remove("")
|
|
139
149
|
|
|
140
|
-
|
|
150
|
+
# TODO: For persistence, that's not very good, but it's actually only using
|
|
151
|
+
# our "no_annotations" flag during building phase, which is completed here,
|
|
152
|
+
# but we might have to add it in the future to XML differently.
|
|
153
|
+
result = FutureSpec(use_annotations=False)
|
|
141
154
|
|
|
142
155
|
if "CO_FUTURE_DIVISION" in flags:
|
|
143
156
|
result.enableFutureDivision()
|
nuitka/nodes/GeneratorNodes.py
CHANGED
|
@@ -70,7 +70,7 @@ class ExpressionGeneratorObjectBody(
|
|
|
70
70
|
"qualname_provider",
|
|
71
71
|
)
|
|
72
72
|
|
|
73
|
-
if python_version >=
|
|
73
|
+
if python_version >= 0x300:
|
|
74
74
|
__slots__ += ("qualname_setup",)
|
|
75
75
|
|
|
76
76
|
def __init__(self, provider, name, code_object, flags, auto_release, source_ref):
|
|
@@ -91,7 +91,7 @@ class ExpressionGeneratorObjectBody(
|
|
|
91
91
|
|
|
92
92
|
self.trace_collection = None
|
|
93
93
|
|
|
94
|
-
if python_version >=
|
|
94
|
+
if python_version >= 0x300:
|
|
95
95
|
self.qualname_setup = None
|
|
96
96
|
|
|
97
97
|
def getFunctionName(self):
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
WARNING, this code is GENERATED. Modify the template HardImportReferenceNode.py.j2 instead!
|
|
12
12
|
|
|
13
|
-
spell-checker: ignore __prepare__ append args autograph
|
|
14
|
-
spell-checker: ignore
|
|
15
|
-
spell-checker: ignore
|
|
16
|
-
spell-checker: ignore
|
|
13
|
+
spell-checker: ignore __prepare__ append args autograph capitalize casefold center chars
|
|
14
|
+
spell-checker: ignore clear copy count decode default delete dist distribution_name encode
|
|
15
|
+
spell-checker: ignore encoding end endswith errors exit_code expandtabs
|
|
16
|
+
spell-checker: ignore experimental_attributes experimental_autograph_options
|
|
17
17
|
spell-checker: ignore experimental_compile experimental_follow_type_hints
|
|
18
|
-
spell-checker: ignore experimental_implements experimental_relax_shapes extend
|
|
19
|
-
spell-checker: ignore
|
|
20
|
-
spell-checker: ignore
|
|
21
|
-
spell-checker: ignore
|
|
22
|
-
spell-checker: ignore
|
|
23
|
-
spell-checker: ignore
|
|
24
|
-
spell-checker: ignore
|
|
18
|
+
spell-checker: ignore experimental_implements experimental_relax_shapes extend fillchar
|
|
19
|
+
spell-checker: ignore find format format_map formatmap fromkeys func get group handle
|
|
20
|
+
spell-checker: ignore has_key haskey index input_signature insert isalnum isalpha isascii
|
|
21
|
+
spell-checker: ignore isdecimal isdigit isidentifier islower isnumeric isprintable isspace
|
|
22
|
+
spell-checker: ignore istitle isupper item items iterable iteritems iterkeys itervalues
|
|
23
|
+
spell-checker: ignore jit_compile join keepends key keys kwargs ljust lower lstrip
|
|
24
|
+
spell-checker: ignore maketrans maxsplit mode name new old p package
|
|
25
25
|
spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
|
|
26
26
|
spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
|
|
27
27
|
spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
|
|
@@ -37,7 +37,6 @@ from nuitka.Options import shallMakeModule
|
|
|
37
37
|
from nuitka.PythonVersions import python_version
|
|
38
38
|
from nuitka.specs.BuiltinParameterSpecs import extractBuiltinArgs
|
|
39
39
|
from nuitka.specs.HardImportSpecs import (
|
|
40
|
-
builtins_open_since_3_spec,
|
|
41
40
|
ctypes_cdll_before_38_spec,
|
|
42
41
|
ctypes_cdll_since_38_spec,
|
|
43
42
|
importlib_metadata_backport_distribution_spec,
|
|
@@ -86,7 +85,6 @@ from .ChildrenHavingMixins import (
|
|
|
86
85
|
ChildHavingPMixin,
|
|
87
86
|
ChildHavingRequirementsTupleMixin,
|
|
88
87
|
ChildHavingSMixin,
|
|
89
|
-
ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin,
|
|
90
88
|
ChildrenHavingFuncOptionalInputSignatureOptionalAutographOptionalJitCompileOptionalReduceRetracingOptionalExperimentalImplementsOptionalExperimentalAutographOptionsOptionalExperimentalAttributesOptionalExperimentalRelaxShapesOptionalExperimentalCompileOptionalExperimentalFollowTypeHintsOptionalMixin,
|
|
91
89
|
ChildrenHavingGroupNameOptionalMixin,
|
|
92
90
|
ChildrenHavingNameModeOptionalHandleOptionalUseErrnoOptionalUseLastErrorOptionalMixin,
|
|
@@ -107,127 +105,6 @@ from .ImportHardNodes import ExpressionImportModuleNameHardExistsSpecificBase
|
|
|
107
105
|
hard_import_node_classes = {}
|
|
108
106
|
|
|
109
107
|
|
|
110
|
-
class ExpressionBuiltinsOpenRef(ExpressionImportModuleNameHardExistsSpecificBase):
|
|
111
|
-
"""Function reference builtins.open"""
|
|
112
|
-
|
|
113
|
-
kind = "EXPRESSION_BUILTINS_OPEN_REF"
|
|
114
|
-
|
|
115
|
-
def __init__(self, source_ref):
|
|
116
|
-
ExpressionImportModuleNameHardExistsSpecificBase.__init__(
|
|
117
|
-
self,
|
|
118
|
-
module_name="builtins",
|
|
119
|
-
import_name="open",
|
|
120
|
-
module_guaranteed=True,
|
|
121
|
-
source_ref=source_ref,
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def computeExpressionCall(self, call_node, call_args, call_kw, trace_collection):
|
|
125
|
-
# Anything may happen on call trace before this. On next pass, if
|
|
126
|
-
# replaced, we might be better but not now.
|
|
127
|
-
trace_collection.onExceptionRaiseExit(BaseException)
|
|
128
|
-
|
|
129
|
-
from .BuiltinOpenNodes import makeExpressionBuiltinsOpenCall
|
|
130
|
-
|
|
131
|
-
result = extractBuiltinArgs(
|
|
132
|
-
node=call_node,
|
|
133
|
-
builtin_class=makeExpressionBuiltinsOpenCall,
|
|
134
|
-
builtin_spec=builtins_open_since_3_spec,
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
result,
|
|
139
|
-
"new_expression",
|
|
140
|
-
"Call to 'builtins.open' recognized.",
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
hard_import_node_classes[ExpressionBuiltinsOpenRef] = builtins_open_since_3_spec
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
class ExpressionBuiltinsOpenCallBase(
|
|
148
|
-
ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin,
|
|
149
|
-
ExpressionBase,
|
|
150
|
-
):
|
|
151
|
-
"""Base class for BuiltinsOpenCall
|
|
152
|
-
|
|
153
|
-
Generated boiler plate code.
|
|
154
|
-
"""
|
|
155
|
-
|
|
156
|
-
named_children = (
|
|
157
|
-
"file",
|
|
158
|
-
"mode|optional",
|
|
159
|
-
"buffering|optional",
|
|
160
|
-
"encoding|optional",
|
|
161
|
-
"errors|optional",
|
|
162
|
-
"newline|optional",
|
|
163
|
-
"closefd|optional",
|
|
164
|
-
"opener|optional",
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
__slots__ = ("attempted",)
|
|
168
|
-
|
|
169
|
-
spec = builtins_open_since_3_spec
|
|
170
|
-
|
|
171
|
-
def __init__(
|
|
172
|
-
self,
|
|
173
|
-
file,
|
|
174
|
-
mode,
|
|
175
|
-
buffering,
|
|
176
|
-
encoding,
|
|
177
|
-
errors,
|
|
178
|
-
newline,
|
|
179
|
-
closefd,
|
|
180
|
-
opener,
|
|
181
|
-
source_ref,
|
|
182
|
-
):
|
|
183
|
-
|
|
184
|
-
ChildrenHavingFileModeOptionalBufferingOptionalEncodingOptionalErrorsOptionalNewlineOptionalClosefdOptionalOpenerOptionalMixin.__init__(
|
|
185
|
-
self,
|
|
186
|
-
file=file,
|
|
187
|
-
mode=mode,
|
|
188
|
-
buffering=buffering,
|
|
189
|
-
encoding=encoding,
|
|
190
|
-
errors=errors,
|
|
191
|
-
newline=newline,
|
|
192
|
-
closefd=closefd,
|
|
193
|
-
opener=opener,
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
ExpressionBase.__init__(self, source_ref)
|
|
197
|
-
|
|
198
|
-
self.attempted = False
|
|
199
|
-
|
|
200
|
-
def computeExpression(self, trace_collection):
|
|
201
|
-
if self.attempted or not builtins_open_since_3_spec.isCompileTimeComputable(
|
|
202
|
-
(
|
|
203
|
-
self.subnode_file,
|
|
204
|
-
self.subnode_mode,
|
|
205
|
-
self.subnode_buffering,
|
|
206
|
-
self.subnode_encoding,
|
|
207
|
-
self.subnode_errors,
|
|
208
|
-
self.subnode_newline,
|
|
209
|
-
self.subnode_closefd,
|
|
210
|
-
self.subnode_opener,
|
|
211
|
-
)
|
|
212
|
-
):
|
|
213
|
-
trace_collection.onExceptionRaiseExit(BaseException)
|
|
214
|
-
|
|
215
|
-
return self, None, None
|
|
216
|
-
|
|
217
|
-
try:
|
|
218
|
-
return self.replaceWithCompileTimeValue(trace_collection)
|
|
219
|
-
finally:
|
|
220
|
-
self.attempted = True
|
|
221
|
-
|
|
222
|
-
@abstractmethod
|
|
223
|
-
def replaceWithCompileTimeValue(self, trace_collection):
|
|
224
|
-
pass
|
|
225
|
-
|
|
226
|
-
@staticmethod
|
|
227
|
-
def mayRaiseExceptionOperation():
|
|
228
|
-
return True
|
|
229
|
-
|
|
230
|
-
|
|
231
108
|
class ExpressionCtypesCdllRef(ExpressionImportModuleNameHardExistsSpecificBase):
|
|
232
109
|
"""Function reference ctypes.CDLL"""
|
|
233
110
|
|
nuitka/nodes/LocalsScopes.py
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
from nuitka.containers.OrderedDicts import OrderedDict
|
|
7
7
|
from nuitka.Errors import NuitkaOptimizationError
|
|
8
|
-
from nuitka.PythonVersions import python_version
|
|
9
8
|
from nuitka.utils.InstanceCounters import (
|
|
10
9
|
counted_del,
|
|
11
10
|
counted_init,
|
|
@@ -24,9 +23,9 @@ def getLocalsDictType(kind):
|
|
|
24
23
|
locals_scope = LocalsDictExecHandle
|
|
25
24
|
elif kind == "python_function":
|
|
26
25
|
locals_scope = LocalsDictFunctionHandle
|
|
27
|
-
elif kind == "
|
|
26
|
+
elif kind == "python_mapping_class":
|
|
28
27
|
locals_scope = LocalsMappingHandle
|
|
29
|
-
elif kind == "
|
|
28
|
+
elif kind == "python_dict_class":
|
|
30
29
|
locals_scope = LocalsDictHandle
|
|
31
30
|
elif kind == "module_dict":
|
|
32
31
|
locals_scope = GlobalsDictHandle
|
|
@@ -347,23 +346,22 @@ class LocalsDictHandle(LocalsDictHandleBase):
|
|
|
347
346
|
|
|
348
347
|
self.markForLocalsDictPropagation()
|
|
349
348
|
|
|
349
|
+
@staticmethod
|
|
350
|
+
def setTypeShape(type_shape):
|
|
351
|
+
pass
|
|
352
|
+
|
|
350
353
|
|
|
351
354
|
class LocalsMappingHandle(LocalsDictHandle):
|
|
352
355
|
"""Locals dict of a Python3 class with a mapping."""
|
|
353
356
|
|
|
354
|
-
__slots__ = ("type_shape",)
|
|
355
|
-
|
|
356
|
-
# TODO: Removable condition once Python 3.3 support is dropped.
|
|
357
|
-
if python_version >= 0x340:
|
|
358
|
-
__slots__ += ("prevented_propagation",)
|
|
357
|
+
__slots__ = ("type_shape", "prevented_propagation")
|
|
359
358
|
|
|
360
359
|
def __init__(self, locals_name, owner):
|
|
361
360
|
LocalsDictHandle.__init__(self, locals_name=locals_name, owner=owner)
|
|
362
361
|
|
|
363
362
|
self.type_shape = tshape_unknown
|
|
364
363
|
|
|
365
|
-
|
|
366
|
-
self.prevented_propagation = False
|
|
364
|
+
self.prevented_propagation = False
|
|
367
365
|
|
|
368
366
|
def getTypeShape(self):
|
|
369
367
|
# TODO: Make mapping available for this.
|
|
@@ -375,22 +373,20 @@ class LocalsMappingHandle(LocalsDictHandle):
|
|
|
375
373
|
def hasShapeDictionaryExact(self):
|
|
376
374
|
return self.type_shape is tshape_dict
|
|
377
375
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
#
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
self.prevented_propagation = False
|
|
385
|
-
return
|
|
376
|
+
def markAsComplete(self, trace_collection):
|
|
377
|
+
# For this run, it cannot be done yet.
|
|
378
|
+
if self.prevented_propagation:
|
|
379
|
+
# False alarm, this is available.
|
|
380
|
+
self.prevented_propagation = False
|
|
381
|
+
return
|
|
386
382
|
|
|
387
|
-
|
|
383
|
+
self.complete = True
|
|
388
384
|
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
def preventLocalsDictPropagation(self):
|
|
386
|
+
self.prevented_propagation = True
|
|
391
387
|
|
|
392
|
-
|
|
393
|
-
|
|
388
|
+
def isPreventedPropagation(self):
|
|
389
|
+
return self.prevented_propagation
|
|
394
390
|
|
|
395
391
|
def _considerPropagation(self, trace_collection):
|
|
396
392
|
if not self.variables:
|
nuitka/nodes/MatchNodes.py
CHANGED
|
@@ -3,26 +3,31 @@
|
|
|
3
3
|
|
|
4
4
|
""" Nodes for match statement for Python3.10+ """
|
|
5
5
|
|
|
6
|
-
from .ChildrenHavingMixins import
|
|
6
|
+
from .ChildrenHavingMixins import ChildrenHavingExpressionMatchTypeMixin
|
|
7
7
|
from .ExpressionBases import ExpressionBase
|
|
8
8
|
from .ExpressionShapeMixins import ExpressionTupleShapeExactMixin
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ExpressionMatchArgs(
|
|
12
|
-
ExpressionTupleShapeExactMixin,
|
|
12
|
+
ExpressionTupleShapeExactMixin,
|
|
13
|
+
ChildrenHavingExpressionMatchTypeMixin,
|
|
14
|
+
ExpressionBase,
|
|
13
15
|
):
|
|
14
16
|
kind = "EXPRESSION_MATCH_ARGS"
|
|
15
17
|
|
|
16
|
-
named_children = ("expression",)
|
|
18
|
+
named_children = ("expression", "match_type")
|
|
17
19
|
|
|
18
|
-
__slots__ = ("
|
|
20
|
+
__slots__ = ("positional_count", "keywords")
|
|
19
21
|
|
|
20
|
-
def __init__(self, expression, max_allowed, source_ref):
|
|
21
|
-
|
|
22
|
+
def __init__(self, expression, match_type, max_allowed, keywords, source_ref):
|
|
23
|
+
ChildrenHavingExpressionMatchTypeMixin.__init__(
|
|
24
|
+
self, expression=expression, match_type=match_type
|
|
25
|
+
)
|
|
22
26
|
|
|
23
27
|
ExpressionBase.__init__(self, source_ref)
|
|
24
28
|
|
|
25
|
-
self.
|
|
29
|
+
self.positional_count = max_allowed
|
|
30
|
+
self.keywords = tuple(keywords)
|
|
26
31
|
|
|
27
32
|
def computeExpression(self, trace_collection):
|
|
28
33
|
# TODO: May know that match args doesn't raise from the shape of
|
|
@@ -32,6 +37,12 @@ class ExpressionMatchArgs(
|
|
|
32
37
|
|
|
33
38
|
return self, None, None
|
|
34
39
|
|
|
40
|
+
def getPositionalArgsCount(self):
|
|
41
|
+
return self.positional_count
|
|
42
|
+
|
|
43
|
+
def getKeywordArgs(self):
|
|
44
|
+
return self.keywords
|
|
45
|
+
|
|
35
46
|
|
|
36
47
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
37
48
|
# integrates with CPython, but also works on its own.
|
|
@@ -16,7 +16,7 @@ quickly, in others they will present boundaries for optimization.
|
|
|
16
16
|
from nuitka import Options
|
|
17
17
|
|
|
18
18
|
from .ConstantRefNodes import makeConstantRefNode
|
|
19
|
-
from .ExpressionBases import ExpressionBase
|
|
19
|
+
from .ExpressionBases import ExpressionBase
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class ExpressionModuleAttributeBase(ExpressionBase):
|
|
@@ -164,25 +164,6 @@ class ExpressionModuleAttributeSpecRef(ExpressionModuleAttributeBase):
|
|
|
164
164
|
return self, None, None
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
class ExpressionNuitkaLoaderCreation(ExpressionNoSideEffectsMixin, ExpressionBase):
|
|
168
|
-
__slots__ = ("provider",)
|
|
169
|
-
|
|
170
|
-
kind = "EXPRESSION_NUITKA_LOADER_CREATION"
|
|
171
|
-
|
|
172
|
-
def __init__(self, provider, source_ref):
|
|
173
|
-
ExpressionBase.__init__(self, source_ref)
|
|
174
|
-
|
|
175
|
-
self.provider = provider
|
|
176
|
-
|
|
177
|
-
def finalize(self):
|
|
178
|
-
del self.parent
|
|
179
|
-
del self.provider
|
|
180
|
-
|
|
181
|
-
def computeExpressionRaw(self, trace_collection):
|
|
182
|
-
# Nothing can be done here.
|
|
183
|
-
return self, None, None
|
|
184
|
-
|
|
185
|
-
|
|
186
167
|
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
187
168
|
# integrates with CPython, but also works on its own.
|
|
188
169
|
#
|
nuitka/nodes/ModuleNodes.py
CHANGED
|
@@ -202,6 +202,10 @@ class PythonModuleBase(NodeBase):
|
|
|
202
202
|
|
|
203
203
|
return result
|
|
204
204
|
|
|
205
|
+
@staticmethod
|
|
206
|
+
def isExtensionModulePackage():
|
|
207
|
+
return False
|
|
208
|
+
|
|
205
209
|
|
|
206
210
|
class CompiledPythonModule(
|
|
207
211
|
ModuleChildrenHavingBodyOptionalStatementsOrNoneFunctionsTupleMixin,
|
|
@@ -972,7 +976,7 @@ class PythonMainModule(CompiledPythonModule):
|
|
|
972
976
|
class PythonExtensionModule(PythonModuleBase):
|
|
973
977
|
kind = "PYTHON_EXTENSION_MODULE"
|
|
974
978
|
|
|
975
|
-
__slots__ = ("used_modules", "module_filename", "technical")
|
|
979
|
+
__slots__ = ("used_modules", "module_filename", "technical", "is_package")
|
|
976
980
|
|
|
977
981
|
avoid_duplicates = set()
|
|
978
982
|
|
|
@@ -1009,9 +1013,15 @@ class PythonExtensionModule(PythonModuleBase):
|
|
|
1009
1013
|
|
|
1010
1014
|
if os.path.isdir(module_filename):
|
|
1011
1015
|
module_filename = getPackageDirFilename(module_filename)
|
|
1016
|
+
self.is_package = True
|
|
1017
|
+
else:
|
|
1018
|
+
self.is_package = False
|
|
1012
1019
|
|
|
1013
1020
|
self.module_filename = module_filename
|
|
1014
1021
|
|
|
1022
|
+
def isExtensionModulePackage(self):
|
|
1023
|
+
return self.is_package
|
|
1024
|
+
|
|
1015
1025
|
def finalize(self):
|
|
1016
1026
|
del self.used_modules
|
|
1017
1027
|
|
|
@@ -1026,24 +1036,31 @@ class PythonExtensionModule(PythonModuleBase):
|
|
|
1026
1036
|
"""Must be present as it's used in CPython library initialization."""
|
|
1027
1037
|
return self.technical
|
|
1028
1038
|
|
|
1029
|
-
def
|
|
1039
|
+
def _getPyIFilename(self):
|
|
1030
1040
|
"""Get Python type description filename."""
|
|
1031
1041
|
|
|
1032
1042
|
path = self.getFilename()
|
|
1033
1043
|
filename = os.path.basename(path)
|
|
1034
1044
|
dirname = os.path.dirname(path)
|
|
1035
1045
|
|
|
1036
|
-
|
|
1046
|
+
for suffix in (".pyi", ".py"):
|
|
1047
|
+
candidate = os.path.join(dirname, filename.split(".")[0]) + suffix
|
|
1048
|
+
|
|
1049
|
+
if os.path.exists(candidate):
|
|
1050
|
+
return candidate
|
|
1051
|
+
|
|
1052
|
+
return None
|
|
1037
1053
|
|
|
1038
1054
|
def _readPyIFile(self):
|
|
1039
1055
|
"""Read the .pyi file if present and scan for dependencies."""
|
|
1040
1056
|
|
|
1041
1057
|
if self.used_modules is None:
|
|
1042
|
-
pyi_filename = self.
|
|
1058
|
+
pyi_filename = self._getPyIFilename()
|
|
1043
1059
|
|
|
1044
|
-
if
|
|
1060
|
+
if pyi_filename is not None:
|
|
1045
1061
|
pyi_deps = parsePyIFile(
|
|
1046
|
-
module_name=self.getFullName(),
|
|
1062
|
+
module_name=self.getFullName(),
|
|
1063
|
+
pyi_filename=pyi_filename,
|
|
1047
1064
|
)
|
|
1048
1065
|
|
|
1049
1066
|
# These are not to be taken serious.
|