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.
Files changed (214) hide show
  1. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
  3. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
  4. nuitka/BytecodeCaching.py +4 -1
  5. nuitka/HardImportRegistry.py +348 -0
  6. nuitka/MainControl.py +45 -25
  7. nuitka/OptionParsing.py +31 -20
  8. nuitka/Options.py +47 -16
  9. nuitka/Progress.py +32 -2
  10. nuitka/PythonFlavors.py +1 -1
  11. nuitka/PythonVersions.py +61 -0
  12. nuitka/Tracing.py +25 -12
  13. nuitka/TreeXML.py +5 -5
  14. nuitka/Variables.py +15 -24
  15. nuitka/Version.py +16 -6
  16. nuitka/__main__.py +15 -0
  17. nuitka/__past__.py +15 -17
  18. nuitka/build/Backend.scons +44 -35
  19. nuitka/build/CCompilerVersion.scons +10 -9
  20. nuitka/build/Onefile.scons +11 -26
  21. nuitka/build/SconsCaching.py +2 -0
  22. nuitka/build/SconsCompilerSettings.py +72 -22
  23. nuitka/build/SconsHacks.py +1 -0
  24. nuitka/build/SconsInterface.py +5 -0
  25. nuitka/build/SconsSpawn.py +16 -3
  26. nuitka/build/SconsUtils.py +11 -12
  27. nuitka/build/include/nuitka/checksum_tools.h +0 -4
  28. nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
  29. nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
  30. nuitka/build/include/nuitka/compiled_frame.h +7 -4
  31. nuitka/build/include/nuitka/compiled_function.h +13 -3
  32. nuitka/build/include/nuitka/compiled_generator.h +1 -1
  33. nuitka/build/include/nuitka/constants.h +2 -0
  34. nuitka/build/include/nuitka/environment_variables.h +45 -0
  35. nuitka/build/include/nuitka/exceptions.h +32 -4
  36. nuitka/build/include/nuitka/filesystem_paths.h +6 -1
  37. nuitka/build/include/nuitka/freelists.h +11 -1
  38. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  39. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  40. nuitka/build/include/nuitka/helpers.h +2 -0
  41. nuitka/build/include/nuitka/importing.h +3 -0
  42. nuitka/build/include/nuitka/prelude.h +17 -6
  43. nuitka/build/include/nuitka/unfreezing.h +1 -1
  44. nuitka/build/inline_copy/bin/scons.py +14 -0
  45. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
  46. nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
  47. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  48. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  49. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  50. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  51. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  52. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  53. nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
  54. nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
  55. nuitka/build/static_src/CompiledCoroutineType.c +60 -51
  56. nuitka/build/static_src/CompiledFrameType.c +12 -12
  57. nuitka/build/static_src/CompiledFunctionType.c +149 -28
  58. nuitka/build/static_src/CompiledGeneratorType.c +64 -65
  59. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
  60. nuitka/build/static_src/CompiledMethodType.c +5 -3
  61. nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
  62. nuitka/build/static_src/HelpersAttributes.c +1 -1
  63. nuitka/build/static_src/HelpersBuiltin.c +1 -1
  64. nuitka/build/static_src/HelpersChecksumTools.c +19 -4
  65. nuitka/build/static_src/HelpersComparisonEq.c +4 -4
  66. nuitka/build/static_src/HelpersComparisonNe.c +4 -4
  67. nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
  68. nuitka/build/static_src/HelpersDictionaries.c +3 -1
  69. nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
  70. nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
  71. nuitka/build/static_src/HelpersImport.c +29 -1
  72. nuitka/build/static_src/HelpersImportHard.c +19 -0
  73. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
  74. nuitka/build/static_src/HelpersPythonPgo.c +5 -5
  75. nuitka/build/static_src/HelpersSafeStrings.c +2 -1
  76. nuitka/build/static_src/HelpersStrings.c +12 -10
  77. nuitka/build/static_src/HelpersTypes.c +1 -1
  78. nuitka/build/static_src/InspectPatcher.c +3 -2
  79. nuitka/build/static_src/MainProgram.c +182 -214
  80. nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
  81. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
  82. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
  83. nuitka/build/static_src/OnefileBootstrap.c +124 -93
  84. nuitka/code_generation/CodeGeneration.py +4 -2
  85. nuitka/code_generation/CodeObjectCodes.py +5 -1
  86. nuitka/code_generation/ConstantCodes.py +4 -0
  87. nuitka/code_generation/Contexts.py +111 -3
  88. nuitka/code_generation/DictCodes.py +5 -5
  89. nuitka/code_generation/FunctionCodes.py +4 -2
  90. nuitka/code_generation/GlobalConstants.py +10 -0
  91. nuitka/code_generation/ImportCodes.py +69 -33
  92. nuitka/code_generation/ModuleCodes.py +4 -1
  93. nuitka/code_generation/Namify.py +6 -5
  94. nuitka/code_generation/YieldCodes.py +3 -3
  95. nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
  96. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
  97. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
  98. nuitka/distutils/DistutilCommands.py +3 -0
  99. nuitka/finalizations/FinalizeMarkups.py +1 -1
  100. nuitka/freezer/DependsExe.py +2 -1
  101. nuitka/freezer/DllDependenciesPosix.py +11 -1
  102. nuitka/freezer/IncludedEntryPoints.py +54 -16
  103. nuitka/freezer/Onefile.py +7 -3
  104. nuitka/freezer/Standalone.py +39 -17
  105. nuitka/importing/Importing.py +195 -62
  106. nuitka/importing/PreloadedPackages.py +2 -1
  107. nuitka/importing/Recursion.py +98 -27
  108. nuitka/importing/StandardLibrary.py +7 -4
  109. nuitka/nodes/BuiltinOpenNodes.py +28 -1
  110. nuitka/nodes/BuiltinRangeNodes.py +2 -2
  111. nuitka/nodes/BuiltinSumNodes.py +1 -1
  112. nuitka/nodes/ChildrenHavingMixins.py +326 -2
  113. nuitka/nodes/HardImportNodesGenerated.py +141 -38
  114. nuitka/nodes/ImportHardNodes.py +0 -8
  115. nuitka/nodes/ImportNodes.py +267 -361
  116. nuitka/nodes/IterationHandles.py +36 -17
  117. nuitka/nodes/LocalsScopes.py +3 -1
  118. nuitka/nodes/NodeBases.py +8 -14
  119. nuitka/nodes/OperatorNodes.py +9 -9
  120. nuitka/nodes/OutlineNodes.py +3 -3
  121. nuitka/nodes/PackageMetadataNodes.py +19 -9
  122. nuitka/nodes/SliceNodes.py +1 -1
  123. nuitka/nodes/VariableAssignNodes.py +25 -15
  124. nuitka/nodes/VariableRefNodes.py +7 -7
  125. nuitka/nodes/YieldNodes.py +2 -2
  126. nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
  127. nuitka/nodes/shapes/ShapeMixins.py +21 -0
  128. nuitka/nodes/shapes/StandardShapes.py +9 -3
  129. nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
  130. nuitka/optimizations/TraceCollections.py +75 -0
  131. nuitka/pgo/PGO.py +14 -6
  132. nuitka/plugins/PluginBase.py +83 -11
  133. nuitka/plugins/Plugins.py +78 -35
  134. nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
  135. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
  136. nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
  137. nuitka/plugins/standard/DillPlugin.py +3 -99
  138. nuitka/plugins/standard/DllFilesPlugin.py +45 -0
  139. nuitka/plugins/standard/GiPlugin.py +23 -10
  140. nuitka/plugins/standard/GlfwPlugin.py +1 -0
  141. nuitka/plugins/standard/ImplicitImports.py +267 -15
  142. nuitka/plugins/standard/KivyPlugin.py +1 -0
  143. nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
  144. nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
  145. nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
  146. nuitka/plugins/standard/PmwPlugin.py +1 -1
  147. nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
  148. nuitka/plugins/standard/TkinterPlugin.py +44 -30
  149. nuitka/plugins/standard/TransformersPlugin.py +3 -1
  150. nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
  151. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
  152. nuitka/reports/CompilationReportReader.py +53 -0
  153. nuitka/reports/LicenseReport.rst.j2 +4 -4
  154. nuitka/reports/Reports.py +129 -47
  155. nuitka/specs/HardImportSpecs.py +6 -0
  156. nuitka/tools/data_composer/DataComposer.py +29 -17
  157. nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
  158. nuitka/tools/podman/__main__.py +17 -2
  159. nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
  160. nuitka/tools/scanning/DisplayPackageData.py +1 -1
  161. nuitka/tools/specialize/CTypeDescriptions.py +36 -27
  162. nuitka/tools/specialize/SpecializeC.py +1 -1
  163. nuitka/tools/specialize/SpecializePython.py +16 -0
  164. nuitka/tools/testing/Common.py +3 -4
  165. nuitka/tools/testing/OutputComparison.py +23 -0
  166. nuitka/tools/testing/SearchModes.py +2 -2
  167. nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
  168. nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
  169. nuitka/tools/watch/__main__.py +194 -56
  170. nuitka/tree/Building.py +8 -2
  171. nuitka/tree/ComplexCallHelperFunctions.py +45 -15
  172. nuitka/tree/ReformulationAssignmentStatements.py +18 -12
  173. nuitka/tree/ReformulationCallExpressions.py +1 -1
  174. nuitka/tree/ReformulationClasses.py +11 -5
  175. nuitka/tree/ReformulationClasses3.py +30 -12
  176. nuitka/tree/ReformulationComparisonExpressions.py +4 -2
  177. nuitka/tree/ReformulationContractionExpressions.py +19 -11
  178. nuitka/tree/ReformulationDictionaryCreation.py +9 -3
  179. nuitka/tree/ReformulationExecStatements.py +6 -6
  180. nuitka/tree/ReformulationForLoopStatements.py +5 -5
  181. nuitka/tree/ReformulationFunctionStatements.py +6 -2
  182. nuitka/tree/ReformulationImportStatements.py +7 -2
  183. nuitka/tree/ReformulationLambdaExpressions.py +1 -1
  184. nuitka/tree/ReformulationMatchStatements.py +3 -1
  185. nuitka/tree/ReformulationNamespacePackages.py +7 -3
  186. nuitka/tree/ReformulationPrintStatements.py +1 -1
  187. nuitka/tree/ReformulationSequenceCreation.py +18 -6
  188. nuitka/tree/ReformulationWithStatements.py +8 -8
  189. nuitka/tree/ReformulationYieldExpressions.py +2 -2
  190. nuitka/tree/SourceHandling.py +27 -5
  191. nuitka/tree/VariableClosure.py +11 -1
  192. nuitka/utils/AppDirs.py +2 -2
  193. nuitka/utils/CStrings.py +39 -3
  194. nuitka/utils/CommandLineOptions.py +42 -1
  195. nuitka/utils/Distributions.py +305 -38
  196. nuitka/utils/Download.py +27 -8
  197. nuitka/utils/FileOperations.py +103 -20
  198. nuitka/utils/Hashing.py +2 -3
  199. nuitka/utils/Importing.py +60 -3
  200. nuitka/utils/InstalledPythons.py +31 -36
  201. nuitka/utils/Jinja2.py +11 -5
  202. nuitka/utils/ModuleNames.py +11 -3
  203. nuitka/utils/ReExecute.py +7 -0
  204. nuitka/utils/SharedLibraries.py +38 -14
  205. nuitka/utils/SlotMetaClasses.py +55 -0
  206. nuitka/utils/Utils.py +10 -0
  207. nuitka/utils/Yaml.py +9 -1
  208. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
  209. nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
  210. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
  211. {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
  212. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
  213. {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
  214. {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.FileOperations import getFileList
38
- from nuitka.utils.Hashing import HashCRC32
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=3 if low_memory else 22)
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
- @contextmanager
75
- def _openBinaryFileForAppending(onefile_output_filename):
76
- max_attempts = 5
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
- # TODO: This is code duplication with resource handling, should be unified
79
- # and with as a context manager.
97
+ payload_item_size = 0
80
98
 
81
- for attempt in range(1, max_attempts + 1):
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
- yield output_file
101
+ reportProgressBar(
102
+ item=filename_relative,
103
+ update=False,
104
+ )
91
105
 
92
- return
93
- except OSError as e:
94
- # Only for Windows at this time, other platforms don't have the issue.
95
- if not isWin32Windows() and not isPosixWindows():
96
- raise
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
- if e.errno in (110, 13):
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
- time.sleep(1)
114
- continue
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
- def attachOnefilePayload(
118
- dist_dir,
119
- onefile_output_filename,
120
- start_binary,
121
- expect_compression,
122
- file_checksums,
123
- win_path_sep,
124
- low_memory,
125
- ):
126
- # Somewhat detail rich, pylint: disable=too-many-statements
127
- compression_indicator, compressor = getCompressorFunction(
128
- expect_compression=expect_compression,
129
- low_memory=low_memory,
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
- def _attachOnefilePayloadFile(
133
- compressed_file, filename_full, dist_dir, filename_encoding
134
- ):
135
- payload_item_size = 0
141
+ file_header = b""
136
142
 
137
- filename_relative = os.path.relpath(filename_full, dist_dir)
143
+ if not isWin32OrPosixWindows():
144
+ file_header += to_byte(file_flags)
138
145
 
139
- reportProgressBar(
140
- item=filename_relative,
141
- update=False,
142
- )
146
+ file_header += struct.pack("Q", input_size)
143
147
 
144
- # Might be changing from POSIX to Win32 Python on Windows.
145
- if win_path_sep:
146
- filename_relative = filename_relative.replace("/", "\\")
147
- else:
148
- filename_relative = filename_relative.replace("\\", "/")
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
- filename_encoded = (filename_relative + "\0").encode(filename_encoding)
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
- compressed_file.write(filename_encoded)
153
- payload_item_size += len(filename_encoded)
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
- file_flags = 0
156
- if not isWin32OrPosixWindows() and os.path.islink(filename_full):
157
- link_target = os.readlink(filename_full)
168
+ compressed_size = archive_entry_file.tell()
169
+ else:
170
+ compressed_size = getFileSize(compression_cache_filename)
158
171
 
159
- file_flags |= 2
160
- file_header = to_byte(file_flags)
172
+ file_header += struct.pack("I", compressed_size)
161
173
 
162
- compressed_file.write(file_header)
174
+ output_file.write(file_header)
163
175
  payload_item_size += len(file_header)
164
176
 
165
- link_target_encoded = (link_target + "\0").encode(filename_encoding)
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
- compressed_file.write(link_target_encoded)
168
- payload_item_size += len(link_target_encoded)
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
- with open(filename_full, "rb") as input_file:
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
- file_header = b""
189
+ else:
190
+ shutil.copyfileobj(input_file, output_file)
191
+ payload_item_size += input_size
180
192
 
181
- if not isWin32OrPosixWindows():
182
- file_header += to_byte(file_flags)
193
+ reportProgressBar(
194
+ item=filename_relative,
195
+ update=True,
196
+ )
183
197
 
184
- file_header += struct.pack("Q", input_size)
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
- # CRC32 value 0 is avoided, used as error indicator in C code.
192
- file_header += struct.pack("I", hash_crc32.asDigest() or 1)
201
+ def _getCacheFilename(binary_filename, low_memory):
202
+ hash_value = Hash()
193
203
 
194
- compressed_file.write(file_header)
195
- payload_item_size += len(file_header)
204
+ hash_value.updateFromFile(filename=binary_filename)
196
205
 
197
- shutil.copyfileobj(input_file, compressed_file)
198
- payload_item_size += input_size
206
+ # Have different values for different Python major versions.
207
+ hash_value.updateFromValues(sys.version, sys.executable)
199
208
 
200
- reportProgressBar(
201
- item=filename_relative,
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
- return payload_item_size
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
- with compressor(output_file) as compressed_file:
239
- for filename_full in file_list:
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
- compressed_file=compressed_file,
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,
@@ -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
- "%s%s" % ("init" if str is bytes else "PyInit_", module_name.asString())
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 getMetaClassBase, long
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
- cand = self if self is not object_desc else other
465
+ candidate = self if self is not object_desc else other
465
466
 
466
467
  # Both are objects, nothing to be done.
467
- if cand is object_desc:
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 concats/repeats.
473
- if sq_slot is not None and not cand.hasSlot(nb_slot) and cand.hasSlot(sq_slot):
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 cand in (
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 cand in (list_desc, tuple_desc, set_desc, dict_desc):
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 cand in (
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 cand in (
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 cand in (
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 cand in (
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
- cand1 = self if self is not object_desc else other
592
- cand2 = other if other is not object_desc else self
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 cand1 is object_desc:
599
+ if candidate1 is object_desc:
595
600
  return "", None, None, None, None, None
596
601
 
597
- if long_desc in (cand1, cand2) and int_desc in (cand1, cand2):
598
- if cand1 == int_desc:
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
- cand1 = c_long_desc
601
- elif cand2 == int_desc:
608
+ candidate1 = c_long_desc
609
+ elif candidate2 == int_desc:
602
610
  operand2 = int_desc.getAsLongValueExpression(operand1)
603
- cand2 = c_long_desc
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 cand1 is cand2
610
- and cand1 not in (tuple_desc, list_desc)
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
- cand1.getHelperCodeName(),
620
- cand2.getHelperCodeName(),
627
+ candidate1.getHelperCodeName(),
628
+ candidate2.getHelperCodeName(),
621
629
  ),
622
630
  target,
623
- cand1,
624
- cand2,
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.nodes.ImportNodes import (
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),