Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__cp312-cp312-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.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
nuitka/BytecodeCaching.py
CHANGED
|
@@ -107,7 +107,10 @@ def getCachedImportedModuleUsageAttempts(module_name, source_code, source_ref):
|
|
|
107
107
|
finding != module_used["finding"]
|
|
108
108
|
or module_kind != module_used["module_kind"]
|
|
109
109
|
):
|
|
110
|
-
assert module_name != "email._header_value_parser",
|
|
110
|
+
assert module_name != "email._header_value_parser", (
|
|
111
|
+
finding,
|
|
112
|
+
module_used["finding"],
|
|
113
|
+
)
|
|
111
114
|
|
|
112
115
|
return None
|
|
113
116
|
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
|
|
2
|
+
#
|
|
3
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
4
|
+
# integrates with CPython, but also works on its own.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
""" Registry for hard import data.
|
|
19
|
+
|
|
20
|
+
Part of it is static, but modules can get at during scan by plugins that
|
|
21
|
+
know how to handle these.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
from nuitka.nodes.ConstantRefNodes import ExpressionConstantSysVersionInfoRef
|
|
28
|
+
from nuitka.PythonVersions import (
|
|
29
|
+
getFutureModuleKeys,
|
|
30
|
+
getImportlibSubPackages,
|
|
31
|
+
python_version,
|
|
32
|
+
)
|
|
33
|
+
from nuitka.utils.Utils import isWin32Windows
|
|
34
|
+
|
|
35
|
+
# These module are supported in code generation to be imported the hard way.
|
|
36
|
+
hard_modules = set(
|
|
37
|
+
(
|
|
38
|
+
"os",
|
|
39
|
+
"ntpath",
|
|
40
|
+
"posixpath",
|
|
41
|
+
# TODO: Add mac path package too
|
|
42
|
+
"sys",
|
|
43
|
+
"types",
|
|
44
|
+
"typing",
|
|
45
|
+
"__future__",
|
|
46
|
+
"importlib",
|
|
47
|
+
"importlib.resources",
|
|
48
|
+
"importlib.metadata",
|
|
49
|
+
"_frozen_importlib",
|
|
50
|
+
"_frozen_importlib_external",
|
|
51
|
+
"pkgutil",
|
|
52
|
+
"functools",
|
|
53
|
+
"sysconfig",
|
|
54
|
+
"unittest",
|
|
55
|
+
"unittest.mock",
|
|
56
|
+
# "cStringIO",
|
|
57
|
+
"io",
|
|
58
|
+
"_io",
|
|
59
|
+
"ctypes",
|
|
60
|
+
"ctypes.wintypes",
|
|
61
|
+
"ctypes.macholib",
|
|
62
|
+
# TODO: Once generation of nodes for functions exists.
|
|
63
|
+
# "platform",
|
|
64
|
+
"builtins",
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
hard_modules_aliases = {
|
|
69
|
+
"os.path": os.path.__name__,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Lets put here, hard modules that are kind of backports only.
|
|
73
|
+
hard_modules_stdlib = hard_modules
|
|
74
|
+
hard_modules_non_stdlib = set(
|
|
75
|
+
(
|
|
76
|
+
"site",
|
|
77
|
+
"pkg_resources",
|
|
78
|
+
"importlib_metadata",
|
|
79
|
+
"importlib_resources",
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
hard_modules = hard_modules | hard_modules_non_stdlib
|
|
84
|
+
|
|
85
|
+
hard_modules_version = {
|
|
86
|
+
"cStringIO": (None, 0x300, None),
|
|
87
|
+
"typing": (0x350, None, None),
|
|
88
|
+
"_frozen_importlib": (0x300, None, None),
|
|
89
|
+
"_frozen_importlib_external": (0x350, None, None),
|
|
90
|
+
"importlib.resources": (0x370, None, None),
|
|
91
|
+
"importlib.metadata": (0x380, None, None),
|
|
92
|
+
"ctypes.wintypes": (None, None, "win32"),
|
|
93
|
+
"builtin": (0x300, None, None),
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
hard_modules_limited = ("importlib.metadata", "ctypes.wintypes", "importlib_metadata")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# The modules were added during compile time, no helper code available.
|
|
100
|
+
hard_modules_dynamic = set()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def isHardModule(module_name):
|
|
104
|
+
if module_name not in hard_modules:
|
|
105
|
+
return False
|
|
106
|
+
|
|
107
|
+
min_version, max_version, os_limit = hard_modules_version.get(
|
|
108
|
+
module_name, (None, None, None)
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if min_version is not None and python_version < min_version:
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
if max_version is not None and python_version >= max_version:
|
|
115
|
+
return False
|
|
116
|
+
|
|
117
|
+
if os_limit is not None:
|
|
118
|
+
if os_limit == "win32":
|
|
119
|
+
return isWin32Windows()
|
|
120
|
+
|
|
121
|
+
return True
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# These modules can cause issues if imported during compile time.
|
|
125
|
+
hard_modules_trust_with_side_effects = set(["site"])
|
|
126
|
+
if not isWin32Windows():
|
|
127
|
+
# Crashing on anything but Windows.
|
|
128
|
+
hard_modules_trust_with_side_effects.add("ctypes.wintypes")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def isHardModuleWithoutSideEffect(module_name):
|
|
132
|
+
return (
|
|
133
|
+
module_name in hard_modules
|
|
134
|
+
and module_name not in hard_modules_trust_with_side_effects
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
trust_undefined = 0
|
|
139
|
+
trust_constant = 1
|
|
140
|
+
trust_exist = 2
|
|
141
|
+
trust_module = trust_exist
|
|
142
|
+
trust_future = trust_exist
|
|
143
|
+
trust_importable = 3
|
|
144
|
+
trust_node = 4
|
|
145
|
+
trust_may_exist = 5
|
|
146
|
+
trust_not_exist = 6
|
|
147
|
+
trust_node_factory = {}
|
|
148
|
+
|
|
149
|
+
module_importlib_trust = dict(
|
|
150
|
+
(key, trust_importable) for key in getImportlibSubPackages()
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
if "metadata" not in module_importlib_trust:
|
|
154
|
+
module_importlib_trust["metadata"] = trust_undefined
|
|
155
|
+
if "resources" not in module_importlib_trust:
|
|
156
|
+
module_importlib_trust["resources"] = trust_undefined
|
|
157
|
+
|
|
158
|
+
module_sys_trust = {
|
|
159
|
+
"version": trust_constant,
|
|
160
|
+
"hexversion": trust_constant, # spell-checker: ignore hexversion
|
|
161
|
+
"platform": trust_constant,
|
|
162
|
+
"maxsize": trust_constant,
|
|
163
|
+
"byteorder": trust_constant,
|
|
164
|
+
"builtin_module_names": trust_constant,
|
|
165
|
+
"stdout": trust_exist,
|
|
166
|
+
"stderr": trust_exist,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if python_version < 0x270:
|
|
170
|
+
module_sys_trust["version_info"] = trust_constant
|
|
171
|
+
else:
|
|
172
|
+
module_sys_trust["version_info"] = trust_node
|
|
173
|
+
trust_node_factory[("sys", "version_info")] = ExpressionConstantSysVersionInfoRef
|
|
174
|
+
|
|
175
|
+
module_builtins_trust = {}
|
|
176
|
+
if python_version >= 0x300:
|
|
177
|
+
module_builtins_trust["open"] = trust_node
|
|
178
|
+
|
|
179
|
+
if python_version < 0x300:
|
|
180
|
+
module_sys_trust["exc_type"] = trust_may_exist
|
|
181
|
+
module_sys_trust["exc_value"] = trust_may_exist
|
|
182
|
+
module_sys_trust["exc_traceback"] = trust_may_exist
|
|
183
|
+
|
|
184
|
+
module_sys_trust["maxint"] = trust_constant
|
|
185
|
+
module_sys_trust["subversion"] = trust_constant
|
|
186
|
+
else:
|
|
187
|
+
module_sys_trust["exc_type"] = trust_not_exist
|
|
188
|
+
module_sys_trust["exc_value"] = trust_not_exist
|
|
189
|
+
module_sys_trust["exc_traceback"] = trust_not_exist
|
|
190
|
+
|
|
191
|
+
module_typing_trust = {
|
|
192
|
+
"TYPE_CHECKING": trust_constant,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
module_os_trust = {
|
|
196
|
+
"name": trust_constant,
|
|
197
|
+
"listdir": trust_node,
|
|
198
|
+
"curdir": trust_constant,
|
|
199
|
+
"pardir": trust_constant,
|
|
200
|
+
"sep": trust_constant,
|
|
201
|
+
"extsep": trust_constant,
|
|
202
|
+
"altsep": trust_constant,
|
|
203
|
+
"pathsep": trust_constant,
|
|
204
|
+
"linesep": trust_constant,
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
module_os_path_trust = {
|
|
208
|
+
"exists": trust_node,
|
|
209
|
+
"isfile": trust_node,
|
|
210
|
+
"isdir": trust_node,
|
|
211
|
+
"basename": trust_node,
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
module_ctypes_trust = {
|
|
216
|
+
"CDLL": trust_node,
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# module_platform_trust = {"python_implementation": trust_function}
|
|
220
|
+
|
|
221
|
+
hard_modules_trust = {
|
|
222
|
+
"os": module_os_trust,
|
|
223
|
+
"ntpath": module_os_path_trust if os.path.__name__ == "ntpath" else {},
|
|
224
|
+
"posixpath": module_os_path_trust if os.path.__name__ == "posixpath" else {},
|
|
225
|
+
"sys": module_sys_trust,
|
|
226
|
+
# "platform": module_platform_trust,
|
|
227
|
+
"types": {},
|
|
228
|
+
"typing": module_typing_trust,
|
|
229
|
+
"__future__": dict((key, trust_future) for key in getFutureModuleKeys()),
|
|
230
|
+
"importlib": module_importlib_trust,
|
|
231
|
+
"importlib.metadata": {
|
|
232
|
+
"version": trust_node,
|
|
233
|
+
"distribution": trust_node,
|
|
234
|
+
"metadata": trust_node,
|
|
235
|
+
"entry_points": trust_node,
|
|
236
|
+
"PackageNotFoundError": trust_exist,
|
|
237
|
+
},
|
|
238
|
+
"importlib_metadata": {
|
|
239
|
+
"version": trust_node,
|
|
240
|
+
"distribution": trust_node,
|
|
241
|
+
"metadata": trust_node,
|
|
242
|
+
"entry_points": trust_node,
|
|
243
|
+
"PackageNotFoundError": trust_exist,
|
|
244
|
+
},
|
|
245
|
+
"_frozen_importlib": {},
|
|
246
|
+
"_frozen_importlib_external": {},
|
|
247
|
+
"pkgutil": {"get_data": trust_node},
|
|
248
|
+
"functools": {"partial": trust_exist},
|
|
249
|
+
"sysconfig": {},
|
|
250
|
+
"unittest": {"mock": trust_module, "main": trust_exist},
|
|
251
|
+
"unittest.mock": {},
|
|
252
|
+
"io": {"BytesIO": trust_exist, "StringIO": trust_exist},
|
|
253
|
+
"_io": {"BytesIO": trust_exist, "StringIO": trust_exist},
|
|
254
|
+
# "cStringIO": {"StringIO": trust_exist},
|
|
255
|
+
"pkg_resources": {
|
|
256
|
+
"require": trust_node,
|
|
257
|
+
"get_distribution": trust_node,
|
|
258
|
+
"iter_entry_points": trust_node,
|
|
259
|
+
"resource_string": trust_node,
|
|
260
|
+
"resource_stream": trust_node,
|
|
261
|
+
},
|
|
262
|
+
"importlib.resources": {
|
|
263
|
+
"read_binary": trust_node,
|
|
264
|
+
"read_text": trust_node,
|
|
265
|
+
"files": trust_node,
|
|
266
|
+
},
|
|
267
|
+
"importlib_resources": {
|
|
268
|
+
"read_binary": trust_node,
|
|
269
|
+
"read_text": trust_node,
|
|
270
|
+
"files": trust_node,
|
|
271
|
+
},
|
|
272
|
+
"ctypes": module_ctypes_trust,
|
|
273
|
+
"site": {},
|
|
274
|
+
"ctypes.wintypes": {},
|
|
275
|
+
"ctypes.macholib": {},
|
|
276
|
+
"builtins": module_builtins_trust,
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def _addHardImportNodeClasses():
|
|
281
|
+
from nuitka.nodes.HardImportNodesGenerated import hard_import_node_classes
|
|
282
|
+
|
|
283
|
+
for hard_import_node_class, spec in hard_import_node_classes.items():
|
|
284
|
+
module_name, function_name = spec.name.rsplit(".", 1)
|
|
285
|
+
|
|
286
|
+
if module_name in hard_modules_aliases:
|
|
287
|
+
module_name = hard_modules_aliases.get(module_name)
|
|
288
|
+
|
|
289
|
+
trust_node_factory[(module_name, function_name)] = hard_import_node_class
|
|
290
|
+
|
|
291
|
+
# hard_modules_trust[module_name][function_name] = trust_node
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
_addHardImportNodeClasses()
|
|
295
|
+
|
|
296
|
+
# Remove this one again, not available on Windows, but the node generation does
|
|
297
|
+
# not know that.
|
|
298
|
+
if isWin32Windows():
|
|
299
|
+
module_os_trust["uname"] = trust_not_exist
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def _checkHardModules():
|
|
303
|
+
for module_name in hard_modules:
|
|
304
|
+
assert module_name in hard_modules_trust, module_name
|
|
305
|
+
|
|
306
|
+
for module_name, trust in hard_modules_trust.items():
|
|
307
|
+
assert module_name in hard_modules, module_name
|
|
308
|
+
|
|
309
|
+
for attribute_name, trust_value in trust.items():
|
|
310
|
+
if trust_value is trust_node:
|
|
311
|
+
assert (
|
|
312
|
+
module_name,
|
|
313
|
+
attribute_name,
|
|
314
|
+
) in trust_node_factory or os.path.basename(sys.argv[0]).startswith(
|
|
315
|
+
"generate-"
|
|
316
|
+
), (
|
|
317
|
+
module_name,
|
|
318
|
+
attribute_name,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
_checkHardModules()
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def addModuleTrust(module_name, attribute_name, trust_value):
|
|
326
|
+
hard_modules_trust[module_name][attribute_name] = trust_value
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def addModuleSingleAttributeNodeFactory(module_name, attribute_name, node_class):
|
|
330
|
+
hard_modules_trust[module_name][attribute_name] = trust_node
|
|
331
|
+
trust_node_factory[(module_name, attribute_name)] = node_class
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def addModuleAttributeFactory(module_name, attribute_name, node_class):
|
|
335
|
+
trust_node_factory[(module_name, attribute_name)] = node_class
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def addModuleDynamicHard(module_name):
|
|
339
|
+
hard_modules.add(module_name)
|
|
340
|
+
hard_modules_dynamic.add(module_name)
|
|
341
|
+
hard_modules_non_stdlib.add(module_name)
|
|
342
|
+
|
|
343
|
+
if module_name not in hard_modules_trust:
|
|
344
|
+
hard_modules_trust[module_name] = {}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def isHardModuleDynamic(module_name):
|
|
348
|
+
return module_name in hard_modules_dynamic
|
nuitka/MainControl.py
CHANGED
|
@@ -29,7 +29,10 @@ import sys
|
|
|
29
29
|
|
|
30
30
|
from nuitka.build.DataComposerInterface import runDataComposer
|
|
31
31
|
from nuitka.build.SconsUtils import getSconsReportValue, readSconsReport
|
|
32
|
-
from nuitka.code_generation.ConstantCodes import
|
|
32
|
+
from nuitka.code_generation.ConstantCodes import (
|
|
33
|
+
addDistributionMetadataValue,
|
|
34
|
+
getDistributionMetadataValues,
|
|
35
|
+
)
|
|
33
36
|
from nuitka.freezer.IncludedDataFiles import (
|
|
34
37
|
addIncludedDataFilesFromFileOptions,
|
|
35
38
|
addIncludedDataFilesFromPackageOptions,
|
|
@@ -51,6 +54,7 @@ from nuitka.Options import (
|
|
|
51
54
|
hasPythonFlagNoDocStrings,
|
|
52
55
|
hasPythonFlagNoWarnings,
|
|
53
56
|
hasPythonFlagUnbuffered,
|
|
57
|
+
isExperimental,
|
|
54
58
|
)
|
|
55
59
|
from nuitka.plugins.Plugins import Plugins
|
|
56
60
|
from nuitka.PostProcessing import executePostProcessing
|
|
@@ -67,6 +71,7 @@ from nuitka.PythonFlavors import (
|
|
|
67
71
|
isPyenvPython,
|
|
68
72
|
)
|
|
69
73
|
from nuitka.PythonVersions import (
|
|
74
|
+
getModuleLinkerLibs,
|
|
70
75
|
getPythonABI,
|
|
71
76
|
getSupportedPythonVersions,
|
|
72
77
|
python_version,
|
|
@@ -103,7 +108,6 @@ from . import ModuleRegistry, Options, OutputDirectories
|
|
|
103
108
|
from .build.SconsInterface import (
|
|
104
109
|
asBoolStr,
|
|
105
110
|
cleanSconsDirectory,
|
|
106
|
-
getSconsDataPath,
|
|
107
111
|
runScons,
|
|
108
112
|
setCommonSconsOptions,
|
|
109
113
|
)
|
|
@@ -123,16 +127,6 @@ from .tree.SourceHandling import writeSourceCode
|
|
|
123
127
|
from .TreeXML import dumpTreeXMLToFile
|
|
124
128
|
|
|
125
129
|
|
|
126
|
-
def _setupFromMainFilenames():
|
|
127
|
-
main_filenames = Options.getMainEntryPointFilenames()
|
|
128
|
-
for filename in main_filenames:
|
|
129
|
-
# Inform the importing layer about the main script directory, so it can use
|
|
130
|
-
# it when attempting to follow imports.
|
|
131
|
-
Importing.addMainScriptDirectory(
|
|
132
|
-
main_dir=os.path.dirname(os.path.abspath(filename))
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
136
130
|
def _createMainModule():
|
|
137
131
|
"""Create a node tree.
|
|
138
132
|
|
|
@@ -142,7 +136,7 @@ def _createMainModule():
|
|
|
142
136
|
directory paths.
|
|
143
137
|
|
|
144
138
|
"""
|
|
145
|
-
# Many cases to deal with, pylint: disable=too-many-branches
|
|
139
|
+
# Many cases and details to deal with, pylint: disable=too-many-branches,too-many-locals
|
|
146
140
|
|
|
147
141
|
Plugins.onBeforeCodeParsing()
|
|
148
142
|
|
|
@@ -246,7 +240,9 @@ def _createMainModule():
|
|
|
246
240
|
)
|
|
247
241
|
|
|
248
242
|
Recursion.checkPluginSinglePath(
|
|
249
|
-
plugin_filename=module_filename,
|
|
243
|
+
plugin_filename=module_filename,
|
|
244
|
+
module_package=module_name.getPackageName(),
|
|
245
|
+
package_only=True,
|
|
250
246
|
)
|
|
251
247
|
|
|
252
248
|
# Allow plugins to add more modules based on the initial set being complete.
|
|
@@ -262,6 +258,18 @@ def _createMainModule():
|
|
|
262
258
|
if Options.isStandaloneMode():
|
|
263
259
|
checkFreezingModuleSet()
|
|
264
260
|
|
|
261
|
+
# Check if distribution meta data is included, that cannot be used.
|
|
262
|
+
for distribution_name, (
|
|
263
|
+
package_name,
|
|
264
|
+
_metadata,
|
|
265
|
+
_entry_points,
|
|
266
|
+
) in getDistributionMetadataValues():
|
|
267
|
+
if not ModuleRegistry.hasDoneModule(package_name):
|
|
268
|
+
inclusion_logger.sysexit(
|
|
269
|
+
"Error, including metadata for distribution '%s' without including related package '%s'."
|
|
270
|
+
% (distribution_name, package_name)
|
|
271
|
+
)
|
|
272
|
+
|
|
265
273
|
# Allow plugins to comment on final module set.
|
|
266
274
|
Plugins.onModuleCompleteSet()
|
|
267
275
|
|
|
@@ -578,8 +586,6 @@ def runSconsBackend():
|
|
|
578
586
|
"full_compat": asBoolStr(Options.is_full_compat),
|
|
579
587
|
"experimental": ",".join(Options.getExperimentalIndications()),
|
|
580
588
|
"trace_mode": asBoolStr(Options.shallTraceExecution()),
|
|
581
|
-
"python_version": python_version_str,
|
|
582
|
-
"nuitka_src": getSconsDataPath(),
|
|
583
589
|
"file_reference_mode": Options.getFileReferenceMode(),
|
|
584
590
|
"module_count": "%d" % len(ModuleRegistry.getDoneModules()),
|
|
585
591
|
}
|
|
@@ -693,6 +699,10 @@ def runSconsBackend():
|
|
|
693
699
|
if Options.shallMakeModule():
|
|
694
700
|
options["module_suffix"] = getSharedLibrarySuffix(preferred=True)
|
|
695
701
|
|
|
702
|
+
link_module_libs = getModuleLinkerLibs()
|
|
703
|
+
if link_module_libs:
|
|
704
|
+
options["link_module_libs"] = ",".join(link_module_libs)
|
|
705
|
+
|
|
696
706
|
env_values = setCommonSconsOptions(options)
|
|
697
707
|
|
|
698
708
|
# Allow plugins to build definitions.
|
|
@@ -878,9 +888,9 @@ def compileTree():
|
|
|
878
888
|
general.info("Running C compilation via Scons.")
|
|
879
889
|
|
|
880
890
|
# Run the Scons to build things.
|
|
881
|
-
result,
|
|
891
|
+
result, scons_options = runSconsBackend()
|
|
882
892
|
|
|
883
|
-
return result,
|
|
893
|
+
return result, scons_options
|
|
884
894
|
|
|
885
895
|
|
|
886
896
|
def handleSyntaxError(e):
|
|
@@ -943,7 +953,9 @@ def _main():
|
|
|
943
953
|
else None,
|
|
944
954
|
)
|
|
945
955
|
|
|
946
|
-
|
|
956
|
+
# Initialize the importing layer from options, main filenames, debugging
|
|
957
|
+
# options, etc.
|
|
958
|
+
Importing.setupImportingFromOptions()
|
|
947
959
|
|
|
948
960
|
addIncludedDataFilesFromFileOptions()
|
|
949
961
|
addIncludedDataFilesFromPackageOptions()
|
|
@@ -959,7 +971,7 @@ def _main():
|
|
|
959
971
|
dumpTreeXML()
|
|
960
972
|
|
|
961
973
|
# Make the actual compilation.
|
|
962
|
-
result,
|
|
974
|
+
result, scons_options = compileTree()
|
|
963
975
|
|
|
964
976
|
# Exit if compilation failed.
|
|
965
977
|
if not result:
|
|
@@ -986,7 +998,7 @@ def _main():
|
|
|
986
998
|
copyDataFiles()
|
|
987
999
|
|
|
988
1000
|
if Options.isStandaloneMode():
|
|
989
|
-
binary_filename =
|
|
1001
|
+
binary_filename = scons_options["result_exe"]
|
|
990
1002
|
|
|
991
1003
|
setMainEntryPoint(binary_filename)
|
|
992
1004
|
|
|
@@ -1040,14 +1052,14 @@ def _main():
|
|
|
1040
1052
|
if Options.isStandaloneMode() and isMacOS():
|
|
1041
1053
|
general.info(
|
|
1042
1054
|
"Created binary that runs on macOS %s (%s) or higher."
|
|
1043
|
-
% (
|
|
1055
|
+
% (scons_options["macos_min_version"], scons_options["macos_target_arch"])
|
|
1044
1056
|
)
|
|
1045
1057
|
|
|
1046
|
-
if
|
|
1058
|
+
if scons_options["macos_target_arch"] != getArchitecture():
|
|
1047
1059
|
general.warning(
|
|
1048
1060
|
"It will only work as well as 'arch -%s %s %s' does."
|
|
1049
1061
|
% (
|
|
1050
|
-
|
|
1062
|
+
scons_options["macos_target_arch"],
|
|
1051
1063
|
sys.executable,
|
|
1052
1064
|
Options.getMainEntryPointFilenames()[0],
|
|
1053
1065
|
),
|
|
@@ -1106,6 +1118,14 @@ def main():
|
|
|
1106
1118
|
try:
|
|
1107
1119
|
writeCompilationReports(aborted=True)
|
|
1108
1120
|
except BaseException as e: # Catch all the things, pylint: disable=broad-except
|
|
1109
|
-
general.warning(
|
|
1121
|
+
general.warning(
|
|
1122
|
+
"""\
|
|
1123
|
+
Report writing was prevented by exception %r, use option \
|
|
1124
|
+
'--experimental=debug-report-traceback' for full traceback."""
|
|
1125
|
+
% e
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
if isExperimental("debug-report-traceback"):
|
|
1129
|
+
raise
|
|
1110
1130
|
|
|
1111
1131
|
raise
|
nuitka/OptionParsing.py
CHANGED
|
@@ -358,6 +358,16 @@ When creating the onefile, disable compression of the payload. This is
|
|
|
358
358
|
mostly for debug purposes, or to save time. Default is off.""",
|
|
359
359
|
)
|
|
360
360
|
|
|
361
|
+
onefile_group.add_option(
|
|
362
|
+
"--onefile-as-archive",
|
|
363
|
+
action="store_true",
|
|
364
|
+
dest="onefile_as_archive",
|
|
365
|
+
default=False,
|
|
366
|
+
help="""\
|
|
367
|
+
When creating the onefile, use an archive format, that can be unpacked
|
|
368
|
+
with "nuitka-onefile-unpack" rather than a stream that only the onefile
|
|
369
|
+
program itself unpacks. Default is off.""",
|
|
370
|
+
)
|
|
361
371
|
|
|
362
372
|
del onefile_group
|
|
363
373
|
|
|
@@ -423,8 +433,8 @@ data_group.add_option(
|
|
|
423
433
|
help="""\
|
|
424
434
|
Do not include data files matching the filename pattern given. This is against
|
|
425
435
|
the target filename, not source paths. So to ignore a file pattern from package
|
|
426
|
-
data for
|
|
427
|
-
whole directory simply use
|
|
436
|
+
data for 'package_name' should be matched as 'package_name/*.txt'. Or for the
|
|
437
|
+
whole directory simply use 'package_name'. Default empty.""",
|
|
428
438
|
)
|
|
429
439
|
|
|
430
440
|
data_group.add_option(
|
|
@@ -468,8 +478,8 @@ dll_group.add_option(
|
|
|
468
478
|
default=[],
|
|
469
479
|
help="""\
|
|
470
480
|
Do not include DLL files matching the filename pattern given. This is against
|
|
471
|
-
the target filename, not source paths. So ignore a DLL
|
|
472
|
-
the package
|
|
481
|
+
the target filename, not source paths. So ignore a DLL 'someDLL' contained in
|
|
482
|
+
the package 'package_name' it should be matched as 'package_name/someDLL.*'.
|
|
473
483
|
Default empty.""",
|
|
474
484
|
)
|
|
475
485
|
|
|
@@ -687,7 +697,7 @@ output_group.add_option(
|
|
|
687
697
|
dest="pyi_file",
|
|
688
698
|
default=True,
|
|
689
699
|
help="""\
|
|
690
|
-
Do not create a
|
|
700
|
+
Do not create a '.pyi' file for extension modules created by Nuitka. This is
|
|
691
701
|
used to detect implicit imports.
|
|
692
702
|
Defaults to off.""",
|
|
693
703
|
)
|
|
@@ -947,7 +957,7 @@ del c_compiler_group
|
|
|
947
957
|
|
|
948
958
|
caching_group = parser.add_option_group("Cache Control")
|
|
949
959
|
|
|
950
|
-
_cache_names = ("all", "ccache", "bytecode")
|
|
960
|
+
_cache_names = ("all", "ccache", "bytecode", "compression")
|
|
951
961
|
|
|
952
962
|
if isWin32Windows():
|
|
953
963
|
_cache_names += ("dll-dependencies",)
|
|
@@ -1136,7 +1146,7 @@ tracing_group.add_option(
|
|
|
1136
1146
|
metavar="REPORT_DESC",
|
|
1137
1147
|
default=[],
|
|
1138
1148
|
help="""\
|
|
1139
|
-
Report via template. Provide template and output filename
|
|
1149
|
+
Report via template. Provide template and output filename 'template.rst.j2:output.rst'. For
|
|
1140
1150
|
built-in templates, check the User Manual for what these are. Can be given multiple times.
|
|
1141
1151
|
Default is empty.""",
|
|
1142
1152
|
)
|
|
@@ -1955,8 +1965,7 @@ def _considerGithubWorkflowOptions(phase):
|
|
|
1955
1965
|
|
|
1956
1966
|
def parseOptions(logger):
|
|
1957
1967
|
# Pretty complex code, having a small options parser and many details as
|
|
1958
|
-
# well as integrating with plugins and run modes
|
|
1959
|
-
# mode executions, pylint: disable=too-many-branches,too-many-statements
|
|
1968
|
+
# well as integrating with plugins and run modes. pylint: disable=too-many-branches
|
|
1960
1969
|
|
|
1961
1970
|
# First, isolate the first non-option arguments.
|
|
1962
1971
|
extra_args = []
|
|
@@ -2027,6 +2036,19 @@ def parseOptions(logger):
|
|
|
2027
2036
|
Error, need filename argument with python module or main program."""
|
|
2028
2037
|
)
|
|
2029
2038
|
|
|
2039
|
+
if not options.immediate_execution and len(positional_args) > 1:
|
|
2040
|
+
parser.print_help()
|
|
2041
|
+
|
|
2042
|
+
logger.sysexit(
|
|
2043
|
+
"""
|
|
2044
|
+
Error, specify only one positional argument unless "--run" is specified to
|
|
2045
|
+
pass them to the compiled program execution."""
|
|
2046
|
+
)
|
|
2047
|
+
|
|
2048
|
+
return is_nuitka_run, options, positional_args, extra_args
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
def runSpecialCommandsFromOptions(options):
|
|
2030
2052
|
if options.plugin_list:
|
|
2031
2053
|
from nuitka.plugins.Plugins import listPlugins
|
|
2032
2054
|
|
|
@@ -2065,14 +2087,3 @@ Error, need filename argument with python module or main program."""
|
|
|
2065
2087
|
report_filename=os.path.expanduser(options.compilation_report_filename),
|
|
2066
2088
|
)
|
|
2067
2089
|
sys.exit(0)
|
|
2068
|
-
|
|
2069
|
-
if not options.immediate_execution and len(positional_args) > 1:
|
|
2070
|
-
parser.print_help()
|
|
2071
|
-
|
|
2072
|
-
logger.sysexit(
|
|
2073
|
-
"""
|
|
2074
|
-
Error, specify only one positional argument unless "--run" is specified to
|
|
2075
|
-
pass them to the compiled program execution."""
|
|
2076
|
-
)
|
|
2077
|
-
|
|
2078
|
-
return is_nuitka_run, options, positional_args, extra_args
|