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
|
@@ -23,7 +23,6 @@ import os
|
|
|
23
23
|
import shutil
|
|
24
24
|
import struct
|
|
25
25
|
import sys
|
|
26
|
-
import time
|
|
27
26
|
from contextlib import contextmanager
|
|
28
27
|
|
|
29
28
|
from nuitka.__past__ import to_byte
|
|
@@ -34,14 +33,19 @@ from nuitka.Progress import (
|
|
|
34
33
|
setupProgressBar,
|
|
35
34
|
)
|
|
36
35
|
from nuitka.Tracing import onefile_logger
|
|
37
|
-
from nuitka.utils.
|
|
38
|
-
from nuitka.utils.
|
|
36
|
+
from nuitka.utils.AppDirs import getCacheDir
|
|
37
|
+
from nuitka.utils.FileOperations import getFileList, getFileSize, makePath
|
|
38
|
+
from nuitka.utils.Hashing import Hash, HashCRC32
|
|
39
39
|
from nuitka.utils.Utils import (
|
|
40
40
|
decoratorRetries,
|
|
41
|
-
isPosixWindows,
|
|
42
41
|
isWin32OrPosixWindows,
|
|
43
42
|
isWin32Windows,
|
|
44
43
|
)
|
|
44
|
+
from nuitka.Version import version_string
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def getCompressorLevel(low_memory):
|
|
48
|
+
return 3 if low_memory else 22
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
def getCompressorFunction(expect_compression, low_memory):
|
|
@@ -50,7 +54,7 @@ def getCompressorFunction(expect_compression, low_memory):
|
|
|
50
54
|
if expect_compression:
|
|
51
55
|
from zstandard import ZstdCompressor # pylint: disable=I0021,import-error
|
|
52
56
|
|
|
53
|
-
compressor_context = ZstdCompressor(level=
|
|
57
|
+
compressor_context = ZstdCompressor(level=getCompressorLevel(low_memory))
|
|
54
58
|
|
|
55
59
|
@contextmanager
|
|
56
60
|
def useCompressedFile(output_file):
|
|
@@ -71,138 +75,166 @@ def getCompressorFunction(expect_compression, low_memory):
|
|
|
71
75
|
return b"X", useSameFile
|
|
72
76
|
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
def _attachOnefilePayloadFile(
|
|
79
|
+
output_file,
|
|
80
|
+
is_archive,
|
|
81
|
+
is_compressing,
|
|
82
|
+
use_compression_cache,
|
|
83
|
+
low_memory,
|
|
84
|
+
file_compressor,
|
|
85
|
+
filename_full,
|
|
86
|
+
count,
|
|
87
|
+
dist_dir,
|
|
88
|
+
filename_encoding,
|
|
89
|
+
file_checksums,
|
|
90
|
+
win_path_sep,
|
|
91
|
+
):
|
|
92
|
+
# Somewhat detail rich, at least unless we make more things mandatory, and
|
|
93
|
+
# we also need to pass all modes, since this can be run in a separate process
|
|
94
|
+
# that has no access to options.
|
|
95
|
+
# pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements
|
|
77
96
|
|
|
78
|
-
|
|
79
|
-
# and with as a context manager.
|
|
97
|
+
payload_item_size = 0
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
try:
|
|
83
|
-
with open(onefile_output_filename, "ab") as output_file:
|
|
84
|
-
if attempt != 1:
|
|
85
|
-
onefile_logger.warning(
|
|
86
|
-
"Succeeded to open binary for payload attachment in attempt %d."
|
|
87
|
-
% attempt
|
|
88
|
-
)
|
|
99
|
+
filename_relative = os.path.relpath(filename_full, dist_dir)
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
reportProgressBar(
|
|
102
|
+
item=filename_relative,
|
|
103
|
+
update=False,
|
|
104
|
+
)
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
# Might be changing from POSIX to Win32 Python on Windows.
|
|
107
|
+
if win_path_sep:
|
|
108
|
+
filename_relative = filename_relative.replace("/", "\\")
|
|
109
|
+
else:
|
|
110
|
+
filename_relative = filename_relative.replace("\\", "/")
|
|
97
111
|
|
|
98
|
-
|
|
99
|
-
onefile_logger.warning(
|
|
100
|
-
"""\
|
|
101
|
-
Failed to open binary for payload attachment in attempt %d.
|
|
102
|
-
Disable Anti-Virus, e.g. Windows Defender for build folders. Retrying after a second of delay."""
|
|
103
|
-
% attempt
|
|
104
|
-
)
|
|
105
|
-
else:
|
|
106
|
-
onefile_logger.warning(
|
|
107
|
-
"""\
|
|
108
|
-
Failed to open binary for payload attachment in attempt %d with error code %d.
|
|
109
|
-
Disable Anti-Virus, e.g. Windows Defender for build folders. Retrying after a second of delay."""
|
|
110
|
-
% (attempt, e.errno)
|
|
111
|
-
)
|
|
112
|
+
filename_encoded = (filename_relative + "\0").encode(filename_encoding)
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
output_file.write(filename_encoded)
|
|
115
|
+
payload_item_size += len(filename_encoded)
|
|
115
116
|
|
|
117
|
+
file_flags = 0
|
|
118
|
+
if not isWin32OrPosixWindows() and os.path.islink(filename_full):
|
|
119
|
+
link_target = os.readlink(filename_full)
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
file_flags |= 2
|
|
122
|
+
file_header = to_byte(file_flags)
|
|
123
|
+
|
|
124
|
+
output_file.write(file_header)
|
|
125
|
+
payload_item_size += len(file_header)
|
|
126
|
+
|
|
127
|
+
link_target_encoded = (link_target + "\0").encode(filename_encoding)
|
|
128
|
+
|
|
129
|
+
output_file.write(link_target_encoded)
|
|
130
|
+
payload_item_size += len(link_target_encoded)
|
|
131
|
+
else:
|
|
132
|
+
# This flag is only relevant for non-links.
|
|
133
|
+
if not isWin32OrPosixWindows() and os.access(filename_full, os.X_OK):
|
|
134
|
+
file_flags |= 1
|
|
135
|
+
|
|
136
|
+
with open(filename_full, "rb") as input_file:
|
|
137
|
+
input_file.seek(0, 2)
|
|
138
|
+
input_size = input_file.tell()
|
|
139
|
+
input_file.seek(0, 0)
|
|
131
140
|
|
|
132
|
-
|
|
133
|
-
compressed_file, filename_full, dist_dir, filename_encoding
|
|
134
|
-
):
|
|
135
|
-
payload_item_size = 0
|
|
141
|
+
file_header = b""
|
|
136
142
|
|
|
137
|
-
|
|
143
|
+
if not isWin32OrPosixWindows():
|
|
144
|
+
file_header += to_byte(file_flags)
|
|
138
145
|
|
|
139
|
-
|
|
140
|
-
item=filename_relative,
|
|
141
|
-
update=False,
|
|
142
|
-
)
|
|
146
|
+
file_header += struct.pack("Q", input_size)
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
if file_checksums:
|
|
149
|
+
hash_crc32 = HashCRC32()
|
|
150
|
+
hash_crc32.updateFromFileHandle(input_file)
|
|
151
|
+
input_file.seek(0, 0)
|
|
152
|
+
|
|
153
|
+
# CRC32 value 0 is avoided, used as error indicator in C code.
|
|
154
|
+
file_header += struct.pack("I", hash_crc32.asDigest() or 1)
|
|
149
155
|
|
|
150
|
-
|
|
156
|
+
if is_archive and is_compressing:
|
|
157
|
+
compression_cache_filename = _getCacheFilename(
|
|
158
|
+
binary_filename=filename_full, low_memory=low_memory
|
|
159
|
+
)
|
|
151
160
|
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
if not os.path.exists(compression_cache_filename):
|
|
162
|
+
with open(compression_cache_filename, "wb") as archive_entry_file:
|
|
163
|
+
with file_compressor(
|
|
164
|
+
archive_entry_file
|
|
165
|
+
) as compressed_file_tmp2:
|
|
166
|
+
shutil.copyfileobj(input_file, compressed_file_tmp2)
|
|
154
167
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
compressed_size = archive_entry_file.tell()
|
|
169
|
+
else:
|
|
170
|
+
compressed_size = getFileSize(compression_cache_filename)
|
|
158
171
|
|
|
159
|
-
|
|
160
|
-
file_header = to_byte(file_flags)
|
|
172
|
+
file_header += struct.pack("I", compressed_size)
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
output_file.write(file_header)
|
|
163
175
|
payload_item_size += len(file_header)
|
|
164
176
|
|
|
165
|
-
|
|
177
|
+
if is_archive and is_compressing:
|
|
178
|
+
with open(compression_cache_filename, "rb") as archive_entry_file:
|
|
179
|
+
pos1 = output_file.tell()
|
|
180
|
+
shutil.copyfileobj(archive_entry_file, output_file)
|
|
181
|
+
pos2 = output_file.tell()
|
|
182
|
+
assert pos2 - pos1 == compressed_size
|
|
166
183
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
else:
|
|
170
|
-
# This flag is only relevant for non-links.
|
|
171
|
-
if not isWin32OrPosixWindows() and os.access(filename_full, os.X_OK):
|
|
172
|
-
file_flags |= 1
|
|
184
|
+
if count == 0 or not use_compression_cache:
|
|
185
|
+
os.unlink(compression_cache_filename)
|
|
173
186
|
|
|
174
|
-
|
|
175
|
-
input_file.seek(0, 2)
|
|
176
|
-
input_size = input_file.tell()
|
|
177
|
-
input_file.seek(0, 0)
|
|
187
|
+
payload_item_size += compressed_size
|
|
178
188
|
|
|
179
|
-
|
|
189
|
+
else:
|
|
190
|
+
shutil.copyfileobj(input_file, output_file)
|
|
191
|
+
payload_item_size += input_size
|
|
180
192
|
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
reportProgressBar(
|
|
194
|
+
item=filename_relative,
|
|
195
|
+
update=True,
|
|
196
|
+
)
|
|
183
197
|
|
|
184
|
-
|
|
198
|
+
return payload_item_size
|
|
185
199
|
|
|
186
|
-
if file_checksums:
|
|
187
|
-
hash_crc32 = HashCRC32()
|
|
188
|
-
hash_crc32.updateFromFileHandle(input_file)
|
|
189
|
-
input_file.seek(0, 0)
|
|
190
200
|
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
def _getCacheFilename(binary_filename, low_memory):
|
|
202
|
+
hash_value = Hash()
|
|
193
203
|
|
|
194
|
-
|
|
195
|
-
payload_item_size += len(file_header)
|
|
204
|
+
hash_value.updateFromFile(filename=binary_filename)
|
|
196
205
|
|
|
197
|
-
|
|
198
|
-
|
|
206
|
+
# Have different values for different Python major versions.
|
|
207
|
+
hash_value.updateFromValues(sys.version, sys.executable)
|
|
199
208
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
update=True,
|
|
203
|
-
)
|
|
209
|
+
# Take Nuitka version into account as well, ought to catch code changes.
|
|
210
|
+
hash_value.updateFromValues(version_string)
|
|
204
211
|
|
|
205
|
-
|
|
212
|
+
# Take zstandard version and compression level into account.
|
|
213
|
+
from zstandard import __version__
|
|
214
|
+
|
|
215
|
+
hash_value.updateFromValues(__version__, getCompressorLevel(low_memory))
|
|
216
|
+
|
|
217
|
+
cache_dir = os.path.join(getCacheDir(), "onefile-compression")
|
|
218
|
+
makePath(cache_dir)
|
|
219
|
+
|
|
220
|
+
return os.path.join(cache_dir, hash_value.asHexDigest())
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def attachOnefilePayload(
|
|
224
|
+
dist_dir,
|
|
225
|
+
onefile_output_filename,
|
|
226
|
+
start_binary,
|
|
227
|
+
expect_compression,
|
|
228
|
+
as_archive,
|
|
229
|
+
use_compression_cache,
|
|
230
|
+
file_checksums,
|
|
231
|
+
win_path_sep,
|
|
232
|
+
low_memory,
|
|
233
|
+
):
|
|
234
|
+
compression_indicator, compressor = getCompressorFunction(
|
|
235
|
+
expect_compression=expect_compression,
|
|
236
|
+
low_memory=low_memory,
|
|
237
|
+
)
|
|
206
238
|
|
|
207
239
|
@decoratorRetries(
|
|
208
240
|
logger=onefile_logger,
|
|
@@ -235,13 +267,39 @@ def attachOnefilePayload(
|
|
|
235
267
|
total=len(file_list),
|
|
236
268
|
)
|
|
237
269
|
|
|
238
|
-
|
|
239
|
-
|
|
270
|
+
# Abstract the differences here for the time being.
|
|
271
|
+
if as_archive:
|
|
272
|
+
# Fake compressor then
|
|
273
|
+
@contextmanager
|
|
274
|
+
def overall_compressor(f):
|
|
275
|
+
yield f
|
|
276
|
+
|
|
277
|
+
file_compressor = compressor
|
|
278
|
+
is_archive = True
|
|
279
|
+
else:
|
|
280
|
+
overall_compressor = compressor
|
|
281
|
+
|
|
282
|
+
@contextmanager
|
|
283
|
+
def file_compressor(f):
|
|
284
|
+
yield f
|
|
285
|
+
|
|
286
|
+
is_archive = False
|
|
287
|
+
|
|
288
|
+
with overall_compressor(output_file) as compressed_file:
|
|
289
|
+
for count, filename_full in enumerate(file_list, start=1):
|
|
240
290
|
payload_size += _attachOnefilePayloadFile(
|
|
241
|
-
|
|
291
|
+
output_file=compressed_file,
|
|
292
|
+
is_archive=is_archive,
|
|
293
|
+
file_compressor=file_compressor,
|
|
294
|
+
is_compressing=compression_indicator == b"Y",
|
|
295
|
+
use_compression_cache=use_compression_cache,
|
|
296
|
+
low_memory=low_memory,
|
|
242
297
|
filename_full=filename_full,
|
|
298
|
+
count=count,
|
|
243
299
|
dist_dir=dist_dir,
|
|
244
300
|
filename_encoding=filename_encoding,
|
|
301
|
+
file_checksums=file_checksums,
|
|
302
|
+
win_path_sep=win_path_sep,
|
|
245
303
|
)
|
|
246
304
|
|
|
247
305
|
# Using empty filename as a terminator.
|
|
@@ -261,6 +319,7 @@ def attachOnefilePayload(
|
|
|
261
319
|
)
|
|
262
320
|
)
|
|
263
321
|
|
|
322
|
+
# TODO: If put into a resource, this is not really needed anymore.
|
|
264
323
|
if isWin32Windows():
|
|
265
324
|
# add padding to have the start position at a double world boundary
|
|
266
325
|
# this is needed on windows so that a possible certificate immediately
|
|
@@ -290,6 +349,8 @@ def main():
|
|
|
290
349
|
file_checksums = sys.argv[4] == "True"
|
|
291
350
|
win_path_sep = sys.argv[5] == "True"
|
|
292
351
|
low_memory = sys.argv[6] == "True"
|
|
352
|
+
as_archive = sys.argv[7] == "True"
|
|
353
|
+
use_compression_cache = sys.argv[8] == "True"
|
|
293
354
|
|
|
294
355
|
if os.environ.get("NUITKA_PROGRESS_BAR") == "1":
|
|
295
356
|
enableProgressBar()
|
|
@@ -300,6 +361,8 @@ def main():
|
|
|
300
361
|
start_binary=start_binary,
|
|
301
362
|
# We wouldn't be here, if that was not the case.
|
|
302
363
|
expect_compression=True,
|
|
364
|
+
as_archive=as_archive,
|
|
365
|
+
use_compression_cache=use_compression_cache,
|
|
303
366
|
file_checksums=file_checksums,
|
|
304
367
|
win_path_sep=win_path_sep,
|
|
305
368
|
low_memory=low_memory,
|
nuitka/tools/podman/__main__.py
CHANGED
|
@@ -90,6 +90,15 @@ Podman binary in case you do not have it in your path.
|
|
|
90
90
|
""",
|
|
91
91
|
)
|
|
92
92
|
|
|
93
|
+
parser.add_option(
|
|
94
|
+
"--podman-verbose",
|
|
95
|
+
action="store_false",
|
|
96
|
+
dest="quiet",
|
|
97
|
+
default=True,
|
|
98
|
+
help="""
|
|
99
|
+
Dot not use podman quietly, giving more messages during build.""",
|
|
100
|
+
)
|
|
101
|
+
|
|
93
102
|
parser.add_option(
|
|
94
103
|
"--shared-path",
|
|
95
104
|
action="append",
|
|
@@ -159,7 +168,7 @@ def isPodman(podman_path):
|
|
|
159
168
|
return "podman" in os.path.normcase(os.path.basename(podman_path))
|
|
160
169
|
|
|
161
170
|
|
|
162
|
-
def updateContainer(podman_path, container_tag_name, container_file_path):
|
|
171
|
+
def updateContainer(podman_path, container_tag_name, container_file_path, quiet):
|
|
163
172
|
requirements_file = os.path.join(
|
|
164
173
|
os.path.dirname(__file__), "..", "..", "..", "requirements-devel.txt"
|
|
165
174
|
)
|
|
@@ -182,13 +191,15 @@ def updateContainer(podman_path, container_tag_name, container_file_path):
|
|
|
182
191
|
podman_path,
|
|
183
192
|
"build",
|
|
184
193
|
# Tolerate errors checking for image download, and use old one
|
|
185
|
-
"--quiet",
|
|
186
194
|
"--tag",
|
|
187
195
|
container_tag_name,
|
|
188
196
|
"-f",
|
|
189
197
|
container_file_path,
|
|
190
198
|
]
|
|
191
199
|
|
|
200
|
+
if quiet:
|
|
201
|
+
command.append("--quiet")
|
|
202
|
+
|
|
192
203
|
if isPodman(podman_path):
|
|
193
204
|
# Podman only.
|
|
194
205
|
command.append("--pull=newer")
|
|
@@ -295,6 +306,9 @@ def _checkContainerArgument(options, default_container_directory):
|
|
|
295
306
|
def main():
|
|
296
307
|
options = parseOptions()
|
|
297
308
|
|
|
309
|
+
if options.command is None:
|
|
310
|
+
options.command = "python3 -m nuitka --version"
|
|
311
|
+
|
|
298
312
|
containers_logger.info(
|
|
299
313
|
"Running in container '%s' this command: %s"
|
|
300
314
|
% (options.container_id, options.command)
|
|
@@ -342,6 +356,7 @@ def main():
|
|
|
342
356
|
podman_path=options.podman_path,
|
|
343
357
|
container_tag_name=container_tag_name,
|
|
344
358
|
container_file_path=container_file_path,
|
|
359
|
+
quiet=options.quiet,
|
|
345
360
|
)
|
|
346
361
|
|
|
347
362
|
command = [options.podman_path, "run"]
|
|
@@ -32,6 +32,16 @@ from nuitka.utils.FileOperations import listDllFilesFromDirectory, relpath
|
|
|
32
32
|
from nuitka.utils.Importing import getSharedLibrarySuffixes
|
|
33
33
|
from nuitka.utils.ModuleNames import ModuleName
|
|
34
34
|
from nuitka.utils.SharedLibraries import getDllExportedSymbols
|
|
35
|
+
from nuitka.utils.Utils import isMacOS
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def getPythonEntryPointExportedSymbolName(module_name):
|
|
39
|
+
result = "%s%s" % ("init" if str is bytes else "PyInit_", module_name.asString())
|
|
40
|
+
|
|
41
|
+
if isMacOS():
|
|
42
|
+
result = "_" + result
|
|
43
|
+
|
|
44
|
+
return result
|
|
35
45
|
|
|
36
46
|
|
|
37
47
|
def isExtensionModule(module_filename):
|
|
@@ -47,8 +57,7 @@ def isExtensionModule(module_filename):
|
|
|
47
57
|
return None
|
|
48
58
|
|
|
49
59
|
return (
|
|
50
|
-
|
|
51
|
-
in exported_symbols
|
|
60
|
+
getPythonEntryPointExportedSymbolName(module_name) in exported_symbols
|
|
52
61
|
)
|
|
53
62
|
|
|
54
63
|
return False
|
|
@@ -47,7 +47,7 @@ def displayPackageData(module_name):
|
|
|
47
47
|
|
|
48
48
|
if not os.path.isdir(package_directory):
|
|
49
49
|
tools_logger.sysexit(
|
|
50
|
-
"Error, doesn't seem that '%s' is a package on disk."
|
|
50
|
+
"Error, doesn't seem that '%s' is a package on disk but rather a plain module."
|
|
51
51
|
% module_name.asString()
|
|
52
52
|
)
|
|
53
53
|
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
import math
|
|
23
23
|
from abc import abstractmethod
|
|
24
24
|
|
|
25
|
-
from nuitka.__past__ import
|
|
25
|
+
from nuitka.__past__ import long
|
|
26
26
|
from nuitka.code_generation.Namify import namifyConstant
|
|
27
|
+
from nuitka.utils.SlotMetaClasses import getMetaClassBase
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
class TypeDescBase(getMetaClassBase("Type")):
|
|
30
|
+
class TypeDescBase(getMetaClassBase("Type", require_slots=False)):
|
|
30
31
|
# To be overloaded
|
|
31
32
|
type_name = None
|
|
32
33
|
type_desc = None
|
|
@@ -350,7 +351,7 @@ class TypeDescBase(getMetaClassBase("Type")):
|
|
|
350
351
|
)
|
|
351
352
|
elif slot == "tp_richcompare":
|
|
352
353
|
# Try to detect fallbacks, this needs version specific management
|
|
353
|
-
# for at least "LONG", maybe others.
|
|
354
|
+
# for at least "LONG", maybe others. spell-checker: ignore RICHCOMPARE
|
|
354
355
|
|
|
355
356
|
assert self is object_desc, self
|
|
356
357
|
return "RICHCOMPARE(%s)" % operand
|
|
@@ -461,22 +462,26 @@ return %(return_value)s;""" % {
|
|
|
461
462
|
def hasSameTypeOperationSpecializationCode(self, other, nb_slot, sq_slot):
|
|
462
463
|
# Many cases, pylint: disable=too-many-branches,too-many-return-statements
|
|
463
464
|
|
|
464
|
-
|
|
465
|
+
candidate = self if self is not object_desc else other
|
|
465
466
|
|
|
466
467
|
# Both are objects, nothing to be done.
|
|
467
|
-
if
|
|
468
|
+
if candidate is object_desc:
|
|
468
469
|
assert self is object_desc
|
|
469
470
|
assert other is object_desc
|
|
470
471
|
return False
|
|
471
472
|
|
|
472
|
-
# Special case for sequence
|
|
473
|
-
if
|
|
473
|
+
# Special case for sequence concat/repeats.
|
|
474
|
+
if (
|
|
475
|
+
sq_slot is not None
|
|
476
|
+
and not candidate.hasSlot(nb_slot)
|
|
477
|
+
and candidate.hasSlot(sq_slot)
|
|
478
|
+
):
|
|
474
479
|
slot = sq_slot
|
|
475
480
|
else:
|
|
476
481
|
slot = nb_slot
|
|
477
482
|
|
|
478
483
|
if slot == "sq_repeat":
|
|
479
|
-
if
|
|
484
|
+
if candidate in (
|
|
480
485
|
list_desc,
|
|
481
486
|
tuple_desc,
|
|
482
487
|
set_desc,
|
|
@@ -489,12 +494,12 @@ return %(return_value)s;""" % {
|
|
|
489
494
|
return False
|
|
490
495
|
|
|
491
496
|
if slot == "nb_remainder":
|
|
492
|
-
if
|
|
497
|
+
if candidate in (list_desc, tuple_desc, set_desc, dict_desc):
|
|
493
498
|
# No remainder with themselves.
|
|
494
499
|
return False
|
|
495
500
|
|
|
496
501
|
if slot == "nb_multiply":
|
|
497
|
-
if
|
|
502
|
+
if candidate in (
|
|
498
503
|
str_desc,
|
|
499
504
|
bytes_desc,
|
|
500
505
|
list_desc,
|
|
@@ -508,7 +513,7 @@ return %(return_value)s;""" % {
|
|
|
508
513
|
if slot == "nb_add":
|
|
509
514
|
# Tuple and list, etc. use sq_concat.
|
|
510
515
|
# TODO: What about unicode_desc
|
|
511
|
-
if
|
|
516
|
+
if candidate in (
|
|
512
517
|
str_desc,
|
|
513
518
|
bytes_desc,
|
|
514
519
|
tuple_desc,
|
|
@@ -520,7 +525,7 @@ return %(return_value)s;""" % {
|
|
|
520
525
|
return False
|
|
521
526
|
|
|
522
527
|
if slot in ("nb_and", "nb_or", "nb_xor"):
|
|
523
|
-
if
|
|
528
|
+
if candidate in (
|
|
524
529
|
str_desc,
|
|
525
530
|
bytes_desc,
|
|
526
531
|
unicode_desc,
|
|
@@ -532,7 +537,7 @@ return %(return_value)s;""" % {
|
|
|
532
537
|
return False
|
|
533
538
|
|
|
534
539
|
if slot in ("nb_lshift", "nb_rshift"):
|
|
535
|
-
if
|
|
540
|
+
if candidate in (
|
|
536
541
|
str_desc,
|
|
537
542
|
bytes_desc,
|
|
538
543
|
unicode_desc,
|
|
@@ -588,26 +593,29 @@ return %(return_value)s;""" % {
|
|
|
588
593
|
def getTypeComparisonSpecializationHelper(
|
|
589
594
|
self, other, op_code, target, operand1, operand2
|
|
590
595
|
):
|
|
591
|
-
|
|
592
|
-
|
|
596
|
+
candidate1 = self if self is not object_desc else other
|
|
597
|
+
candidate2 = other if other is not object_desc else self
|
|
593
598
|
|
|
594
|
-
if
|
|
599
|
+
if candidate1 is object_desc:
|
|
595
600
|
return "", None, None, None, None, None
|
|
596
601
|
|
|
597
|
-
if long_desc in (
|
|
598
|
-
|
|
602
|
+
if long_desc in (candidate1, candidate2) and int_desc in (
|
|
603
|
+
candidate1,
|
|
604
|
+
candidate2,
|
|
605
|
+
):
|
|
606
|
+
if candidate1 == int_desc:
|
|
599
607
|
operand1 = int_desc.getAsLongValueExpression(operand1)
|
|
600
|
-
|
|
601
|
-
elif
|
|
608
|
+
candidate1 = c_long_desc
|
|
609
|
+
elif candidate2 == int_desc:
|
|
602
610
|
operand2 = int_desc.getAsLongValueExpression(operand1)
|
|
603
|
-
|
|
611
|
+
candidate2 = c_long_desc
|
|
604
612
|
else:
|
|
605
613
|
assert False
|
|
606
614
|
|
|
607
615
|
if (
|
|
608
616
|
target is n_bool_desc
|
|
609
|
-
and
|
|
610
|
-
and
|
|
617
|
+
and candidate1 is candidate2
|
|
618
|
+
and candidate1 not in (tuple_desc, list_desc)
|
|
611
619
|
):
|
|
612
620
|
target = c_bool_desc
|
|
613
621
|
|
|
@@ -616,12 +624,12 @@ return %(return_value)s;""" % {
|
|
|
616
624
|
% (
|
|
617
625
|
op_code,
|
|
618
626
|
target.getHelperCodeName(),
|
|
619
|
-
|
|
620
|
-
|
|
627
|
+
candidate1.getHelperCodeName(),
|
|
628
|
+
candidate2.getHelperCodeName(),
|
|
621
629
|
),
|
|
622
630
|
target,
|
|
623
|
-
|
|
624
|
-
|
|
631
|
+
candidate1,
|
|
632
|
+
candidate2,
|
|
625
633
|
operand1,
|
|
626
634
|
operand2,
|
|
627
635
|
)
|
|
@@ -1518,6 +1526,7 @@ class CLongDesc(ConcreteCTypeBase):
|
|
|
1518
1526
|
|
|
1519
1527
|
@staticmethod
|
|
1520
1528
|
def getLongValueMediumValueExpression(operand):
|
|
1529
|
+
# spell-checker: disable=sdigit
|
|
1521
1530
|
return "(sdigit)%s" % (operand)
|
|
1522
1531
|
|
|
1523
1532
|
|
|
@@ -52,7 +52,7 @@ from nuitka.code_generation.ComparisonHelperDefinitions import (
|
|
|
52
52
|
getSpecializedComparisonOperations,
|
|
53
53
|
)
|
|
54
54
|
from nuitka.code_generation.ImportCodes import getImportModuleHardCodeName
|
|
55
|
-
from nuitka.
|
|
55
|
+
from nuitka.HardImportRegistry import (
|
|
56
56
|
hard_modules,
|
|
57
57
|
hard_modules_non_stdlib,
|
|
58
58
|
hard_modules_version,
|
|
@@ -475,6 +475,9 @@ def getCallModuleName(module_name, function_name):
|
|
|
475
475
|
return "OsSysNodes"
|
|
476
476
|
if module_name == "ctypes":
|
|
477
477
|
return "CtypesNodes"
|
|
478
|
+
if module_name == "builtins":
|
|
479
|
+
if function_name == "open":
|
|
480
|
+
return "BuiltinOpenNodes"
|
|
478
481
|
|
|
479
482
|
assert False, (module_name, function_name)
|
|
480
483
|
|
|
@@ -729,6 +732,9 @@ def addFromNodes():
|
|
|
729
732
|
node_factory_translations[
|
|
730
733
|
"ExpressionImportlibMetadataBackportMetadataCall"
|
|
731
734
|
] = "makeExpressionImportlibMetadataBackportMetadataCall"
|
|
735
|
+
node_factory_translations[
|
|
736
|
+
"ExpressionBuiltinsOpenCall"
|
|
737
|
+
] = "makeExpressionBuiltinsOpenCall"
|
|
732
738
|
|
|
733
739
|
|
|
734
740
|
addFromNodes()
|
|
@@ -1068,6 +1074,16 @@ hard_import_node_classes = {}
|
|
|
1068
1074
|
function_name_title=function_name_title,
|
|
1069
1075
|
function_name_code=makeCodeCased(function_name),
|
|
1070
1076
|
module_name=module_name,
|
|
1077
|
+
is_stdlib_module=module_name
|
|
1078
|
+
in (
|
|
1079
|
+
"builtins",
|
|
1080
|
+
"os",
|
|
1081
|
+
"os.path",
|
|
1082
|
+
"pkgutil",
|
|
1083
|
+
"ctypes",
|
|
1084
|
+
"importlib.metadata",
|
|
1085
|
+
"importlib.resources",
|
|
1086
|
+
),
|
|
1071
1087
|
module_name_code=makeCodeCased(adaptModuleName(module_name)),
|
|
1072
1088
|
module_name_title=module_name_title,
|
|
1073
1089
|
call_node_module_name=getCallModuleName(module_name, function_name),
|