Nuitka-winsvc 2.1.6__cp311-cp311-win_amd64.whl → 2.2.2__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Nuitka-winsvc might be problematic. Click here for more details.

Files changed (234) hide show
  1. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/METADATA +1 -1
  2. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/RECORD +234 -225
  3. nuitka/Errors.py +4 -0
  4. nuitka/HardImportRegistry.py +18 -1
  5. nuitka/MainControl.py +27 -30
  6. nuitka/OptionParsing.py +32 -30
  7. nuitka/Options.py +26 -13
  8. nuitka/OutputDirectories.py +7 -4
  9. nuitka/PostProcessing.py +9 -7
  10. nuitka/Progress.py +3 -3
  11. nuitka/PythonVersions.py +2 -2
  12. nuitka/TreeXML.py +1 -1
  13. nuitka/Version.py +1 -1
  14. nuitka/build/Backend.scons +2 -1
  15. nuitka/build/DataComposerInterface.py +1 -0
  16. nuitka/build/Onefile.scons +2 -1
  17. nuitka/build/SconsCaching.py +64 -46
  18. nuitka/build/SconsCompilerSettings.py +19 -6
  19. nuitka/build/SconsHacks.py +0 -1
  20. nuitka/build/SconsInterface.py +84 -5
  21. nuitka/build/SconsProgress.py +0 -1
  22. nuitka/build/SconsUtils.py +8 -4
  23. nuitka/build/include/nuitka/allocator.h +8 -3
  24. nuitka/build/include/nuitka/compiled_cell.h +8 -0
  25. nuitka/build/include/nuitka/exceptions.h +554 -179
  26. nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
  27. nuitka/build/include/nuitka/helper/import_hard.h +3 -0
  28. nuitka/build/include/nuitka/helper/ints.h +15 -2
  29. nuitka/build/include/nuitka/helper/lists.h +4 -1
  30. nuitka/build/include/nuitka/helper/raising.h +12 -0
  31. nuitka/build/include/nuitka/helper/tuples.h +5 -1
  32. nuitka/build/include/nuitka/helpers.h +4 -0
  33. nuitka/build/include/nuitka/importing.h +3 -4
  34. nuitka/build/include/nuitka/jit_sources.h +25 -0
  35. nuitka/build/include/nuitka/prelude.h +38 -11
  36. nuitka/build/include/nuitka/printing.h +3 -0
  37. nuitka/build/include/nuitka/threading.h +2 -6
  38. nuitka/build/include/nuitka/type_aliases.h +27 -0
  39. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +0 -3
  40. nuitka/build/inline_copy/tqdm/tqdm/version.py +1 -4
  41. nuitka/build/static_src/CompiledAsyncgenType.c +99 -114
  42. nuitka/build/static_src/CompiledCodeHelpers.c +23 -14
  43. nuitka/build/static_src/CompiledCoroutineType.c +96 -114
  44. nuitka/build/static_src/CompiledFrameType.c +14 -11
  45. nuitka/build/static_src/CompiledFunctionType.c +34 -7
  46. nuitka/build/static_src/CompiledGeneratorType.c +248 -142
  47. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +60 -70
  48. nuitka/build/static_src/CompiledMethodType.c +8 -7
  49. nuitka/build/static_src/HelpersAttributes.c +2 -19
  50. nuitka/build/static_src/HelpersBuiltin.c +2 -1
  51. nuitka/build/static_src/HelpersComparisonEq.c +32 -18
  52. nuitka/build/static_src/HelpersComparisonGe.c +50 -36
  53. nuitka/build/static_src/HelpersComparisonGt.c +50 -36
  54. nuitka/build/static_src/HelpersComparisonLe.c +50 -36
  55. nuitka/build/static_src/HelpersComparisonLt.c +50 -36
  56. nuitka/build/static_src/HelpersComparisonNe.c +32 -18
  57. nuitka/build/static_src/HelpersDeepcopy.c +6 -8
  58. nuitka/build/static_src/HelpersDictionaries.c +8 -3
  59. nuitka/build/static_src/HelpersExceptions.c +42 -28
  60. nuitka/build/static_src/HelpersFilesystemPaths.c +7 -7
  61. nuitka/build/static_src/HelpersImportHard.c +15 -0
  62. nuitka/build/static_src/HelpersJitSources.c +46 -0
  63. nuitka/build/static_src/HelpersLists.c +40 -0
  64. nuitka/build/static_src/HelpersOperationBinaryAdd.c +66 -66
  65. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +80 -33
  66. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +16 -13
  67. nuitka/build/static_src/HelpersOperationBinarySub.c +39 -39
  68. nuitka/build/static_src/HelpersOperationInplaceAdd.c +54 -54
  69. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +1 -1
  70. nuitka/build/static_src/HelpersOperationInplaceSub.c +50 -50
  71. nuitka/build/static_src/HelpersProfiling.c +3 -4
  72. nuitka/build/static_src/HelpersRaising.c +62 -1
  73. nuitka/build/static_src/HelpersStrings.c +203 -8
  74. nuitka/build/static_src/HelpersTypes.c +42 -0
  75. nuitka/build/static_src/MainProgram.c +1 -1
  76. nuitka/build/static_src/MetaPathBasedLoader.c +2 -1
  77. nuitka/build/static_src/OnefileBootstrap.c +3 -3
  78. nuitka/code_generation/BinaryOperationHelperDefinitions.py +5 -3
  79. nuitka/code_generation/BuiltinCodes.py +1 -0
  80. nuitka/code_generation/CodeGeneration.py +11 -0
  81. nuitka/code_generation/CodeHelpers.py +5 -3
  82. nuitka/code_generation/CodeObjectCodes.py +10 -6
  83. nuitka/code_generation/ComparisonCodes.py +19 -3
  84. nuitka/code_generation/ConstantCodes.py +5 -0
  85. nuitka/code_generation/Contexts.py +22 -6
  86. nuitka/code_generation/Emission.py +1 -0
  87. nuitka/code_generation/ErrorCodes.py +8 -16
  88. nuitka/code_generation/EvalCodes.py +5 -3
  89. nuitka/code_generation/ExceptionCodes.py +8 -1
  90. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +1 -0
  91. nuitka/code_generation/FrameCodes.py +5 -3
  92. nuitka/code_generation/FunctionCodes.py +0 -1
  93. nuitka/code_generation/GeneratorCodes.py +3 -3
  94. nuitka/code_generation/GlobalConstants.py +0 -2
  95. nuitka/code_generation/ImportCodes.py +2 -0
  96. nuitka/code_generation/JitCodes.py +44 -0
  97. nuitka/code_generation/ListCodes.py +11 -17
  98. nuitka/code_generation/MatchCodes.py +0 -1
  99. nuitka/code_generation/ModuleCodes.py +2 -1
  100. nuitka/code_generation/Namify.py +0 -1
  101. nuitka/code_generation/NetworkxCodes.py +51 -0
  102. nuitka/code_generation/OperationCodes.py +8 -6
  103. nuitka/code_generation/PackageResourceCodes.py +7 -5
  104. nuitka/code_generation/TensorflowCodes.py +54 -0
  105. nuitka/code_generation/TypeAliasCodes.py +71 -0
  106. nuitka/code_generation/VariableCodes.py +7 -5
  107. nuitka/code_generation/VariableDeclarations.py +1 -0
  108. nuitka/code_generation/c_types/CTypeCLongs.py +0 -1
  109. nuitka/code_generation/c_types/CTypeNuitkaInts.py +0 -1
  110. nuitka/code_generation/c_types/CTypeVoids.py +1 -0
  111. nuitka/code_generation/templates/CodeTemplatesConstants.py +14 -0
  112. nuitka/code_generation/templates/CodeTemplatesExceptions.py +1 -1
  113. nuitka/code_generation/templates/CodeTemplatesIterators.py +0 -1
  114. nuitka/code_generation/templates/CodeTemplatesLoader.py +0 -1
  115. nuitka/code_generation/templates/CodeTemplatesModules.py +9 -4
  116. nuitka/code_generation/templates/CodeTemplatesVariables.py +8 -8
  117. nuitka/code_generation/templates/TemplateDebugWrapper.py +0 -1
  118. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +4 -0
  119. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +9 -7
  120. nuitka/containers/Namedtuples.py +0 -1
  121. nuitka/finalizations/Finalization.py +1 -0
  122. nuitka/finalizations/FinalizeMarkups.py +0 -1
  123. nuitka/freezer/DllDependenciesMacOS.py +60 -13
  124. nuitka/freezer/DllDependenciesPosix.py +0 -1
  125. nuitka/freezer/DllDependenciesWin32.py +2 -1
  126. nuitka/freezer/IncludedDataFiles.py +46 -15
  127. nuitka/freezer/IncludedEntryPoints.py +5 -3
  128. nuitka/freezer/Standalone.py +6 -1
  129. nuitka/importing/ImportCache.py +2 -2
  130. nuitka/importing/ImportResolving.py +80 -78
  131. nuitka/importing/Importing.py +34 -1
  132. nuitka/nodes/AttributeNodesGenerated.py +21 -6
  133. nuitka/nodes/BuiltinComplexNodes.py +1 -0
  134. nuitka/nodes/BuiltinFormatNodes.py +1 -0
  135. nuitka/nodes/BuiltinIteratorNodes.py +5 -3
  136. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +21 -6
  137. nuitka/nodes/BuiltinRefNodes.py +8 -1
  138. nuitka/nodes/BuiltinVarsNodes.py +0 -1
  139. nuitka/nodes/ChildrenHavingMixins.py +906 -186
  140. nuitka/nodes/CodeObjectSpecs.py +1 -1
  141. nuitka/nodes/ConditionalNodes.py +2 -6
  142. nuitka/nodes/ConstantRefNodes.py +38 -0
  143. nuitka/nodes/CtypesNodes.py +0 -1
  144. nuitka/nodes/DictionaryNodes.py +0 -1
  145. nuitka/nodes/ExceptionNodes.py +10 -0
  146. nuitka/nodes/ExpressionBases.py +15 -9
  147. nuitka/nodes/ExpressionBasesGenerated.py +32 -15
  148. nuitka/nodes/FunctionNodes.py +50 -5
  149. nuitka/nodes/HardImportNodesGenerated.py +245 -60
  150. nuitka/nodes/ImportHardNodes.py +27 -13
  151. nuitka/nodes/ImportNodes.py +92 -70
  152. nuitka/nodes/InjectCNodes.py +0 -1
  153. nuitka/nodes/ModuleNodes.py +10 -5
  154. nuitka/nodes/NetworkxNodes.py +45 -0
  155. nuitka/nodes/OperatorNodesUnary.py +1 -0
  156. nuitka/nodes/OsSysNodes.py +0 -1
  157. nuitka/nodes/PackageMetadataNodes.py +0 -1
  158. nuitka/nodes/PackageResourceNodes.py +10 -6
  159. nuitka/nodes/StatementBasesGenerated.py +107 -60
  160. nuitka/nodes/StringConcatenationNodes.py +1 -0
  161. nuitka/nodes/TensorflowNodes.py +38 -0
  162. nuitka/nodes/TypeNodes.py +21 -0
  163. nuitka/nodes/VariableRefNodes.py +1 -0
  164. nuitka/nodes/shapes/BuiltinTypeShapes.py +25 -15
  165. nuitka/optimizations/Optimization.py +7 -6
  166. nuitka/optimizations/OptimizeBuiltinCalls.py +11 -9
  167. nuitka/optimizations/Tags.py +0 -1
  168. nuitka/optimizations/TraceCollections.py +6 -55
  169. nuitka/optimizations/ValueTraces.py +49 -1
  170. nuitka/plugins/PluginBase.py +26 -4
  171. nuitka/plugins/Plugins.py +49 -12
  172. nuitka/plugins/standard/AntiBloatPlugin.py +12 -2
  173. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +0 -1
  174. nuitka/plugins/standard/DataFilesPlugin.py +2 -6
  175. nuitka/plugins/standard/DillPlugin.py +3 -3
  176. nuitka/plugins/standard/DllFilesPlugin.py +29 -23
  177. nuitka/plugins/standard/GiPlugin.py +1 -0
  178. nuitka/plugins/standard/ImplicitImports.py +8 -7
  179. nuitka/plugins/standard/MatplotlibPlugin.py +1 -0
  180. nuitka/plugins/standard/OptionsNannyPlugin.py +3 -7
  181. nuitka/plugins/standard/PkgResourcesPlugin.py +0 -1
  182. nuitka/plugins/standard/PmwPlugin.py +10 -9
  183. nuitka/plugins/standard/PySidePyQtPlugin.py +0 -28
  184. nuitka/plugins/standard/TensorflowPlugin.py +1 -0
  185. nuitka/plugins/standard/TorchPlugin.py +1 -0
  186. nuitka/plugins/standard/TrioPlugin.py +1 -0
  187. nuitka/plugins/standard/standard.nuitka-package.config.yml +249 -34
  188. nuitka/reports/CompilationReportReader.py +0 -1
  189. nuitka/reports/Reports.py +49 -5
  190. nuitka/specs/BuiltinParameterSpecs.py +10 -2
  191. nuitka/specs/BuiltinStrOperationSpecs.py +1 -1
  192. nuitka/specs/BuiltinTypeOperationSpecs.py +0 -1
  193. nuitka/specs/HardImportSpecs.py +34 -1
  194. nuitka/specs/ParameterSpecs.py +11 -9
  195. nuitka/tools/environments/Virtualenv.py +0 -1
  196. nuitka/tools/specialize/CTypeDescriptions.py +15 -11
  197. nuitka/tools/specialize/SpecializeC.py +11 -9
  198. nuitka/tools/specialize/SpecializePython.py +57 -30
  199. nuitka/tools/testing/Common.py +24 -7
  200. nuitka/tools/testing/OutputComparison.py +4 -0
  201. nuitka/tools/testing/Pythons.py +0 -1
  202. nuitka/tools/testing/compare_with_cpython/__main__.py +0 -4
  203. nuitka/tools/watch/GitHub.py +4 -1
  204. nuitka/tools/watch/__main__.py +22 -1
  205. nuitka/tree/Building.py +3 -0
  206. nuitka/tree/InternalModule.py +0 -1
  207. nuitka/tree/ReformulationAssertStatements.py +1 -0
  208. nuitka/tree/ReformulationAssignmentStatements.py +26 -3
  209. nuitka/tree/ReformulationClasses3.py +23 -26
  210. nuitka/tree/ReformulationContractionExpressions.py +5 -3
  211. nuitka/tree/ReformulationDictionaryCreation.py +6 -5
  212. nuitka/tree/ReformulationExecStatements.py +8 -6
  213. nuitka/tree/ReformulationFunctionStatements.py +10 -6
  214. nuitka/tree/SourceHandling.py +8 -0
  215. nuitka/tree/TreeHelpers.py +6 -3
  216. nuitka/utils/AppDirs.py +6 -2
  217. nuitka/utils/CStrings.py +1 -1
  218. nuitka/utils/CommandLineOptions.py +0 -1
  219. nuitka/utils/Distributions.py +3 -3
  220. nuitka/utils/Download.py +5 -1
  221. nuitka/utils/Execution.py +6 -3
  222. nuitka/utils/FileOperations.py +61 -34
  223. nuitka/utils/Importing.py +4 -4
  224. nuitka/utils/InstanceCounters.py +1 -0
  225. nuitka/utils/MacOSApp.py +1 -0
  226. nuitka/utils/Shebang.py +1 -0
  227. nuitka/utils/Utils.py +39 -1
  228. nuitka/utils/WindowsFileUsage.py +4 -3
  229. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.2.data}/scripts/nuitka-run.bat +0 -0
  230. {Nuitka_winsvc-2.1.6.data → Nuitka_winsvc-2.2.2.data}/scripts/nuitka.bat +0 -0
  231. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/LICENSE.txt +0 -0
  232. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/WHEEL +0 -0
  233. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/entry_points.txt +0 -0
  234. {Nuitka_winsvc-2.1.6.dist-info → Nuitka_winsvc-2.2.2.dist-info}/top_level.txt +0 -0
@@ -26,6 +26,7 @@ from nuitka.utils.SharedLibraries import (
26
26
  getOtoolDependencyOutput,
27
27
  getOtoolListing,
28
28
  )
29
+ from nuitka.utils.Utils import getArchitecture
29
30
 
30
31
  from .DllDependenciesCommon import getLdLibraryPath
31
32
 
@@ -50,7 +51,7 @@ def _detectPythonRpaths():
50
51
  if os.path.isdir(candidate):
51
52
  result.append(candidate)
52
53
 
53
- return tuple(result)
54
+ return tuple(set(result))
54
55
 
55
56
 
56
57
  def detectBinaryPathDLLsMacOS(
@@ -93,8 +94,8 @@ def detectBinaryPathDLLsMacOS(
93
94
  original_dir=os.path.dirname(sub_dll_filename),
94
95
  binary_filename=sub_dll_filename,
95
96
  package_name=package_name,
96
- recursive=True,
97
97
  keep_unresolved=True,
98
+ recursive=True,
98
99
  )
99
100
 
100
101
  merged_result.update(sub_result)
@@ -133,6 +134,24 @@ def _parseOtoolListingOutput(output):
133
134
  return paths
134
135
 
135
136
 
137
+ def _getNonVersionedDllFilenames(filename):
138
+ yield filename
139
+
140
+ if getArchitecture() == "arm64" and filename.endswith(".dylib"):
141
+ yield filename[:-6] + "_arm64.dylib"
142
+
143
+ match = re.match(r"^(.*?)(\.\d+)+\.dylib$", filename)
144
+
145
+ if match:
146
+ yield match.group(1) + ".dylib"
147
+
148
+ # TODO: The versioned filename, might do the same, and so could the
149
+ # "x86_64" specific DLL be a thing too, but we should have actual
150
+ # examples to be sure they are covered with tests.
151
+ if getArchitecture() == "arm64":
152
+ yield match.group(1) + "_arm64.dylib"
153
+
154
+
136
155
  def _resolveBinaryPathDLLsMacOS(
137
156
  original_dir, binary_filename, paths, package_specific_dirs, package_name
138
157
  ):
@@ -149,11 +168,17 @@ def _resolveBinaryPathDLLsMacOS(
149
168
  for path in paths:
150
169
  if path.startswith("@rpath/"):
151
170
  # Resolve rpath to just the ones given, first match.
171
+ library_name = path[7:]
172
+
152
173
  for rpath in rpaths:
153
- if os.path.exists(os.path.join(rpath, path[7:])):
174
+ if os.path.exists(os.path.join(rpath, library_name)):
154
175
  resolved_path = os.path.normpath(os.path.join(rpath, path[7:]))
155
176
  break
156
177
  else:
178
+ # These have become virtual in later macOS.
179
+ if library_name in ("libc++.1.dylib", "libz.1.dylib"):
180
+ continue
181
+
157
182
  # This is only a guess, might be missing package specific directories.
158
183
  resolved_path = os.path.normpath(os.path.join(original_dir, path[7:]))
159
184
  elif path.startswith("@loader_path/"):
@@ -189,22 +214,33 @@ def _resolveBinaryPathDLLsMacOS(
189
214
  )
190
215
 
191
216
  # Some extension modules seem to reference themselves by a different
192
- # extension module name, so use that if it exists.
193
- if not os.path.exists(resolved_path) and python_version >= 0x300:
217
+ # extension module name, so use that if it exists, and some versioned
218
+ # DLL dependencies do not matter.
219
+ if python_version >= 0x300:
194
220
  so_suffixes = getSharedLibrarySuffixes()[:-1]
195
221
 
196
222
  specific_suffix = so_suffixes[0]
197
223
  abi_suffix = so_suffixes[1]
198
224
 
199
- if resolved_path.endswith(specific_suffix):
200
- candidate = resolved_path[: -len(specific_suffix)] + abi_suffix
201
- elif resolved_path.endswith(abi_suffix):
202
- candidate = resolved_path[: -len(specific_suffix)] + abi_suffix
203
- else:
204
- candidate = None
225
+ for resolved_path_candidate in _getNonVersionedDllFilenames(resolved_path):
226
+ if os.path.exists(resolved_path_candidate):
227
+ resolved_path = resolved_path_candidate
228
+ break
205
229
 
206
- if candidate is not None and os.path.exists(candidate):
207
- resolved_path = candidate
230
+ if resolved_path_candidate.endswith(specific_suffix):
231
+ candidate = (
232
+ resolved_path_candidate[: -len(specific_suffix)] + abi_suffix
233
+ )
234
+ elif resolved_path_candidate.endswith(abi_suffix):
235
+ candidate = (
236
+ resolved_path_candidate[: -len(specific_suffix)] + abi_suffix
237
+ )
238
+ else:
239
+ candidate = None
240
+
241
+ if candidate is not None and os.path.exists(candidate):
242
+ resolved_path = candidate
243
+ break
208
244
 
209
245
  # Sometimes self-dependencies are on a numbered version, but deployed is
210
246
  # one version without it. The macOS just ignores that, and so we do.
@@ -241,6 +277,17 @@ def _resolveBinaryPathDLLsMacOS(
241
277
  # TODO: Missing DLLs that are accepted, are not really forbidden, we
242
278
  # should instead acknowledge them as missing, and treat that properly
243
279
  # in using code.
280
+ if acceptable is True:
281
+ raise NuitkaForbiddenDLLEncounter(binary_filename, plugin_name)
282
+
283
+ # We check both the user and the used DLL if they are listed. This
284
+ # might be a form of bug hiding, that the later is not sufficient,
285
+ # that we should address later.
286
+ acceptable, plugin_name = Plugins.isAcceptableMissingDLL(
287
+ package_name=package_name,
288
+ filename=resolved_path,
289
+ )
290
+
244
291
  if acceptable is True:
245
292
  raise NuitkaForbiddenDLLEncounter(binary_filename, plugin_name)
246
293
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  """
7
7
 
8
-
9
8
  import os
10
9
  import sys
11
10
 
@@ -14,6 +14,7 @@ from nuitka.build.SconsUtils import readSconsReport
14
14
  from nuitka.containers.OrderedSets import OrderedSet
15
15
  from nuitka.Options import isShowProgress
16
16
  from nuitka.plugins.Plugins import Plugins
17
+ from nuitka.PythonVersions import getSystemPrefixPath
17
18
  from nuitka.Tracing import inclusion_logger
18
19
  from nuitka.utils.AppDirs import getCacheDir
19
20
  from nuitka.utils.FileOperations import (
@@ -99,7 +100,7 @@ def _getScanDirectories(package_name, original_dir):
99
100
  if cache_key in _scan_dir_cache:
100
101
  return _scan_dir_cache[cache_key]
101
102
 
102
- scan_dirs = [sys.prefix]
103
+ scan_dirs = [getSystemPrefixPath()]
103
104
 
104
105
  if package_name is not None:
105
106
  scan_dirs.extend(getPackageSpecificDLLDirectories(package_name))
@@ -20,6 +20,7 @@ from nuitka.Options import (
20
20
  getShallIncludeExternallyDataFilePatterns,
21
21
  getShallIncludePackageData,
22
22
  getShallNotIncludeDataFilePatterns,
23
+ isAcceleratedMode,
23
24
  isOnefileMode,
24
25
  isStandaloneMode,
25
26
  shallMakeModule,
@@ -27,6 +28,7 @@ from nuitka.Options import (
27
28
  from nuitka.OutputDirectories import getStandaloneDirectoryPath
28
29
  from nuitka.Tracing import options_logger
29
30
  from nuitka.utils.FileOperations import (
31
+ areSamePaths,
30
32
  containsPathElements,
31
33
  copyFileWithPermissions,
32
34
  getFileContents,
@@ -145,18 +147,6 @@ def makeIncludedDataFile(source_path, dest_path, reason, tracer, tags):
145
147
  if "framework_resource" in tags and not isMacOS():
146
148
  tracer.sysexit("Using resource files on non-MacOS")
147
149
 
148
- inside = True
149
- if not isRelativePath(dest_path):
150
- if "framework_resource" in tags and not isOnefileMode():
151
- inside = isRelativePath(os.path.join("Resources", dest_path))
152
- else:
153
- inside = False
154
-
155
- if not inside:
156
- tracer.sysexit(
157
- "Error, cannot use dest path '%s' outside of distribution." % dest_path
158
- )
159
-
160
150
  # Refuse directories, these must be kept distinct.
161
151
  if os.path.isdir(source_path):
162
152
  tracer.sysexit(
@@ -164,6 +154,27 @@ def makeIncludedDataFile(source_path, dest_path, reason, tracer, tags):
164
154
  % source_path
165
155
  )
166
156
 
157
+ # In accelerated mode, data files can be everywhere, but they cannot
158
+ # change place.
159
+ if isAcceleratedMode():
160
+ if "package_data" not in tags and not areSamePaths(source_path, dest_path):
161
+ tracer.sysexit(
162
+ "Error, cannot change paths for data files in accelerated mode '%s'."
163
+ % dest_path
164
+ )
165
+ else:
166
+ inside = True
167
+ if not isRelativePath(dest_path):
168
+ if "framework_resource" in tags and not isOnefileMode():
169
+ inside = isRelativePath(os.path.join("Resources", dest_path))
170
+ else:
171
+ inside = False
172
+
173
+ if not inside:
174
+ tracer.sysexit(
175
+ "Error, cannot use dest path '%s' outside of distribution." % dest_path
176
+ )
177
+
167
178
  return IncludedDataFile(
168
179
  kind="data_file",
169
180
  source_path=source_path,
@@ -506,7 +517,25 @@ def _reportDataFiles():
506
517
  _data_file_traces.clear()
507
518
 
508
519
 
509
- def _handleDataFile(included_datafile):
520
+ def _checkPathConflict(dest_path, standalone_entry_points):
521
+ assert os.path.normpath(dest_path) == dest_path
522
+
523
+ while dest_path:
524
+ for standalone_entry_point in standalone_entry_points:
525
+ if dest_path == standalone_entry_point.dest_path:
526
+ options_logger.sysexit(
527
+ """\
528
+ Error, data file to be placed in distribution as '%s' conflicts with %s '%s'."""
529
+ % (
530
+ dest_path,
531
+ standalone_entry_point.kind,
532
+ standalone_entry_point.dest_path,
533
+ )
534
+ )
535
+ dest_path = os.path.dirname(dest_path)
536
+
537
+
538
+ def _handleDataFile(included_datafile, standalone_entry_points):
510
539
  """Handle a data file."""
511
540
  tracer = included_datafile.tracer
512
541
 
@@ -529,6 +558,7 @@ def _handleDataFile(included_datafile):
529
558
  if "external" in included_datafile.tags:
530
559
  dest_path = getOutputPath(included_datafile.dest_path)
531
560
  else:
561
+ _checkPathConflict(included_datafile.dest_path, standalone_entry_points)
532
562
  dest_path = os.path.join(dist_dir, included_datafile.dest_path)
533
563
 
534
564
  if included_datafile.kind == "data_blob":
@@ -548,7 +578,7 @@ def _handleDataFile(included_datafile):
548
578
  assert False, included_datafile
549
579
 
550
580
 
551
- def copyDataFiles():
581
+ def copyDataFiles(standalone_entry_points):
552
582
  """Copy the data files needed for standalone distribution.
553
583
 
554
584
  Notes:
@@ -576,7 +606,8 @@ plugins '--embed-*' options. Not done for '%s'."""
576
606
  )
577
607
 
578
608
  _handleDataFile(
579
- included_datafile,
609
+ included_datafile=included_datafile,
610
+ standalone_entry_points=standalone_entry_points,
580
611
  )
581
612
 
582
613
  _reportDataFiles()
@@ -316,9 +316,11 @@ def addExtensionModuleEntryPoint(module):
316
316
  + getSharedLibrarySuffix(preferred=False),
317
317
  module_name=module.getFullName(),
318
318
  package_name=module.getFullName().getPackageName(),
319
- reason="required extension module for CPython library startup"
320
- if module.isTechnical()
321
- else "used extension module",
319
+ reason=(
320
+ "required extension module for CPython library startup"
321
+ if module.isTechnical()
322
+ else "used extension module"
323
+ ),
322
324
  )
323
325
  )
324
326
 
@@ -28,6 +28,8 @@ from nuitka.Progress import (
28
28
  reportProgressBar,
29
29
  setupProgressBar,
30
30
  )
31
+ from nuitka.PythonFlavors import isAnacondaPython, isHomebrewPython
32
+ from nuitka.PythonVersions import getSystemPrefixPath
31
33
  from nuitka.Tracing import general, inclusion_logger
32
34
  from nuitka.utils.FileOperations import areInSamePaths, isFilenameBelowPath
33
35
  from nuitka.utils.SharedLibraries import copyDllFile, setSharedLibraryRPATH
@@ -220,6 +222,9 @@ def copyDllsUsed(dist_dir, standalone_entry_points):
220
222
  def _reduceToPythonPath(used_dlls):
221
223
  inside_paths = getPythonUnpackedSearchPath()
222
224
 
225
+ if isAnacondaPython() or isHomebrewPython():
226
+ inside_paths.insert(0, getSystemPrefixPath())
227
+
223
228
  def decideInside(dll_filename):
224
229
  return any(
225
230
  isFilenameBelowPath(path=inside_path, filename=dll_filename)
@@ -284,7 +289,7 @@ def _detectUsedDLLs(standalone_entry_point, source_dir):
284
289
  # TODO: If used by a DLL from the same folder, put it there,
285
290
  # otherwise top level, but for now this is limited to a few cases
286
291
  # where required that way (openvino) or known to be good only (av),
287
- # because it broke other things.
292
+ # because it broke other things. spell-checker: ignore openvino
288
293
  if standalone_entry_point.package_name in (
289
294
  "openvino",
290
295
  "av",
@@ -68,14 +68,14 @@ def replaceImportedModule(old, new):
68
68
  imported_by_name[key] = new
69
69
  break
70
70
  else:
71
- assert False
71
+ assert False, (old, new)
72
72
 
73
73
  for key, value in imported_modules.items():
74
74
  if value == old:
75
75
  imported_modules[key] = new
76
76
  break
77
77
  else:
78
- assert False
78
+ assert False, (old, new)
79
79
 
80
80
 
81
81
  # Part of "Nuitka", an optimizing Python compiler that is compatible and
@@ -15,101 +15,103 @@ from nuitka.utils.ModuleNames import ModuleName
15
15
 
16
16
  _six_moves = {
17
17
  "six.moves.builtins": "__builtin__" if python_version < 0x300 else "builtins",
18
- "six.moves.configparser": "ConfigParser"
19
- if python_version < 0x300
20
- else "configparser",
18
+ "six.moves.configparser": (
19
+ "ConfigParser" if python_version < 0x300 else "configparser"
20
+ ),
21
21
  "six.moves.copyreg": "copy_reg" if python_version < 0x300 else "copyreg",
22
22
  "six.moves.dbm_gnu": "gdbm" if python_version < 0x300 else "dbm.gnu",
23
- "six.moves._dummy_thread": "dummy_thread"
24
- if python_version < 0x300
25
- else "_dummy_thread",
26
- "six.moves.http_cookiejar": "cookielib"
27
- if python_version < 0x300
28
- else "http.cookiejar",
23
+ "six.moves._dummy_thread": (
24
+ "dummy_thread" if python_version < 0x300 else "_dummy_thread"
25
+ ),
26
+ "six.moves.http_cookiejar": (
27
+ "cookielib" if python_version < 0x300 else "http.cookiejar"
28
+ ),
29
29
  "six.moves.http_cookies": "Cookie" if python_version < 0x300 else "http.cookies",
30
- "six.moves.html_entities": "htmlentitydefs"
31
- if python_version < 0x300
32
- else "html.entities",
30
+ "six.moves.html_entities": (
31
+ "htmlentitydefs" if python_version < 0x300 else "html.entities"
32
+ ),
33
33
  "six.moves.html_parser": "HTMLParser" if python_version < 0x300 else "html.parser",
34
34
  "six.moves.http_client": "httplib" if python_version < 0x300 else "http.client",
35
- "six.moves.email_mime_multipart": "email.MIMEMultipart"
36
- if python_version < 0x300
37
- else "email.mime.multipart",
38
- "six.moves.email_mime_nonmultipart": "email.MIMENonMultipart"
39
- if python_version < 0x300
40
- else "email.mime.nonmultipart",
41
- "six.moves.email_mime_text": "email.MIMEText"
42
- if python_version < 0x300
43
- else "email.mime.text",
44
- "six.moves.email_mime_base": "email.MIMEBase"
45
- if python_version < 0x300
46
- else "email.mime.base",
47
- "six.moves.BaseHTTPServer": "BaseHTTPServer"
48
- if python_version < 0x300
49
- else "http.server",
50
- "six.moves.CGIHTTPServer": "CGIHTTPServer"
51
- if python_version < 0x300
52
- else "http.server",
53
- "six.moves.SimpleHTTPServer": "SimpleHTTPServer"
54
- if python_version < 0x300
55
- else "http.server",
35
+ "six.moves.email_mime_multipart": (
36
+ "email.MIMEMultipart" if python_version < 0x300 else "email.mime.multipart"
37
+ ),
38
+ "six.moves.email_mime_nonmultipart": (
39
+ "email.MIMENonMultipart"
40
+ if python_version < 0x300
41
+ else "email.mime.nonmultipart"
42
+ ),
43
+ "six.moves.email_mime_text": (
44
+ "email.MIMEText" if python_version < 0x300 else "email.mime.text"
45
+ ),
46
+ "six.moves.email_mime_base": (
47
+ "email.MIMEBase" if python_version < 0x300 else "email.mime.base"
48
+ ),
49
+ "six.moves.BaseHTTPServer": (
50
+ "BaseHTTPServer" if python_version < 0x300 else "http.server"
51
+ ),
52
+ "six.moves.CGIHTTPServer": (
53
+ "CGIHTTPServer" if python_version < 0x300 else "http.server"
54
+ ),
55
+ "six.moves.SimpleHTTPServer": (
56
+ "SimpleHTTPServer" if python_version < 0x300 else "http.server"
57
+ ),
56
58
  "six.moves.cPickle": "cPickle" if python_version < 0x300 else "pickle",
57
59
  "six.moves.queue": "Queue" if python_version < 0x300 else "queue",
58
60
  "six.moves.reprlib": "repr" if python_version < 0x300 else "reprlib",
59
- "six.moves.socketserver": "SocketServer"
60
- if python_version < 0x300
61
- else "socketserver",
61
+ "six.moves.socketserver": (
62
+ "SocketServer" if python_version < 0x300 else "socketserver"
63
+ ),
62
64
  "six.moves._thread": "thread" if python_version < 0x300 else "_thread",
63
65
  "six.moves.tkinter": "Tkinter" if python_version < 0x300 else "tkinter",
64
- "six.moves.tkinter_dialog": "Dialog"
65
- if python_version < 0x300
66
- else "tkinter.dialog",
67
- "six.moves.tkinter_filedialog": "FileDialog"
68
- if python_version < 0x300
69
- else "tkinter.filedialog",
70
- "six.moves.tkinter_scrolledtext": "ScrolledText"
71
- if python_version < 0x300
72
- else "tkinter.scrolledtext",
73
- "six.moves.tkinter_simpledialog": "SimpleDialog"
74
- if python_version < 0x300
75
- else "tkinter.simpledialog",
66
+ "six.moves.tkinter_dialog": (
67
+ "Dialog" if python_version < 0x300 else "tkinter.dialog"
68
+ ),
69
+ "six.moves.tkinter_filedialog": (
70
+ "FileDialog" if python_version < 0x300 else "tkinter.filedialog"
71
+ ),
72
+ "six.moves.tkinter_scrolledtext": (
73
+ "ScrolledText" if python_version < 0x300 else "tkinter.scrolledtext"
74
+ ),
75
+ "six.moves.tkinter_simpledialog": (
76
+ "SimpleDialog" if python_version < 0x300 else "tkinter.simpledialog"
77
+ ),
76
78
  "six.moves.tkinter_tix": "Tix" if python_version < 0x300 else "tkinter.tix",
77
79
  "six.moves.tkinter_ttk": "ttk" if python_version < 0x300 else "tkinter.ttk",
78
- "six.moves.tkinter_constants": "Tkconstants"
79
- if python_version < 0x300
80
- else "tkinter.constants",
80
+ "six.moves.tkinter_constants": (
81
+ "Tkconstants" if python_version < 0x300 else "tkinter.constants"
82
+ ),
81
83
  "six.moves.tkinter_dnd": "Tkdnd" if python_version < 0x300 else "tkinter.dnd",
82
- "six.moves.tkinter_colorchooser": "tkColorChooser"
83
- if python_version < 0x300
84
- else "tkinter_colorchooser",
85
- "six.moves.tkinter_commondialog": "tkCommonDialog"
86
- if python_version < 0x300
87
- else "tkinter_commondialog",
88
- "six.moves.tkinter_tkfiledialog": "tkFileDialog"
89
- if python_version < 0x300
90
- else "tkinter.filedialog",
84
+ "six.moves.tkinter_colorchooser": (
85
+ "tkColorChooser" if python_version < 0x300 else "tkinter_colorchooser"
86
+ ),
87
+ "six.moves.tkinter_commondialog": (
88
+ "tkCommonDialog" if python_version < 0x300 else "tkinter_commondialog"
89
+ ),
90
+ "six.moves.tkinter_tkfiledialog": (
91
+ "tkFileDialog" if python_version < 0x300 else "tkinter.filedialog"
92
+ ),
91
93
  "six.moves.tkinter_font": "tkFont" if python_version < 0x300 else "tkinter.font",
92
- "six.moves.tkinter_messagebox": "tkMessageBox"
93
- if python_version < 0x300
94
- else "tkinter.messagebox",
95
- "six.moves.tkinter_tksimpledialog": "tkSimpleDialog"
96
- if python_version < 0x300
97
- else "tkinter_tksimpledialog",
94
+ "six.moves.tkinter_messagebox": (
95
+ "tkMessageBox" if python_version < 0x300 else "tkinter.messagebox"
96
+ ),
97
+ "six.moves.tkinter_tksimpledialog": (
98
+ "tkSimpleDialog" if python_version < 0x300 else "tkinter_tksimpledialog"
99
+ ),
98
100
  "six.moves.urllib_parse": None if python_version < 0x300 else "urllib.parse",
99
101
  "six.moves.urllib_error": None if python_version < 0x300 else "urllib.error",
100
- "six.moves.urllib_robotparser": "robotparser"
101
- if python_version < 0x300
102
- else "urllib.robotparser",
103
- "six.moves.xmlrpc_client": "xmlrpclib"
104
- if python_version < 0x300
105
- else "xmlrpc.client",
106
- "six.moves.xmlrpc_server": "SimpleXMLRPCServer"
107
- if python_version < 0x300
108
- else "xmlrpc.server",
102
+ "six.moves.urllib_robotparser": (
103
+ "robotparser" if python_version < 0x300 else "urllib.robotparser"
104
+ ),
105
+ "six.moves.xmlrpc_client": (
106
+ "xmlrpclib" if python_version < 0x300 else "xmlrpc.client"
107
+ ),
108
+ "six.moves.xmlrpc_server": (
109
+ "SimpleXMLRPCServer" if python_version < 0x300 else "xmlrpc.server"
110
+ ),
109
111
  "six.moves.winreg": "_winreg" if python_version < 0x300 else "winreg",
110
- "six.moves.urllib.request": "urllib2"
111
- if python_version < 0x300
112
- else "urllib.request",
112
+ "six.moves.urllib.request": (
113
+ "urllib2" if python_version < 0x300 else "urllib.request"
114
+ ),
113
115
  }
114
116
 
115
117
 
@@ -21,7 +21,6 @@ it's from the standard library, one can abuse the attribute ``__file__`` of the
21
21
 
22
22
  """
23
23
 
24
-
25
24
  import collections
26
25
  import os
27
26
  import sys
@@ -131,6 +130,38 @@ def makeModuleUsageAttempt(
131
130
  )
132
131
 
133
132
 
133
+ def makeParentModuleUsagesAttempts(module_usage_attempt):
134
+ result = []
135
+
136
+ for parent_package_name in module_usage_attempt.module_name.getParentPackageNames():
137
+ (
138
+ _parent_package_name,
139
+ parent_module_filename,
140
+ parent_module_kind,
141
+ parent_module_finding,
142
+ ) = locateModule(
143
+ module_name=parent_package_name,
144
+ parent_package=None,
145
+ level=0,
146
+ )
147
+
148
+ result.append(
149
+ makeModuleUsageAttempt(
150
+ module_name=parent_package_name,
151
+ filename=parent_module_filename,
152
+ finding=parent_module_finding,
153
+ module_kind=parent_module_kind,
154
+ level=0,
155
+ source_ref=module_usage_attempt.source_ref,
156
+ reason="import path parent",
157
+ )
158
+ )
159
+
160
+ result.append(module_usage_attempt)
161
+
162
+ return tuple(result)
163
+
164
+
134
165
  def addMainScriptDirectory(main_dir):
135
166
  """Initialize the main script directory.
136
167
 
@@ -920,6 +951,7 @@ _stdlib_module_raises = {
920
951
  "_subprocess": False,
921
952
  "_sha": False, # TODO: Not entirely clear if that's true
922
953
  "_sha1": False,
954
+ "_sha2": False,
923
955
  "_sha256": False,
924
956
  "_sha3": False,
925
957
  "_sha512": False,
@@ -983,6 +1015,7 @@ _stdlib_module_raises = {
983
1015
  "zipimport": False,
984
1016
  "zlib": False,
985
1017
  "_ssl": True,
1018
+ "_xxinterpchannels": False,
986
1019
  }
987
1020
 
988
1021
 
@@ -2,18 +2,33 @@
2
2
 
3
3
 
4
4
  # We are not avoiding these in generated code at all
5
- # pylint: disable=I0021,too-many-lines
6
- # pylint: disable=I0021,line-too-long
7
- # pylint: disable=I0021,too-many-instance-attributes
8
- # pylint: disable=I0021,too-many-return-statements
5
+ # pylint: disable=I0021,line-too-long,too-many-instance-attributes,too-many-lines
6
+ # pylint: disable=I0021,too-many-arguments,too-many-return-statements,too-many-statements
9
7
 
10
8
 
11
9
  """Specialized attribute nodes
12
10
 
13
11
  WARNING, this code is GENERATED. Modify the template AttributeNodeFixed.py.j2 instead!
14
12
 
15
- spell-checker: ignore append capitalize casefold center clear copy count decode encode endswith expandtabs extend find format formatmap fromkeys get haskey index insert isalnum isalpha isascii isdecimal isdigit isidentifier islower isnumeric isprintable isspace istitle isupper items iteritems iterkeys itervalues join keys ljust lower lstrip maketrans partition pop popitem prepare remove replace reverse rfind rindex rjust rpartition rsplit rstrip setdefault sort split splitlines startswith strip swapcase title translate update upper values viewitems viewkeys viewvalues zfill
16
- spell-checker: ignore args chars count default delete encoding end errors fillchar index item iterable keepends key kwargs maxsplit new old pairs prefix sep start stop sub suffix table tabsize value width
13
+ spell-checker: ignore __prepare__ append args autograph buffering capitalize casefold
14
+ spell-checker: ignore center chars clear closefd copy count decode default delete dist
15
+ spell-checker: ignore distribution_name encode encoding end endswith errors exit_code
16
+ spell-checker: ignore expandtabs experimental_attributes experimental_autograph_options
17
+ spell-checker: ignore experimental_compile experimental_follow_type_hints
18
+ spell-checker: ignore experimental_implements experimental_relax_shapes extend file
19
+ spell-checker: ignore fillchar find format format_map formatmap fromkeys func get group
20
+ spell-checker: ignore handle has_key haskey index input_signature insert isalnum isalpha
21
+ spell-checker: ignore isascii isdecimal isdigit isidentifier islower isnumeric isprintable
22
+ spell-checker: ignore isspace istitle isupper item items iterable iteritems iterkeys
23
+ spell-checker: ignore itervalues jit_compile join keepends key keys kwargs ljust lower
24
+ spell-checker: ignore lstrip maketrans maxsplit mode name new newline old opener p package
25
+ spell-checker: ignore package_or_requirement pairs partition path pop popitem prefix
26
+ spell-checker: ignore prepare reduce_retracing remove replace resource resource_name
27
+ spell-checker: ignore reverse rfind rindex rjust rpartition rsplit rstrip s sep setdefault
28
+ spell-checker: ignore sort split splitlines start startswith stop strip sub suffix
29
+ spell-checker: ignore swapcase table tabsize title translate update upper use_errno
30
+ spell-checker: ignore use_last_error value values viewitems viewkeys viewvalues width
31
+ spell-checker: ignore winmode zfill
17
32
  """
18
33
 
19
34
 
@@ -4,6 +4,7 @@
4
4
  """ Node for the calls to the 'complex' built-in.
5
5
 
6
6
  """
7
+
7
8
  from nuitka.specs import BuiltinParameterSpecs
8
9
 
9
10
  from .ChildrenHavingMixins import (
@@ -8,6 +8,7 @@ result prediction will help to be smarter, but generally these should not be tha
8
8
  about performance critical.
9
9
 
10
10
  """
11
+
11
12
  from nuitka.PythonVersions import python_version
12
13
  from nuitka.specs import BuiltinParameterSpecs
13
14
 
@@ -203,9 +203,11 @@ class StatementSpecialUnpackCheckFromIterated(
203
203
  result = makeRaiseExceptionReplacementStatement(
204
204
  statement=self,
205
205
  exception_type="ValueError",
206
- exception_value="too many values to unpack"
207
- if python_version < 0x300
208
- else "too many values to unpack (expected %d)" % self.count,
206
+ exception_value=(
207
+ "too many values to unpack"
208
+ if python_version < 0x300
209
+ else "too many values to unpack (expected %d)" % self.count
210
+ ),
209
211
  )
210
212
 
211
213
  trace_collection.onExceptionRaiseExit(TypeError)