Nuitka-winsvc 2.7.7__cp313-cp313-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 (995) hide show
  1. nuitka/Builtins.py +259 -0
  2. nuitka/BytecodeCaching.py +184 -0
  3. nuitka/Bytecodes.py +109 -0
  4. nuitka/CacheCleanup.py +54 -0
  5. nuitka/Constants.py +425 -0
  6. nuitka/Errors.py +93 -0
  7. nuitka/HardImportRegistry.py +408 -0
  8. nuitka/MainControl.py +1201 -0
  9. nuitka/ModuleRegistry.py +364 -0
  10. nuitka/OptionParsing.py +2473 -0
  11. nuitka/Options.py +2948 -0
  12. nuitka/OutputDirectories.py +201 -0
  13. nuitka/PostProcessing.py +551 -0
  14. nuitka/Progress.py +252 -0
  15. nuitka/PythonFlavors.py +426 -0
  16. nuitka/PythonOperators.py +146 -0
  17. nuitka/PythonVersions.py +513 -0
  18. nuitka/Serialization.py +291 -0
  19. nuitka/SourceCodeReferences.py +176 -0
  20. nuitka/Tracing.py +579 -0
  21. nuitka/TreeXML.py +141 -0
  22. nuitka/Variables.py +515 -0
  23. nuitka/Version.py +88 -0
  24. nuitka/__init__.py +19 -0
  25. nuitka/__main__.py +224 -0
  26. nuitka/__past__.py +217 -0
  27. nuitka/build/Backend.scons +1111 -0
  28. nuitka/build/CCompilerVersion.scons +281 -0
  29. nuitka/build/DataComposerInterface.py +116 -0
  30. nuitka/build/Offsets.scons +626 -0
  31. nuitka/build/Onefile.scons +564 -0
  32. nuitka/build/SconsCaching.py +451 -0
  33. nuitka/build/SconsCompilerSettings.py +1133 -0
  34. nuitka/build/SconsHacks.py +215 -0
  35. nuitka/build/SconsInterface.py +664 -0
  36. nuitka/build/SconsProgress.py +100 -0
  37. nuitka/build/SconsSpawn.py +436 -0
  38. nuitka/build/SconsUtils.py +939 -0
  39. nuitka/build/__init__.py +19 -0
  40. nuitka/build/include/nuitka/allocator.h +450 -0
  41. nuitka/build/include/nuitka/builtins.h +97 -0
  42. nuitka/build/include/nuitka/calling.h +123 -0
  43. nuitka/build/include/nuitka/checkers.h +39 -0
  44. nuitka/build/include/nuitka/checksum_tools.h +28 -0
  45. nuitka/build/include/nuitka/compiled_asyncgen.h +281 -0
  46. nuitka/build/include/nuitka/compiled_cell.h +64 -0
  47. nuitka/build/include/nuitka/compiled_coroutine.h +271 -0
  48. nuitka/build/include/nuitka/compiled_frame.h +502 -0
  49. nuitka/build/include/nuitka/compiled_function.h +170 -0
  50. nuitka/build/include/nuitka/compiled_generator.h +287 -0
  51. nuitka/build/include/nuitka/compiled_method.h +54 -0
  52. nuitka/build/include/nuitka/constants.h +251 -0
  53. nuitka/build/include/nuitka/constants_blob.h +34 -0
  54. nuitka/build/include/nuitka/debug_settings.h +60 -0
  55. nuitka/build/include/nuitka/environment_variables.h +30 -0
  56. nuitka/build/include/nuitka/environment_variables_system.h +51 -0
  57. nuitka/build/include/nuitka/exception_groups.h +167 -0
  58. nuitka/build/include/nuitka/exceptions.h +1458 -0
  59. nuitka/build/include/nuitka/filesystem_paths.h +117 -0
  60. nuitka/build/include/nuitka/freelists.h +92 -0
  61. nuitka/build/include/nuitka/hedley.h +1774 -0
  62. nuitka/build/include/nuitka/helper/attributes.h +90 -0
  63. nuitka/build/include/nuitka/helper/boolean.h +86 -0
  64. nuitka/build/include/nuitka/helper/bytearrays.h +34 -0
  65. nuitka/build/include/nuitka/helper/bytes.h +28 -0
  66. nuitka/build/include/nuitka/helper/calling_generated.h +132 -0
  67. nuitka/build/include/nuitka/helper/comparisons_dual_eq.h +47 -0
  68. nuitka/build/include/nuitka/helper/comparisons_dual_ge.h +39 -0
  69. nuitka/build/include/nuitka/helper/comparisons_dual_gt.h +39 -0
  70. nuitka/build/include/nuitka/helper/comparisons_dual_le.h +47 -0
  71. nuitka/build/include/nuitka/helper/comparisons_dual_lt.h +47 -0
  72. nuitka/build/include/nuitka/helper/comparisons_dual_ne.h +39 -0
  73. nuitka/build/include/nuitka/helper/comparisons_eq.h +247 -0
  74. nuitka/build/include/nuitka/helper/comparisons_ge.h +197 -0
  75. nuitka/build/include/nuitka/helper/comparisons_gt.h +197 -0
  76. nuitka/build/include/nuitka/helper/comparisons_le.h +247 -0
  77. nuitka/build/include/nuitka/helper/comparisons_lt.h +247 -0
  78. nuitka/build/include/nuitka/helper/comparisons_ne.h +197 -0
  79. nuitka/build/include/nuitka/helper/complex.h +46 -0
  80. nuitka/build/include/nuitka/helper/dictionaries.h +481 -0
  81. nuitka/build/include/nuitka/helper/floats.h +32 -0
  82. nuitka/build/include/nuitka/helper/import_hard.h +121 -0
  83. nuitka/build/include/nuitka/helper/indexes.h +47 -0
  84. nuitka/build/include/nuitka/helper/ints.h +165 -0
  85. nuitka/build/include/nuitka/helper/iterators.h +376 -0
  86. nuitka/build/include/nuitka/helper/lists.h +94 -0
  87. nuitka/build/include/nuitka/helper/lists_generated.h +36 -0
  88. nuitka/build/include/nuitka/helper/mappings.h +39 -0
  89. nuitka/build/include/nuitka/helper/operations.h +114 -0
  90. nuitka/build/include/nuitka/helper/operations_binary_add.h +240 -0
  91. nuitka/build/include/nuitka/helper/operations_binary_bitand.h +108 -0
  92. nuitka/build/include/nuitka/helper/operations_binary_bitor.h +108 -0
  93. nuitka/build/include/nuitka/helper/operations_binary_bitxor.h +108 -0
  94. nuitka/build/include/nuitka/helper/operations_binary_divmod.h +103 -0
  95. nuitka/build/include/nuitka/helper/operations_binary_dual_add.h +34 -0
  96. nuitka/build/include/nuitka/helper/operations_binary_floordiv.h +103 -0
  97. nuitka/build/include/nuitka/helper/operations_binary_lshift.h +99 -0
  98. nuitka/build/include/nuitka/helper/operations_binary_matmult.h +60 -0
  99. nuitka/build/include/nuitka/helper/operations_binary_mod.h +304 -0
  100. nuitka/build/include/nuitka/helper/operations_binary_mult.h +247 -0
  101. nuitka/build/include/nuitka/helper/operations_binary_olddiv.h +125 -0
  102. nuitka/build/include/nuitka/helper/operations_binary_pow.h +90 -0
  103. nuitka/build/include/nuitka/helper/operations_binary_rshift.h +99 -0
  104. nuitka/build/include/nuitka/helper/operations_binary_sub.h +117 -0
  105. nuitka/build/include/nuitka/helper/operations_binary_truediv.h +103 -0
  106. nuitka/build/include/nuitka/helper/operations_builtin_types.h +247 -0
  107. nuitka/build/include/nuitka/helper/operations_inplace_add.h +173 -0
  108. nuitka/build/include/nuitka/helper/operations_inplace_bitand.h +76 -0
  109. nuitka/build/include/nuitka/helper/operations_inplace_bitor.h +76 -0
  110. nuitka/build/include/nuitka/helper/operations_inplace_bitxor.h +76 -0
  111. nuitka/build/include/nuitka/helper/operations_inplace_floordiv.h +95 -0
  112. nuitka/build/include/nuitka/helper/operations_inplace_lshift.h +62 -0
  113. nuitka/build/include/nuitka/helper/operations_inplace_matmult.h +60 -0
  114. nuitka/build/include/nuitka/helper/operations_inplace_mod.h +218 -0
  115. nuitka/build/include/nuitka/helper/operations_inplace_mult.h +184 -0
  116. nuitka/build/include/nuitka/helper/operations_inplace_olddiv.h +115 -0
  117. nuitka/build/include/nuitka/helper/operations_inplace_pow.h +87 -0
  118. nuitka/build/include/nuitka/helper/operations_inplace_rshift.h +62 -0
  119. nuitka/build/include/nuitka/helper/operations_inplace_sub.h +102 -0
  120. nuitka/build/include/nuitka/helper/operations_inplace_truediv.h +95 -0
  121. nuitka/build/include/nuitka/helper/raising.h +114 -0
  122. nuitka/build/include/nuitka/helper/rangeobjects.h +66 -0
  123. nuitka/build/include/nuitka/helper/richcomparisons.h +35 -0
  124. nuitka/build/include/nuitka/helper/sequences.h +33 -0
  125. nuitka/build/include/nuitka/helper/sets.h +25 -0
  126. nuitka/build/include/nuitka/helper/slices.h +314 -0
  127. nuitka/build/include/nuitka/helper/strings.h +30 -0
  128. nuitka/build/include/nuitka/helper/subscripts.h +390 -0
  129. nuitka/build/include/nuitka/helper/tuples.h +187 -0
  130. nuitka/build/include/nuitka/helpers.h +417 -0
  131. nuitka/build/include/nuitka/importing.h +149 -0
  132. nuitka/build/include/nuitka/incbin.h +402 -0
  133. nuitka/build/include/nuitka/jit_sources.h +25 -0
  134. nuitka/build/include/nuitka/prelude.h +626 -0
  135. nuitka/build/include/nuitka/printing.h +84 -0
  136. nuitka/build/include/nuitka/python_pgo.h +57 -0
  137. nuitka/build/include/nuitka/safe_string_ops.h +57 -0
  138. nuitka/build/include/nuitka/threading.h +142 -0
  139. nuitka/build/include/nuitka/tracing.h +82 -0
  140. nuitka/build/include/nuitka/type_aliases.h +30 -0
  141. nuitka/build/include/nuitka/unfreezing.h +91 -0
  142. nuitka/build/inline_copy/appdirs/LICENSE.txt +23 -0
  143. nuitka/build/inline_copy/appdirs/appdirs.py +611 -0
  144. nuitka/build/inline_copy/atomicwrites/LICENSE +19 -0
  145. nuitka/build/inline_copy/atomicwrites/atomicwrites.py +226 -0
  146. nuitka/build/inline_copy/bin/scons.py +58 -0
  147. nuitka/build/inline_copy/clcache/clcache/LICENSE +30 -0
  148. nuitka/build/inline_copy/clcache/clcache/__init__.py +4 -0
  149. nuitka/build/inline_copy/clcache/clcache/caching.py +2008 -0
  150. nuitka/build/inline_copy/colorama/LICENSE.txt +27 -0
  151. nuitka/build/inline_copy/colorama/colorama/__init__.py +6 -0
  152. nuitka/build/inline_copy/colorama/colorama/ansi.py +102 -0
  153. nuitka/build/inline_copy/colorama/colorama/ansitowin32.py +258 -0
  154. nuitka/build/inline_copy/colorama/colorama/initialise.py +80 -0
  155. nuitka/build/inline_copy/colorama/colorama/win32.py +152 -0
  156. nuitka/build/inline_copy/colorama/colorama/winterm.py +169 -0
  157. nuitka/build/inline_copy/glob2/LICENSE +27 -0
  158. nuitka/build/inline_copy/glob2/glob2/__init__.py +5 -0
  159. nuitka/build/inline_copy/glob2/glob2/compat.py +167 -0
  160. nuitka/build/inline_copy/glob2/glob2/fnmatch.py +141 -0
  161. nuitka/build/inline_copy/glob2/glob2/impl.py +216 -0
  162. nuitka/build/inline_copy/jinja2/LICENSE.rst +28 -0
  163. nuitka/build/inline_copy/jinja2/README.rst +2 -0
  164. nuitka/build/inline_copy/jinja2/jinja2/__init__.py +72 -0
  165. nuitka/build/inline_copy/jinja2/jinja2/_compat.py +105 -0
  166. nuitka/build/inline_copy/jinja2/jinja2/_identifier.py +2 -0
  167. nuitka/build/inline_copy/jinja2/jinja2/bccache.py +361 -0
  168. nuitka/build/inline_copy/jinja2/jinja2/compiler.py +1721 -0
  169. nuitka/build/inline_copy/jinja2/jinja2/constants.py +32 -0
  170. nuitka/build/inline_copy/jinja2/jinja2/debug.py +378 -0
  171. nuitka/build/inline_copy/jinja2/jinja2/defaults.py +56 -0
  172. nuitka/build/inline_copy/jinja2/jinja2/environment.py +1276 -0
  173. nuitka/build/inline_copy/jinja2/jinja2/exceptions.py +146 -0
  174. nuitka/build/inline_copy/jinja2/jinja2/ext.py +627 -0
  175. nuitka/build/inline_copy/jinja2/jinja2/filters.py +1190 -0
  176. nuitka/build/inline_copy/jinja2/jinja2/idtracking.py +286 -0
  177. nuitka/build/inline_copy/jinja2/jinja2/lexer.py +739 -0
  178. nuitka/build/inline_copy/jinja2/jinja2/loaders.py +483 -0
  179. nuitka/build/inline_copy/jinja2/jinja2/meta.py +106 -0
  180. nuitka/build/inline_copy/jinja2/jinja2/nativetypes.py +220 -0
  181. nuitka/build/inline_copy/jinja2/jinja2/nodes.py +999 -0
  182. nuitka/build/inline_copy/jinja2/jinja2/optimizer.py +49 -0
  183. nuitka/build/inline_copy/jinja2/jinja2/parser.py +903 -0
  184. nuitka/build/inline_copy/jinja2/jinja2/runtime.py +808 -0
  185. nuitka/build/inline_copy/jinja2/jinja2/sandbox.py +488 -0
  186. nuitka/build/inline_copy/jinja2/jinja2/tests.py +174 -0
  187. nuitka/build/inline_copy/jinja2/jinja2/utils.py +642 -0
  188. nuitka/build/inline_copy/jinja2/jinja2/visitor.py +87 -0
  189. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Action.py +1475 -0
  190. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Builder.py +905 -0
  191. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/CacheDir.py +314 -0
  192. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Conftest.py +805 -0
  193. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Debug.py +251 -0
  194. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Defaults.py +646 -0
  195. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Environment.py +2561 -0
  196. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/EnvironmentValues.py +119 -0
  197. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Errors.py +222 -0
  198. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Executor.py +660 -0
  199. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Job.py +439 -0
  200. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Memoize.py +242 -0
  201. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Alias.py +176 -0
  202. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/FS.py +3861 -0
  203. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Python.py +195 -0
  204. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/__init__.py +1784 -0
  205. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/PathList.py +224 -0
  206. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/__init__.py +341 -0
  207. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/aix.py +81 -0
  208. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/cygwin.py +61 -0
  209. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/darwin.py +70 -0
  210. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/hpux.py +45 -0
  211. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/irix.py +41 -0
  212. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/mingw.py +33 -0
  213. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/os2.py +55 -0
  214. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/posix.py +124 -0
  215. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/sunos.py +47 -0
  216. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/virtualenv.py +115 -0
  217. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Platform/win32.py +429 -0
  218. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConf.py +1119 -0
  219. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/SConsign.py +453 -0
  220. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/C.py +226 -0
  221. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Dir.py +131 -0
  222. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/Prog.py +114 -0
  223. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/RC.py +57 -0
  224. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Scanner/__init__.py +436 -0
  225. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Interactive.py +372 -0
  226. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/Main.py +1469 -0
  227. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConsOptions.py +1071 -0
  228. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/SConscript.py +686 -0
  229. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Script/__init__.py +425 -0
  230. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Subst.py +979 -0
  231. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Taskmaster.py +1062 -0
  232. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/386asm.py +61 -0
  233. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/GettextCommon.py +429 -0
  234. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/__init__.py +52 -0
  235. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/arch.py +66 -0
  236. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/common.py +371 -0
  237. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/netframework.py +83 -0
  238. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/sdk.py +411 -0
  239. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vc.py +994 -0
  240. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/MSCommon/vs.py +608 -0
  241. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/PharLapCommon.py +116 -0
  242. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/__init__.py +882 -0
  243. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixc++.py +43 -0
  244. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcc.py +74 -0
  245. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixcxx.py +77 -0
  246. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/aixlink.py +78 -0
  247. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/applelink.py +209 -0
  248. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ar.py +63 -0
  249. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/as.py +49 -0
  250. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/asm.py +78 -0
  251. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/bcc32.py +81 -0
  252. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/c++.py +44 -0
  253. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cc.py +105 -0
  254. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clang.py +91 -0
  255. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangCommon/__init__.py +18 -0
  256. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/clangxx.py +99 -0
  257. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cxx.py +95 -0
  258. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/cyglink.py +212 -0
  259. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/default.py +50 -0
  260. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/filesystem.py +98 -0
  261. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/g++.py +45 -0
  262. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gas.py +56 -0
  263. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gcc.py +110 -0
  264. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gettext_tool.py +69 -0
  265. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gnulink.py +70 -0
  266. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/gxx.py +78 -0
  267. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpc++.py +45 -0
  268. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcc.py +53 -0
  269. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hpcxx.py +88 -0
  270. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/hplink.py +72 -0
  271. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icc.py +59 -0
  272. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/icl.py +52 -0
  273. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink.py +55 -0
  274. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/ilink32.py +60 -0
  275. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/install.py +510 -0
  276. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/intelc.py +617 -0
  277. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/link.py +72 -0
  278. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/LoadableModule.py +131 -0
  279. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/SharedLibrary.py +218 -0
  280. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkCommon/__init__.py +171 -0
  281. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/linkloc.py +112 -0
  282. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/m4.py +63 -0
  283. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/masm.py +77 -0
  284. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mingw.py +232 -0
  285. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgfmt.py +132 -0
  286. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msginit.py +137 -0
  287. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msgmerge.py +125 -0
  288. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslib.py +73 -0
  289. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mslink.py +339 -0
  290. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mssdk.py +50 -0
  291. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvc.py +325 -0
  292. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/msvs.py +2116 -0
  293. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwcc.py +207 -0
  294. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/mwld.py +108 -0
  295. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/nasm.py +72 -0
  296. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rmic.py +139 -0
  297. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/rpcgen.py +70 -0
  298. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgiar.py +68 -0
  299. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgic++.py +43 -0
  300. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicc.py +53 -0
  301. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgicxx.py +61 -0
  302. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sgilink.py +59 -0
  303. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunar.py +64 -0
  304. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunc++.py +45 -0
  305. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncc.py +58 -0
  306. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/suncxx.py +153 -0
  307. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/sunlink.py +79 -0
  308. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tar.py +73 -0
  309. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/textfile.py +198 -0
  310. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/tlib.py +53 -0
  311. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/wix.py +104 -0
  312. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/xgettext.py +337 -0
  313. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Tool/zip.py +120 -0
  314. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Util.py +2134 -0
  315. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/ConfigureCache.py +171 -0
  316. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/__init__.py +0 -0
  317. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Utilities/sconsign.py +494 -0
  318. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/BoolVariable.py +96 -0
  319. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/EnumVariable.py +110 -0
  320. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/ListVariable.py +152 -0
  321. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PackageVariable.py +107 -0
  322. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/PathVariable.py +158 -0
  323. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Variables/__init__.py +334 -0
  324. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Warnings.py +238 -0
  325. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/__init__.py +9 -0
  326. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/__init__.py +104 -0
  327. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/_scons_dbm.py +42 -0
  328. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/compat/win32.py +101 -0
  329. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/cpp.py +640 -0
  330. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/dblite.py +295 -0
  331. nuitka/build/inline_copy/lib/scons-4.3.0/SCons/exitfuncs.py +59 -0
  332. nuitka/build/inline_copy/markupsafe/LICENSE.rst +28 -0
  333. nuitka/build/inline_copy/markupsafe/markupsafe/__init__.py +327 -0
  334. nuitka/build/inline_copy/markupsafe/markupsafe/_compat.py +33 -0
  335. nuitka/build/inline_copy/markupsafe/markupsafe/_constants.py +264 -0
  336. nuitka/build/inline_copy/markupsafe/markupsafe/_native.py +69 -0
  337. nuitka/build/inline_copy/pefile/LICENSE.txt +21 -0
  338. nuitka/build/inline_copy/pefile/ordlookup/__init__.py +41 -0
  339. nuitka/build/inline_copy/pefile/ordlookup/oleaut32.py +400 -0
  340. nuitka/build/inline_copy/pefile/ordlookup/ws2_32.py +120 -0
  341. nuitka/build/inline_copy/pefile/pefile.py +8034 -0
  342. nuitka/build/inline_copy/pkg_resources/pkg_resources/__init__.py +3272 -0
  343. nuitka/build/inline_copy/pkg_resources/pkg_resources/py31compat.py +21 -0
  344. nuitka/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  345. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  346. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  347. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  348. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  349. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  350. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  351. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  352. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  353. nuitka/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  354. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  355. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  356. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  357. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  358. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  359. nuitka/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  360. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  361. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  362. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  363. nuitka/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  364. nuitka/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  365. nuitka/build/inline_copy/stubgen/astunparse.py +938 -0
  366. nuitka/build/inline_copy/stubgen/six.py +998 -0
  367. nuitka/build/inline_copy/stubgen/stubgen.py +484 -0
  368. nuitka/build/inline_copy/tqdm/tqdm/__init__.py +40 -0
  369. nuitka/build/inline_copy/tqdm/tqdm/_main.py +9 -0
  370. nuitka/build/inline_copy/tqdm/tqdm/_monitor.py +97 -0
  371. nuitka/build/inline_copy/tqdm/tqdm/_tqdm.py +9 -0
  372. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_notebook.py +9 -0
  373. nuitka/build/inline_copy/tqdm/tqdm/_tqdm_pandas.py +24 -0
  374. nuitka/build/inline_copy/tqdm/tqdm/_utils.py +12 -0
  375. nuitka/build/inline_copy/tqdm/tqdm/auto.py +44 -0
  376. nuitka/build/inline_copy/tqdm/tqdm/autonotebook.py +28 -0
  377. nuitka/build/inline_copy/tqdm/tqdm/dask.py +46 -0
  378. nuitka/build/inline_copy/tqdm/tqdm/notebook.py +316 -0
  379. nuitka/build/inline_copy/tqdm/tqdm/std.py +1524 -0
  380. nuitka/build/inline_copy/tqdm/tqdm/tk.py +207 -0
  381. nuitka/build/inline_copy/tqdm/tqdm/utils.py +351 -0
  382. nuitka/build/inline_copy/tqdm/tqdm/version.py +2 -0
  383. nuitka/build/inline_copy/yaml/LICENSE +20 -0
  384. nuitka/build/inline_copy/yaml/yaml/__init__.py +427 -0
  385. nuitka/build/inline_copy/yaml/yaml/composer.py +139 -0
  386. nuitka/build/inline_copy/yaml/yaml/constructor.py +748 -0
  387. nuitka/build/inline_copy/yaml/yaml/cyaml.py +101 -0
  388. nuitka/build/inline_copy/yaml/yaml/dumper.py +62 -0
  389. nuitka/build/inline_copy/yaml/yaml/emitter.py +1137 -0
  390. nuitka/build/inline_copy/yaml/yaml/error.py +75 -0
  391. nuitka/build/inline_copy/yaml/yaml/events.py +86 -0
  392. nuitka/build/inline_copy/yaml/yaml/loader.py +63 -0
  393. nuitka/build/inline_copy/yaml/yaml/nodes.py +49 -0
  394. nuitka/build/inline_copy/yaml/yaml/parser.py +589 -0
  395. nuitka/build/inline_copy/yaml/yaml/reader.py +185 -0
  396. nuitka/build/inline_copy/yaml/yaml/representer.py +389 -0
  397. nuitka/build/inline_copy/yaml/yaml/resolver.py +227 -0
  398. nuitka/build/inline_copy/yaml/yaml/scanner.py +1435 -0
  399. nuitka/build/inline_copy/yaml/yaml/serializer.py +111 -0
  400. nuitka/build/inline_copy/yaml/yaml/tokens.py +104 -0
  401. nuitka/build/inline_copy/zlib/LICENSE +22 -0
  402. nuitka/build/inline_copy/zlib/crc32.c +1049 -0
  403. nuitka/build/inline_copy/zlib/crc32.h +9446 -0
  404. nuitka/build/inline_copy/zlib/zconf.h +551 -0
  405. nuitka/build/inline_copy/zlib/zlib.h +1938 -0
  406. nuitka/build/inline_copy/zlib/zutil.h +275 -0
  407. nuitka/build/inline_copy/zstd/LICENSE.txt +30 -0
  408. nuitka/build/inline_copy/zstd/common/bitstream.h +463 -0
  409. nuitka/build/inline_copy/zstd/common/compiler.h +288 -0
  410. nuitka/build/inline_copy/zstd/common/cpu.h +213 -0
  411. nuitka/build/inline_copy/zstd/common/debug.h +107 -0
  412. nuitka/build/inline_copy/zstd/common/entropy_common.c +360 -0
  413. nuitka/build/inline_copy/zstd/common/error_private.c +56 -0
  414. nuitka/build/inline_copy/zstd/common/error_private.h +80 -0
  415. nuitka/build/inline_copy/zstd/common/fse.h +715 -0
  416. nuitka/build/inline_copy/zstd/common/fse_decompress.c +393 -0
  417. nuitka/build/inline_copy/zstd/common/huf.h +361 -0
  418. nuitka/build/inline_copy/zstd/common/mem.h +426 -0
  419. nuitka/build/inline_copy/zstd/common/xxhash.c +826 -0
  420. nuitka/build/inline_copy/zstd/common/xxhash.h +285 -0
  421. nuitka/build/inline_copy/zstd/common/zstd_common.c +83 -0
  422. nuitka/build/inline_copy/zstd/common/zstd_deps.h +111 -0
  423. nuitka/build/inline_copy/zstd/common/zstd_errors.h +95 -0
  424. nuitka/build/inline_copy/zstd/common/zstd_internal.h +478 -0
  425. nuitka/build/inline_copy/zstd/decompress/huf_decompress.c +1350 -0
  426. nuitka/build/inline_copy/zstd/decompress/zstd_ddict.c +244 -0
  427. nuitka/build/inline_copy/zstd/decompress/zstd_ddict.h +44 -0
  428. nuitka/build/inline_copy/zstd/decompress/zstd_decompress.c +1930 -0
  429. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.c +1540 -0
  430. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_block.h +62 -0
  431. nuitka/build/inline_copy/zstd/decompress/zstd_decompress_internal.h +190 -0
  432. nuitka/build/inline_copy/zstd/zstd.h +2391 -0
  433. nuitka/build/static_src/CompiledAsyncgenType.c +2211 -0
  434. nuitka/build/static_src/CompiledCellType.c +300 -0
  435. nuitka/build/static_src/CompiledCodeHelpers.c +2160 -0
  436. nuitka/build/static_src/CompiledCoroutineType.c +1946 -0
  437. nuitka/build/static_src/CompiledFrameType.c +1337 -0
  438. nuitka/build/static_src/CompiledFunctionType.c +3320 -0
  439. nuitka/build/static_src/CompiledGeneratorType.c +1997 -0
  440. nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2117 -0
  441. nuitka/build/static_src/CompiledMethodType.c +614 -0
  442. nuitka/build/static_src/GenerateHeadersMain.c +30 -0
  443. nuitka/build/static_src/HelpersAllocator.c +939 -0
  444. nuitka/build/static_src/HelpersAttributes.c +1241 -0
  445. nuitka/build/static_src/HelpersBuiltin.c +901 -0
  446. nuitka/build/static_src/HelpersBuiltinTypeMethods.c +3594 -0
  447. nuitka/build/static_src/HelpersBytes.c +107 -0
  448. nuitka/build/static_src/HelpersCalling.c +397 -0
  449. nuitka/build/static_src/HelpersCallingGenerated.c +14361 -0
  450. nuitka/build/static_src/HelpersChecksumTools.c +59 -0
  451. nuitka/build/static_src/HelpersClasses.c +91 -0
  452. nuitka/build/static_src/HelpersComparisonDualEq.c +183 -0
  453. nuitka/build/static_src/HelpersComparisonDualGe.c +121 -0
  454. nuitka/build/static_src/HelpersComparisonDualGt.c +121 -0
  455. nuitka/build/static_src/HelpersComparisonDualLe.c +183 -0
  456. nuitka/build/static_src/HelpersComparisonDualLt.c +183 -0
  457. nuitka/build/static_src/HelpersComparisonDualNe.c +121 -0
  458. nuitka/build/static_src/HelpersComparisonEq.c +12070 -0
  459. nuitka/build/static_src/HelpersComparisonEqUtils.c +169 -0
  460. nuitka/build/static_src/HelpersComparisonGe.c +11871 -0
  461. nuitka/build/static_src/HelpersComparisonGt.c +11855 -0
  462. nuitka/build/static_src/HelpersComparisonLe.c +11957 -0
  463. nuitka/build/static_src/HelpersComparisonLt.c +11941 -0
  464. nuitka/build/static_src/HelpersComparisonNe.c +11979 -0
  465. nuitka/build/static_src/HelpersConsole.c +124 -0
  466. nuitka/build/static_src/HelpersConstantsBlob.c +1487 -0
  467. nuitka/build/static_src/HelpersDeepcopy.c +636 -0
  468. nuitka/build/static_src/HelpersDictionaries.c +1739 -0
  469. nuitka/build/static_src/HelpersDictionariesGenerated.c +738 -0
  470. nuitka/build/static_src/HelpersDumpBacktraces.c +63 -0
  471. nuitka/build/static_src/HelpersEnvironmentVariables.c +65 -0
  472. nuitka/build/static_src/HelpersEnvironmentVariablesSystem.c +97 -0
  473. nuitka/build/static_src/HelpersExceptions.c +298 -0
  474. nuitka/build/static_src/HelpersFiles.c +353 -0
  475. nuitka/build/static_src/HelpersFilesystemPaths.c +1322 -0
  476. nuitka/build/static_src/HelpersFloats.c +92 -0
  477. nuitka/build/static_src/HelpersHeapStorage.c +68 -0
  478. nuitka/build/static_src/HelpersImport.c +506 -0
  479. nuitka/build/static_src/HelpersImportHard.c +526 -0
  480. nuitka/build/static_src/HelpersJitSources.c +48 -0
  481. nuitka/build/static_src/HelpersLists.c +899 -0
  482. nuitka/build/static_src/HelpersListsGenerated.c +564 -0
  483. nuitka/build/static_src/HelpersMappings.c +46 -0
  484. nuitka/build/static_src/HelpersMatching.c +192 -0
  485. nuitka/build/static_src/HelpersOperationBinaryAdd.c +6477 -0
  486. nuitka/build/static_src/HelpersOperationBinaryAddUtils.c +703 -0
  487. nuitka/build/static_src/HelpersOperationBinaryBitand.c +2738 -0
  488. nuitka/build/static_src/HelpersOperationBinaryBitor.c +2738 -0
  489. nuitka/build/static_src/HelpersOperationBinaryBitxor.c +2738 -0
  490. nuitka/build/static_src/HelpersOperationBinaryDivmod.c +2406 -0
  491. nuitka/build/static_src/HelpersOperationBinaryDivmodUtils.c +33 -0
  492. nuitka/build/static_src/HelpersOperationBinaryDualAdd.c +172 -0
  493. nuitka/build/static_src/HelpersOperationBinaryFloordiv.c +2422 -0
  494. nuitka/build/static_src/HelpersOperationBinaryInplaceAdd.c +220 -0
  495. nuitka/build/static_src/HelpersOperationBinaryLshift.c +2846 -0
  496. nuitka/build/static_src/HelpersOperationBinaryMatmult.c +453 -0
  497. nuitka/build/static_src/HelpersOperationBinaryMod.c +6549 -0
  498. nuitka/build/static_src/HelpersOperationBinaryMult.c +6438 -0
  499. nuitka/build/static_src/HelpersOperationBinaryMultUtils.c +125 -0
  500. nuitka/build/static_src/HelpersOperationBinaryOlddiv.c +2355 -0
  501. nuitka/build/static_src/HelpersOperationBinaryPow.c +2743 -0
  502. nuitka/build/static_src/HelpersOperationBinaryPowUtils.c +26 -0
  503. nuitka/build/static_src/HelpersOperationBinaryRshift.c +2706 -0
  504. nuitka/build/static_src/HelpersOperationBinarySub.c +2649 -0
  505. nuitka/build/static_src/HelpersOperationBinaryTruediv.c +2415 -0
  506. nuitka/build/static_src/HelpersOperationInplaceAdd.c +5211 -0
  507. nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +144 -0
  508. nuitka/build/static_src/HelpersOperationInplaceBitand.c +1826 -0
  509. nuitka/build/static_src/HelpersOperationInplaceBitor.c +1826 -0
  510. nuitka/build/static_src/HelpersOperationInplaceBitxor.c +1826 -0
  511. nuitka/build/static_src/HelpersOperationInplaceFloordiv.c +2605 -0
  512. nuitka/build/static_src/HelpersOperationInplaceLshift.c +1594 -0
  513. nuitka/build/static_src/HelpersOperationInplaceMatmult.c +603 -0
  514. nuitka/build/static_src/HelpersOperationInplaceMod.c +4762 -0
  515. nuitka/build/static_src/HelpersOperationInplaceMult.c +4689 -0
  516. nuitka/build/static_src/HelpersOperationInplaceOlddiv.c +2553 -0
  517. nuitka/build/static_src/HelpersOperationInplacePow.c +2807 -0
  518. nuitka/build/static_src/HelpersOperationInplaceRshift.c +1534 -0
  519. nuitka/build/static_src/HelpersOperationInplaceSub.c +2894 -0
  520. nuitka/build/static_src/HelpersOperationInplaceTruediv.c +2612 -0
  521. nuitka/build/static_src/HelpersProfiling.c +104 -0
  522. nuitka/build/static_src/HelpersPythonPgo.c +113 -0
  523. nuitka/build/static_src/HelpersRaising.c +447 -0
  524. nuitka/build/static_src/HelpersSafeStrings.c +185 -0
  525. nuitka/build/static_src/HelpersSequences.c +134 -0
  526. nuitka/build/static_src/HelpersSlices.c +73 -0
  527. nuitka/build/static_src/HelpersStrings.c +998 -0
  528. nuitka/build/static_src/HelpersTuples.c +148 -0
  529. nuitka/build/static_src/HelpersTypes.c +329 -0
  530. nuitka/build/static_src/InspectPatcher.c +439 -0
  531. nuitka/build/static_src/MainProgram.c +2060 -0
  532. nuitka/build/static_src/MetaPathBasedLoader.c +2290 -0
  533. nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +125 -0
  534. nuitka/build/static_src/MetaPathBasedLoaderResourceReader.c +158 -0
  535. nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +785 -0
  536. nuitka/build/static_src/OnefileBootstrap.c +1580 -0
  537. nuitka/build/static_src/OnefileSplashScreen.cpp +275 -0
  538. nuitka/code_generation/AsyncgenCodes.py +186 -0
  539. nuitka/code_generation/AttributeCodes.py +357 -0
  540. nuitka/code_generation/BinaryOperationHelperDefinitions.py +720 -0
  541. nuitka/code_generation/BranchCodes.py +67 -0
  542. nuitka/code_generation/BuiltinCodes.py +529 -0
  543. nuitka/code_generation/CallCodes.py +1186 -0
  544. nuitka/code_generation/ClassCodes.py +156 -0
  545. nuitka/code_generation/CodeGeneration.py +1078 -0
  546. nuitka/code_generation/CodeHelperSelection.py +81 -0
  547. nuitka/code_generation/CodeHelpers.py +455 -0
  548. nuitka/code_generation/CodeObjectCodes.py +165 -0
  549. nuitka/code_generation/ComparisonCodes.py +569 -0
  550. nuitka/code_generation/ComparisonHelperDefinitions.py +146 -0
  551. nuitka/code_generation/ConditionalCodes.py +236 -0
  552. nuitka/code_generation/ConstantCodes.py +243 -0
  553. nuitka/code_generation/Contexts.py +1248 -0
  554. nuitka/code_generation/CoroutineCodes.py +253 -0
  555. nuitka/code_generation/CtypesCodes.py +46 -0
  556. nuitka/code_generation/DictCodes.py +918 -0
  557. nuitka/code_generation/Emission.py +75 -0
  558. nuitka/code_generation/ErrorCodes.py +281 -0
  559. nuitka/code_generation/EvalCodes.py +444 -0
  560. nuitka/code_generation/ExceptionCodes.py +337 -0
  561. nuitka/code_generation/ExpressionCTypeSelectionHelpers.py +227 -0
  562. nuitka/code_generation/ExpressionCodes.py +61 -0
  563. nuitka/code_generation/FrameCodes.py +518 -0
  564. nuitka/code_generation/FunctionCodes.py +858 -0
  565. nuitka/code_generation/GeneratorCodes.py +218 -0
  566. nuitka/code_generation/GlobalConstants.py +249 -0
  567. nuitka/code_generation/GlobalsLocalsCodes.py +211 -0
  568. nuitka/code_generation/IdCodes.py +53 -0
  569. nuitka/code_generation/ImportCodes.py +468 -0
  570. nuitka/code_generation/Indentation.py +45 -0
  571. nuitka/code_generation/IndexCodes.py +50 -0
  572. nuitka/code_generation/InjectCCodes.py +28 -0
  573. nuitka/code_generation/IntegerCodes.py +110 -0
  574. nuitka/code_generation/IteratorCodes.py +378 -0
  575. nuitka/code_generation/JitCodes.py +44 -0
  576. nuitka/code_generation/LabelCodes.py +68 -0
  577. nuitka/code_generation/LineNumberCodes.py +91 -0
  578. nuitka/code_generation/ListCodes.py +502 -0
  579. nuitka/code_generation/LoaderCodes.py +193 -0
  580. nuitka/code_generation/LocalsDictCodes.py +359 -0
  581. nuitka/code_generation/LoopCodes.py +88 -0
  582. nuitka/code_generation/MatchCodes.py +67 -0
  583. nuitka/code_generation/ModuleCodes.py +247 -0
  584. nuitka/code_generation/Namify.py +260 -0
  585. nuitka/code_generation/NetworkxCodes.py +51 -0
  586. nuitka/code_generation/OperationCodes.py +398 -0
  587. nuitka/code_generation/PackageResourceCodes.py +986 -0
  588. nuitka/code_generation/PrintCodes.py +93 -0
  589. nuitka/code_generation/PythonAPICodes.py +215 -0
  590. nuitka/code_generation/RaisingCodes.py +481 -0
  591. nuitka/code_generation/Reports.py +115 -0
  592. nuitka/code_generation/ReturnCodes.py +143 -0
  593. nuitka/code_generation/SetCodes.py +196 -0
  594. nuitka/code_generation/SliceCodes.py +465 -0
  595. nuitka/code_generation/StringCodes.py +303 -0
  596. nuitka/code_generation/SubscriptCodes.py +263 -0
  597. nuitka/code_generation/TensorflowCodes.py +54 -0
  598. nuitka/code_generation/TryCodes.py +326 -0
  599. nuitka/code_generation/TupleCodes.py +115 -0
  600. nuitka/code_generation/TypeAliasCodes.py +120 -0
  601. nuitka/code_generation/VariableCodes.py +519 -0
  602. nuitka/code_generation/VariableDeclarations.py +279 -0
  603. nuitka/code_generation/YieldCodes.py +253 -0
  604. nuitka/code_generation/__init__.py +19 -0
  605. nuitka/code_generation/c_types/CTypeBases.py +177 -0
  606. nuitka/code_generation/c_types/CTypeBooleans.py +104 -0
  607. nuitka/code_generation/c_types/CTypeCFloats.py +57 -0
  608. nuitka/code_generation/c_types/CTypeCLongs.py +45 -0
  609. nuitka/code_generation/c_types/CTypeModuleDictVariables.py +109 -0
  610. nuitka/code_generation/c_types/CTypeNuitkaBooleans.py +150 -0
  611. nuitka/code_generation/c_types/CTypeNuitkaInts.py +200 -0
  612. nuitka/code_generation/c_types/CTypeNuitkaVoids.py +107 -0
  613. nuitka/code_generation/c_types/CTypePyObjectPointers.py +572 -0
  614. nuitka/code_generation/c_types/CTypeVoids.py +92 -0
  615. nuitka/code_generation/c_types/__init__.py +19 -0
  616. nuitka/code_generation/templates/CodeTemplatesAsyncgens.py +106 -0
  617. nuitka/code_generation/templates/CodeTemplatesConstants.py +296 -0
  618. nuitka/code_generation/templates/CodeTemplatesCoroutines.py +109 -0
  619. nuitka/code_generation/templates/CodeTemplatesExceptions.py +84 -0
  620. nuitka/code_generation/templates/CodeTemplatesFrames.py +235 -0
  621. nuitka/code_generation/templates/CodeTemplatesFunction.py +117 -0
  622. nuitka/code_generation/templates/CodeTemplatesGeneratorFunction.py +130 -0
  623. nuitka/code_generation/templates/CodeTemplatesIterators.py +40 -0
  624. nuitka/code_generation/templates/CodeTemplatesLoader.py +180 -0
  625. nuitka/code_generation/templates/CodeTemplatesModules.py +710 -0
  626. nuitka/code_generation/templates/CodeTemplatesVariables.py +388 -0
  627. nuitka/code_generation/templates/TemplateDebugWrapper.py +80 -0
  628. nuitka/code_generation/templates/__init__.py +19 -0
  629. nuitka/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +321 -0
  630. nuitka/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +143 -0
  631. nuitka/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +677 -0
  632. nuitka/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +165 -0
  633. nuitka/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +38 -0
  634. nuitka/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +41 -0
  635. nuitka/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +53 -0
  636. nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +364 -0
  637. nuitka/code_generation/templates_c/HelperImportHard.c.j2 +37 -0
  638. nuitka/code_generation/templates_c/HelperLongTools.c.j2 +53 -0
  639. nuitka/code_generation/templates_c/HelperObjectTools.c.j2 +20 -0
  640. nuitka/code_generation/templates_c/HelperOperationBinary.c.j2 +148 -0
  641. nuitka/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +115 -0
  642. nuitka/code_generation/templates_c/HelperOperationComparison.c.j2 +352 -0
  643. nuitka/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +115 -0
  644. nuitka/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +86 -0
  645. nuitka/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +31 -0
  646. nuitka/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +32 -0
  647. nuitka/code_generation/templates_c/HelperOperationComparisonList.c.j2 +112 -0
  648. nuitka/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +157 -0
  649. nuitka/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +115 -0
  650. nuitka/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +99 -0
  651. nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +115 -0
  652. nuitka/code_generation/templates_c/HelperOperationInplace.c.j2 +281 -0
  653. nuitka/code_generation/templates_c/HelperSlotsBinary.c.j2 +420 -0
  654. nuitka/code_generation/templates_c/HelperSlotsBytes.c.j2 +51 -0
  655. nuitka/code_generation/templates_c/HelperSlotsCommon.c.j2 +71 -0
  656. nuitka/code_generation/templates_c/HelperSlotsFloat.c.j2 +327 -0
  657. nuitka/code_generation/templates_c/HelperSlotsInt.c.j2 +411 -0
  658. nuitka/code_generation/templates_c/HelperSlotsList.c.j2 +59 -0
  659. nuitka/code_generation/templates_c/HelperSlotsLong.c.j2 +229 -0
  660. nuitka/code_generation/templates_c/HelperSlotsSet.c.j2 +47 -0
  661. nuitka/code_generation/templates_c/HelperSlotsStr.c.j2 +55 -0
  662. nuitka/code_generation/templates_c/HelperSlotsTuple.c.j2 +58 -0
  663. nuitka/code_generation/templates_c/HelperSlotsUnicode.c.j2 +62 -0
  664. nuitka/containers/Namedtuples.py +51 -0
  665. nuitka/containers/OrderedDicts.py +191 -0
  666. nuitka/containers/OrderedSets.py +123 -0
  667. nuitka/containers/OrderedSetsFallback.py +139 -0
  668. nuitka/containers/__init__.py +19 -0
  669. nuitka/distutils/Build.py +76 -0
  670. nuitka/distutils/DistutilCommands.py +438 -0
  671. nuitka/distutils/__init__.py +19 -0
  672. nuitka/finalizations/Finalization.py +35 -0
  673. nuitka/finalizations/FinalizeMarkups.py +136 -0
  674. nuitka/finalizations/__init__.py +19 -0
  675. nuitka/freezer/DependsExe.py +257 -0
  676. nuitka/freezer/DllDependenciesCommon.py +97 -0
  677. nuitka/freezer/DllDependenciesMacOS.py +444 -0
  678. nuitka/freezer/DllDependenciesPosix.py +242 -0
  679. nuitka/freezer/DllDependenciesWin32.py +315 -0
  680. nuitka/freezer/ImportDetection.py +359 -0
  681. nuitka/freezer/IncludedDataFiles.py +689 -0
  682. nuitka/freezer/IncludedEntryPoints.py +376 -0
  683. nuitka/freezer/Onefile.py +296 -0
  684. nuitka/freezer/Standalone.py +520 -0
  685. nuitka/freezer/__init__.py +19 -0
  686. nuitka/importing/IgnoreListing.py +449 -0
  687. nuitka/importing/ImportCache.py +95 -0
  688. nuitka/importing/ImportResolving.py +186 -0
  689. nuitka/importing/Importing.py +1200 -0
  690. nuitka/importing/PreloadedPackages.py +164 -0
  691. nuitka/importing/Recursion.py +611 -0
  692. nuitka/importing/StandardLibrary.py +429 -0
  693. nuitka/importing/__init__.py +19 -0
  694. nuitka/nodes/AsyncgenNodes.py +107 -0
  695. nuitka/nodes/AttributeLookupNodes.py +124 -0
  696. nuitka/nodes/AttributeNodes.py +386 -0
  697. nuitka/nodes/AttributeNodesGenerated.py +10734 -0
  698. nuitka/nodes/BuiltinAllNodes.py +115 -0
  699. nuitka/nodes/BuiltinAnyNodes.py +124 -0
  700. nuitka/nodes/BuiltinComplexNodes.py +83 -0
  701. nuitka/nodes/BuiltinDecodingNodes.py +52 -0
  702. nuitka/nodes/BuiltinDecoratorNodes.py +85 -0
  703. nuitka/nodes/BuiltinDictNodes.py +140 -0
  704. nuitka/nodes/BuiltinFormatNodes.py +159 -0
  705. nuitka/nodes/BuiltinHashNodes.py +63 -0
  706. nuitka/nodes/BuiltinInputNodes.py +39 -0
  707. nuitka/nodes/BuiltinIntegerNodes.py +170 -0
  708. nuitka/nodes/BuiltinIteratorNodes.py +391 -0
  709. nuitka/nodes/BuiltinLenNodes.py +61 -0
  710. nuitka/nodes/BuiltinNextNodes.py +111 -0
  711. nuitka/nodes/BuiltinOpenNodes.py +148 -0
  712. nuitka/nodes/BuiltinOperationNodeBasesGenerated.py +7367 -0
  713. nuitka/nodes/BuiltinRangeNodes.py +690 -0
  714. nuitka/nodes/BuiltinRefNodes.py +314 -0
  715. nuitka/nodes/BuiltinSumNodes.py +104 -0
  716. nuitka/nodes/BuiltinTypeNodes.py +454 -0
  717. nuitka/nodes/BuiltinVarsNodes.py +44 -0
  718. nuitka/nodes/BytesNodes.py +829 -0
  719. nuitka/nodes/CallNodes.py +217 -0
  720. nuitka/nodes/Checkers.py +55 -0
  721. nuitka/nodes/ChildrenHavingMixins.py +21576 -0
  722. nuitka/nodes/ClassNodes.py +286 -0
  723. nuitka/nodes/CodeObjectSpecs.py +230 -0
  724. nuitka/nodes/ComparisonNodes.py +687 -0
  725. nuitka/nodes/ConditionalNodes.py +884 -0
  726. nuitka/nodes/ConstantRefNodes.py +1717 -0
  727. nuitka/nodes/ContainerMakingNodes.py +408 -0
  728. nuitka/nodes/ContainerOperationNodes.py +87 -0
  729. nuitka/nodes/CoroutineNodes.py +144 -0
  730. nuitka/nodes/CtypesNodes.py +51 -0
  731. nuitka/nodes/DictionaryNodes.py +1513 -0
  732. nuitka/nodes/ExceptionNodes.py +393 -0
  733. nuitka/nodes/ExecEvalNodes.py +229 -0
  734. nuitka/nodes/ExpressionBases.py +1301 -0
  735. nuitka/nodes/ExpressionBasesGenerated.py +2103 -0
  736. nuitka/nodes/ExpressionShapeMixins.py +886 -0
  737. nuitka/nodes/FrameNodes.py +413 -0
  738. nuitka/nodes/FunctionAttributeNodes.py +102 -0
  739. nuitka/nodes/FunctionNodes.py +1303 -0
  740. nuitka/nodes/FutureSpecs.py +224 -0
  741. nuitka/nodes/GeneratorNodes.py +201 -0
  742. nuitka/nodes/GlobalsLocalsNodes.py +209 -0
  743. nuitka/nodes/HardImportNodesGenerated.py +3599 -0
  744. nuitka/nodes/ImportHardNodes.py +185 -0
  745. nuitka/nodes/ImportNodes.py +1366 -0
  746. nuitka/nodes/IndicatorMixins.py +79 -0
  747. nuitka/nodes/InjectCNodes.py +51 -0
  748. nuitka/nodes/IterationHandles.py +407 -0
  749. nuitka/nodes/KeyValuePairNodes.py +378 -0
  750. nuitka/nodes/ListOperationNodes.py +525 -0
  751. nuitka/nodes/LocalsDictNodes.py +717 -0
  752. nuitka/nodes/LocalsScopes.py +505 -0
  753. nuitka/nodes/LoopNodes.py +445 -0
  754. nuitka/nodes/MatchNodes.py +60 -0
  755. nuitka/nodes/ModuleAttributeNodes.py +180 -0
  756. nuitka/nodes/ModuleNodes.py +1137 -0
  757. nuitka/nodes/NetworkxNodes.py +45 -0
  758. nuitka/nodes/NodeBases.py +890 -0
  759. nuitka/nodes/NodeMakingHelpers.py +481 -0
  760. nuitka/nodes/NodeMetaClasses.py +172 -0
  761. nuitka/nodes/OperatorNodes.py +944 -0
  762. nuitka/nodes/OperatorNodesUnary.py +403 -0
  763. nuitka/nodes/OsSysNodes.py +215 -0
  764. nuitka/nodes/OutlineNodes.py +372 -0
  765. nuitka/nodes/PackageMetadataNodes.py +982 -0
  766. nuitka/nodes/PackageResourceNodes.py +424 -0
  767. nuitka/nodes/PrintNodes.py +105 -0
  768. nuitka/nodes/ReturnNodes.py +255 -0
  769. nuitka/nodes/SideEffectNodes.py +139 -0
  770. nuitka/nodes/SliceNodes.py +386 -0
  771. nuitka/nodes/StatementBasesGenerated.py +3419 -0
  772. nuitka/nodes/StatementNodes.py +316 -0
  773. nuitka/nodes/StrNodes.py +919 -0
  774. nuitka/nodes/StringConcatenationNodes.py +103 -0
  775. nuitka/nodes/SubscriptNodes.py +245 -0
  776. nuitka/nodes/TensorflowNodes.py +38 -0
  777. nuitka/nodes/TryNodes.py +519 -0
  778. nuitka/nodes/TypeMatchNodes.py +65 -0
  779. nuitka/nodes/TypeNodes.py +390 -0
  780. nuitka/nodes/VariableAssignNodes.py +1177 -0
  781. nuitka/nodes/VariableDelNodes.py +320 -0
  782. nuitka/nodes/VariableNameNodes.py +153 -0
  783. nuitka/nodes/VariableRefNodes.py +895 -0
  784. nuitka/nodes/VariableReleaseNodes.py +153 -0
  785. nuitka/nodes/YieldNodes.py +121 -0
  786. nuitka/nodes/__init__.py +19 -0
  787. nuitka/nodes/shapes/BuiltinTypeShapes.py +4290 -0
  788. nuitka/nodes/shapes/ControlFlowDescriptions.py +199 -0
  789. nuitka/nodes/shapes/IteratorShapes.py +71 -0
  790. nuitka/nodes/shapes/ShapeMixins.py +255 -0
  791. nuitka/nodes/shapes/StandardShapes.py +1384 -0
  792. nuitka/nodes/shapes/__init__.py +19 -0
  793. nuitka/optimizations/BytecodeDemotion.py +105 -0
  794. nuitka/optimizations/FunctionInlining.py +110 -0
  795. nuitka/optimizations/Graphs.py +70 -0
  796. nuitka/optimizations/Optimization.py +363 -0
  797. nuitka/optimizations/OptimizeBuiltinCalls.py +1582 -0
  798. nuitka/optimizations/Tags.py +76 -0
  799. nuitka/optimizations/TraceCollections.py +1257 -0
  800. nuitka/optimizations/ValueTraces.py +980 -0
  801. nuitka/optimizations/__init__.py +19 -0
  802. nuitka/pgo/PGO.py +160 -0
  803. nuitka/pgo/__init__.py +19 -0
  804. nuitka/plugins/PluginBase.py +1924 -0
  805. nuitka/plugins/Plugins.py +2007 -0
  806. nuitka/plugins/YamlPluginBase.py +121 -0
  807. nuitka/plugins/__init__.py +19 -0
  808. nuitka/plugins/standard/AntiBloatPlugin.py +1024 -0
  809. nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +95 -0
  810. nuitka/plugins/standard/DataFilesPlugin.py +311 -0
  811. nuitka/plugins/standard/DelvewheelPlugin.py +150 -0
  812. nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
  813. nuitka/plugins/standard/DillPlugin/cloudpickle-postLoad.py +67 -0
  814. nuitka/plugins/standard/DillPlugin/dill-postLoad.py +223 -0
  815. nuitka/plugins/standard/DillPlugin.py +137 -0
  816. nuitka/plugins/standard/DllFilesPlugin.py +527 -0
  817. nuitka/plugins/standard/EnumPlugin.py +64 -0
  818. nuitka/plugins/standard/EventletPlugin.py +57 -0
  819. nuitka/plugins/standard/GeventPlugin.py +64 -0
  820. nuitka/plugins/standard/GiPlugin.py +118 -0
  821. nuitka/plugins/standard/GlfwPlugin.py +138 -0
  822. nuitka/plugins/standard/ImplicitImports.py +845 -0
  823. nuitka/plugins/standard/KivyPlugin.py +141 -0
  824. nuitka/plugins/standard/MatplotlibPlugin.py +256 -0
  825. nuitka/plugins/standard/MultiprocessingPlugin.py +199 -0
  826. nuitka/plugins/standard/NumpyPlugin.py +35 -0
  827. nuitka/plugins/standard/OptionsNannyPlugin.py +158 -0
  828. nuitka/plugins/standard/PbrPlugin.py +62 -0
  829. nuitka/plugins/standard/PkgResourcesPlugin.py +162 -0
  830. nuitka/plugins/standard/PlaywrightPlugin.py +179 -0
  831. nuitka/plugins/standard/PmwPlugin.py +248 -0
  832. nuitka/plugins/standard/PySidePyQtPlugin.py +1666 -0
  833. nuitka/plugins/standard/PywebViewPlugin.py +81 -0
  834. nuitka/plugins/standard/SpacyPlugin.py +137 -0
  835. nuitka/plugins/standard/TensorflowPlugin.py +35 -0
  836. nuitka/plugins/standard/TkinterPlugin.py +416 -0
  837. nuitka/plugins/standard/TorchPlugin.py +35 -0
  838. nuitka/plugins/standard/TransformersPlugin.py +121 -0
  839. nuitka/plugins/standard/TrioPlugin.py +33 -0
  840. nuitka/plugins/standard/UpxPlugin.py +174 -0
  841. nuitka/plugins/standard/__init__.py +19 -0
  842. nuitka/plugins/standard/standard.nuitka-package.config.yml +9313 -0
  843. nuitka/plugins/standard/stdlib2.nuitka-package.config.yml +78 -0
  844. nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +468 -0
  845. nuitka/reports/CompilationReportReader.py +83 -0
  846. nuitka/reports/LicenseReport.rst.j2 +41 -0
  847. nuitka/reports/Reports.py +961 -0
  848. nuitka/reports/__init__.py +19 -0
  849. nuitka/specs/BuiltinBytesOperationSpecs.py +180 -0
  850. nuitka/specs/BuiltinDictOperationSpecs.py +82 -0
  851. nuitka/specs/BuiltinListOperationSpecs.py +80 -0
  852. nuitka/specs/BuiltinParameterSpecs.py +831 -0
  853. nuitka/specs/BuiltinStrOperationSpecs.py +181 -0
  854. nuitka/specs/BuiltinTypeOperationSpecs.py +34 -0
  855. nuitka/specs/BuiltinUnicodeOperationSpecs.py +123 -0
  856. nuitka/specs/HardImportSpecs.py +236 -0
  857. nuitka/specs/ParameterSpecs.py +630 -0
  858. nuitka/specs/__init__.py +19 -0
  859. nuitka/tools/Basics.py +55 -0
  860. nuitka/tools/__init__.py +19 -0
  861. nuitka/tools/commercial/__init__.py +21 -0
  862. nuitka/tools/data_composer/DataComposer.py +593 -0
  863. nuitka/tools/data_composer/__init__.py +19 -0
  864. nuitka/tools/data_composer/__main__.py +41 -0
  865. nuitka/tools/environments/CreateEnvironment.py +69 -0
  866. nuitka/tools/environments/Virtualenv.py +158 -0
  867. nuitka/tools/environments/__init__.py +19 -0
  868. nuitka/tools/general/__init__.py +19 -0
  869. nuitka/tools/general/dll_report/__init__.py +19 -0
  870. nuitka/tools/general/dll_report/__main__.py +83 -0
  871. nuitka/tools/general/find_module/FindModuleCode.py +127 -0
  872. nuitka/tools/general/find_module/__init__.py +19 -0
  873. nuitka/tools/general/generate_header/GenerateHeader.py +73 -0
  874. nuitka/tools/general/generate_header/__init__.py +19 -0
  875. nuitka/tools/onefile_compressor/OnefileCompressor.py +390 -0
  876. nuitka/tools/onefile_compressor/__init__.py +19 -0
  877. nuitka/tools/onefile_compressor/__main__.py +41 -0
  878. nuitka/tools/podman/Podman.py +55 -0
  879. nuitka/tools/podman/__init__.py +19 -0
  880. nuitka/tools/podman/__main__.py +425 -0
  881. nuitka/tools/profiler/__init__.py +19 -0
  882. nuitka/tools/profiler/__main__.py +93 -0
  883. nuitka/tools/scanning/DisplayDistributions.py +39 -0
  884. nuitka/tools/scanning/DisplayPackageDLLs.py +151 -0
  885. nuitka/tools/scanning/DisplayPackageData.py +73 -0
  886. nuitka/tools/scanning/__init__.py +19 -0
  887. nuitka/tools/specialize/CTypeDescriptions.py +1928 -0
  888. nuitka/tools/specialize/Common.py +380 -0
  889. nuitka/tools/specialize/SpecializeC.py +1483 -0
  890. nuitka/tools/specialize/SpecializePython.py +1151 -0
  891. nuitka/tools/specialize/__init__.py +19 -0
  892. nuitka/tools/testing/Common.py +2007 -0
  893. nuitka/tools/testing/Constructs.py +53 -0
  894. nuitka/tools/testing/DocTests.py +156 -0
  895. nuitka/tools/testing/OutputComparison.py +313 -0
  896. nuitka/tools/testing/Pythons.py +34 -0
  897. nuitka/tools/testing/RuntimeTracing.py +260 -0
  898. nuitka/tools/testing/SearchModes.py +208 -0
  899. nuitka/tools/testing/Valgrind.py +103 -0
  900. nuitka/tools/testing/__init__.py +19 -0
  901. nuitka/tools/testing/check_reference_counts/__init__.py +19 -0
  902. nuitka/tools/testing/check_reference_counts/__main__.py +107 -0
  903. nuitka/tools/testing/compare_with_cpython/__init__.py +19 -0
  904. nuitka/tools/testing/compare_with_cpython/__main__.py +942 -0
  905. nuitka/tools/testing/find_sxs_modules/__init__.py +19 -0
  906. nuitka/tools/testing/find_sxs_modules/__main__.py +73 -0
  907. nuitka/tools/testing/measure_construct_performance/__init__.py +19 -0
  908. nuitka/tools/testing/measure_construct_performance/__main__.py +288 -0
  909. nuitka/tools/testing/run_nuitka_tests/__init__.py +19 -0
  910. nuitka/tools/testing/run_nuitka_tests/__main__.py +1091 -0
  911. nuitka/tools/watch/AutoStage.py +145 -0
  912. nuitka/tools/watch/Common.py +55 -0
  913. nuitka/tools/watch/Conda.py +125 -0
  914. nuitka/tools/watch/GitHub.py +113 -0
  915. nuitka/tools/watch/Pacman.py +73 -0
  916. nuitka/tools/watch/Pipenv.py +145 -0
  917. nuitka/tools/watch/__init__.py +19 -0
  918. nuitka/tools/watch/__main__.py +615 -0
  919. nuitka/tree/Building.py +1459 -0
  920. nuitka/tree/ComplexCallHelperFunctions.py +2150 -0
  921. nuitka/tree/Extractions.py +48 -0
  922. nuitka/tree/FutureSpecState.py +71 -0
  923. nuitka/tree/InternalModule.py +96 -0
  924. nuitka/tree/Operations.py +45 -0
  925. nuitka/tree/ReformulationAssertStatements.py +97 -0
  926. nuitka/tree/ReformulationAssignmentStatements.py +1260 -0
  927. nuitka/tree/ReformulationBooleanExpressions.py +97 -0
  928. nuitka/tree/ReformulationCallExpressions.py +314 -0
  929. nuitka/tree/ReformulationClasses.py +407 -0
  930. nuitka/tree/ReformulationClasses3.py +1149 -0
  931. nuitka/tree/ReformulationComparisonExpressions.py +174 -0
  932. nuitka/tree/ReformulationContractionExpressions.py +676 -0
  933. nuitka/tree/ReformulationDictionaryCreation.py +304 -0
  934. nuitka/tree/ReformulationExecStatements.py +386 -0
  935. nuitka/tree/ReformulationForLoopStatements.py +215 -0
  936. nuitka/tree/ReformulationFunctionStatements.py +931 -0
  937. nuitka/tree/ReformulationImportStatements.py +333 -0
  938. nuitka/tree/ReformulationLambdaExpressions.py +185 -0
  939. nuitka/tree/ReformulationMatchStatements.py +797 -0
  940. nuitka/tree/ReformulationMultidist.py +80 -0
  941. nuitka/tree/ReformulationNamespacePackages.py +239 -0
  942. nuitka/tree/ReformulationPrintStatements.py +127 -0
  943. nuitka/tree/ReformulationSequenceCreation.py +438 -0
  944. nuitka/tree/ReformulationSubscriptExpressions.py +123 -0
  945. nuitka/tree/ReformulationTryExceptStatements.py +418 -0
  946. nuitka/tree/ReformulationTryFinallyStatements.py +239 -0
  947. nuitka/tree/ReformulationWhileLoopStatements.py +160 -0
  948. nuitka/tree/ReformulationWithStatements.py +382 -0
  949. nuitka/tree/ReformulationYieldExpressions.py +133 -0
  950. nuitka/tree/SourceHandling.py +476 -0
  951. nuitka/tree/SyntaxErrors.py +143 -0
  952. nuitka/tree/TreeHelpers.py +720 -0
  953. nuitka/tree/VariableClosure.py +483 -0
  954. nuitka/tree/__init__.py +19 -0
  955. nuitka/utils/AppDirs.py +104 -0
  956. nuitka/utils/CStrings.py +208 -0
  957. nuitka/utils/CommandLineOptions.py +207 -0
  958. nuitka/utils/Distributions.py +728 -0
  959. nuitka/utils/Download.py +217 -0
  960. nuitka/utils/Execution.py +517 -0
  961. nuitka/utils/FileOperations.py +1587 -0
  962. nuitka/utils/Hashing.py +137 -0
  963. nuitka/utils/Images.py +79 -0
  964. nuitka/utils/Importing.py +335 -0
  965. nuitka/utils/InlineCopies.py +52 -0
  966. nuitka/utils/InstalledPythons.py +254 -0
  967. nuitka/utils/InstanceCounters.py +86 -0
  968. nuitka/utils/Jinja2.py +158 -0
  969. nuitka/utils/Json.py +40 -0
  970. nuitka/utils/MacOSApp.py +134 -0
  971. nuitka/utils/MemoryUsage.py +165 -0
  972. nuitka/utils/ModuleNames.py +317 -0
  973. nuitka/utils/PackageResources.py +44 -0
  974. nuitka/utils/ReExecute.py +152 -0
  975. nuitka/utils/Rest.py +60 -0
  976. nuitka/utils/SharedLibraries.py +1014 -0
  977. nuitka/utils/Shebang.py +113 -0
  978. nuitka/utils/Signing.py +144 -0
  979. nuitka/utils/SlotMetaClasses.py +57 -0
  980. nuitka/utils/StaticLibraries.py +260 -0
  981. nuitka/utils/ThreadedExecutor.py +87 -0
  982. nuitka/utils/Timing.py +102 -0
  983. nuitka/utils/Utils.py +483 -0
  984. nuitka/utils/WindowsFileUsage.py +337 -0
  985. nuitka/utils/WindowsResources.py +652 -0
  986. nuitka/utils/Yaml.py +247 -0
  987. nuitka/utils/__init__.py +19 -0
  988. nuitka_winsvc-2.7.7.data/scripts/nuitka-run.cmd +24 -0
  989. nuitka_winsvc-2.7.7.data/scripts/nuitka.cmd +30 -0
  990. nuitka_winsvc-2.7.7.dist-info/METADATA +115 -0
  991. nuitka_winsvc-2.7.7.dist-info/RECORD +995 -0
  992. nuitka_winsvc-2.7.7.dist-info/WHEEL +5 -0
  993. nuitka_winsvc-2.7.7.dist-info/entry_points.txt +7 -0
  994. nuitka_winsvc-2.7.7.dist-info/licenses/LICENSE.txt +202 -0
  995. nuitka_winsvc-2.7.7.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2134 @@
1
+ # MIT License
2
+ #
3
+ # Copyright The SCons Foundation
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included
14
+ # in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ """Various SCons utility functions."""
25
+
26
+ import copy
27
+ import hashlib
28
+ import os
29
+ import pprint
30
+ import re
31
+ import sys
32
+ from collections import UserDict, UserList, UserString, OrderedDict
33
+ from collections.abc import MappingView
34
+ from contextlib import suppress
35
+ from types import MethodType, FunctionType
36
+ from typing import Optional, Union
37
+
38
+ # Note: Util module cannot import other bits of SCons globally without getting
39
+ # into import loops. Both the below modules import SCons.Util early on.
40
+ # --> SCons.Warnings
41
+ # --> SCons.Errors
42
+ # Thus the local imports, which are annotated for pylint to show we mean it.
43
+
44
+
45
+ PYPY = hasattr(sys, 'pypy_translation_info')
46
+
47
+ # this string will be hashed if a Node refers to a file that doesn't exist
48
+ # in order to distinguish from a file that exists but is empty.
49
+ NOFILE = "SCONS_MAGIC_MISSING_FILE_STRING"
50
+
51
+ # unused?
52
+ def dictify(keys, values, result=None) -> dict:
53
+ if result is None:
54
+ result = {}
55
+ result.update(dict(zip(keys, values)))
56
+ return result
57
+
58
+ _ALTSEP = os.altsep
59
+ if _ALTSEP is None and sys.platform == 'win32':
60
+ # My ActivePython 2.0.1 doesn't set os.altsep! What gives?
61
+ _ALTSEP = '/'
62
+ if _ALTSEP:
63
+ def rightmost_separator(path, sep):
64
+ return max(path.rfind(sep), path.rfind(_ALTSEP))
65
+ else:
66
+ def rightmost_separator(path, sep):
67
+ return path.rfind(sep)
68
+
69
+ # First two from the Python Cookbook, just for completeness.
70
+ # (Yeah, yeah, YAGNI...)
71
+ def containsAny(s, pat) -> bool:
72
+ """Check whether string `s` contains ANY of the items in `pat`."""
73
+ for c in pat:
74
+ if c in s:
75
+ return True
76
+ return False
77
+
78
+ def containsAll(s, pat) -> bool:
79
+ """Check whether string `s` contains ALL of the items in `pat`."""
80
+ for c in pat:
81
+ if c not in s:
82
+ return False
83
+ return True
84
+
85
+ def containsOnly(s, pat) -> bool:
86
+ """Check whether string `s` contains ONLY items in `pat`."""
87
+ for c in s:
88
+ if c not in pat:
89
+ return False
90
+ return True
91
+
92
+
93
+ # TODO: Verify this method is STILL faster than os.path.splitext
94
+ def splitext(path) -> tuple:
95
+ """Split `path` into a (root, ext) pair.
96
+
97
+ Same as :mod:`os.path.splitext` but faster.
98
+ """
99
+ sep = rightmost_separator(path, os.sep)
100
+ dot = path.rfind('.')
101
+ # An ext is only real if it has at least one non-digit char
102
+ if dot > sep and not containsOnly(path[dot:], "0123456789."):
103
+ return path[:dot], path[dot:]
104
+
105
+ return path, ""
106
+
107
+ def updrive(path) -> str:
108
+ """Make the drive letter (if any) upper case.
109
+
110
+ This is useful because Windows is inconsistent on the case
111
+ of the drive letter, which can cause inconsistencies when
112
+ calculating command signatures.
113
+ """
114
+ drive, rest = os.path.splitdrive(path)
115
+ if drive:
116
+ path = drive.upper() + rest
117
+ return path
118
+
119
+ class NodeList(UserList):
120
+ """A list of Nodes with special attribute retrieval.
121
+
122
+ Unlike an ordinary list, access to a member's attribute returns a
123
+ `NodeList` containing the same attribute for each member. Although
124
+ this can hold any object, it is intended for use when processing
125
+ Nodes, where fetching an attribute of each member is very commone,
126
+ for example getting the content signature of each node. The term
127
+ "attribute" here includes the string representation.
128
+
129
+ Example:
130
+
131
+ >>> someList = NodeList([' foo ', ' bar '])
132
+ >>> someList.strip()
133
+ ['foo', 'bar']
134
+ """
135
+
136
+ def __bool__(self):
137
+ return bool(self.data)
138
+
139
+ def __str__(self):
140
+ return ' '.join(map(str, self.data))
141
+
142
+ def __iter__(self):
143
+ return iter(self.data)
144
+
145
+ def __call__(self, *args, **kwargs) -> 'NodeList':
146
+ result = [x(*args, **kwargs) for x in self.data]
147
+ return self.__class__(result)
148
+
149
+ def __getattr__(self, name) -> 'NodeList':
150
+ """Returns a NodeList of `name` from each member."""
151
+ result = [getattr(x, name) for x in self.data]
152
+ return self.__class__(result)
153
+
154
+ def __getitem__(self, index):
155
+ """Returns one item, forces a `NodeList` if `index` is a slice."""
156
+ # TODO: annotate return how? Union[] - don't know type of single item
157
+ if isinstance(index, slice):
158
+ return self.__class__(self.data[index])
159
+ return self.data[index]
160
+
161
+
162
+ _get_env_var = re.compile(r'^\$([_a-zA-Z]\w*|{[_a-zA-Z]\w*})$')
163
+
164
+ def get_environment_var(varstr) -> Optional[str]:
165
+ """Return undecorated construction variable string.
166
+
167
+ Determine if `varstr` looks like a reference
168
+ to a single environment variable, like `"$FOO"` or `"${FOO}"`.
169
+ If so, return that variable with no decorations, like `"FOO"`.
170
+ If not, return `None`.
171
+ """
172
+
173
+ mo = _get_env_var.match(to_String(varstr))
174
+ if mo:
175
+ var = mo.group(1)
176
+ if var[0] == '{':
177
+ return var[1:-1]
178
+ return var
179
+
180
+ return None
181
+
182
+
183
+ class DisplayEngine:
184
+ """A callable class used to display SCons messages."""
185
+
186
+ print_it = True
187
+
188
+ def __call__(self, text, append_newline=1):
189
+ if not self.print_it:
190
+ return
191
+
192
+ if append_newline:
193
+ text = text + '\n'
194
+
195
+ try:
196
+ sys.stdout.write(str(text))
197
+ except IOError:
198
+ # Stdout might be connected to a pipe that has been closed
199
+ # by now. The most likely reason for the pipe being closed
200
+ # is that the user has press ctrl-c. It this is the case,
201
+ # then SCons is currently shutdown. We therefore ignore
202
+ # IOError's here so that SCons can continue and shutdown
203
+ # properly so that the .sconsign is correctly written
204
+ # before SCons exits.
205
+ pass
206
+
207
+ def set_mode(self, mode):
208
+ self.print_it = mode
209
+
210
+
211
+ # TODO: W0102: Dangerous default value [] as argument (dangerous-default-value)
212
+ def render_tree(root, child_func, prune=0, margin=[0], visited=None):
213
+ """Render a tree of nodes into an ASCII tree view.
214
+
215
+ Args:
216
+ root: the root node of the tree
217
+ child_func: the function called to get the children of a node
218
+ prune: don't visit the same node twice
219
+ margin: the format of the left margin to use for children of `root`.
220
+ 1 results in a pipe, and 0 results in no pipe.
221
+ visited: a dictionary of visited nodes in the current branch if
222
+ `prune` is 0, or in the whole tree if `prune` is 1.
223
+ """
224
+
225
+ rname = str(root)
226
+
227
+ # Initialize 'visited' dict, if required
228
+ if visited is None:
229
+ visited = {}
230
+
231
+ children = child_func(root)
232
+ retval = ""
233
+ for pipe in margin[:-1]:
234
+ if pipe:
235
+ retval = retval + "| "
236
+ else:
237
+ retval = retval + " "
238
+
239
+ if rname in visited:
240
+ return retval + "+-[" + rname + "]\n"
241
+
242
+ retval = retval + "+-" + rname + "\n"
243
+ if not prune:
244
+ visited = copy.copy(visited)
245
+ visited[rname] = True
246
+
247
+ for i, child in enumerate(children):
248
+ margin.append(i < len(children)-1)
249
+ retval = retval + render_tree(child, child_func, prune, margin, visited)
250
+ margin.pop()
251
+
252
+ return retval
253
+
254
+ def IDX(n) -> bool:
255
+ """Generate in index into strings from the tree legends.
256
+
257
+ These are always a choice between two, so bool works fine.
258
+ """
259
+ return bool(n)
260
+
261
+ # unicode line drawing chars:
262
+ BOX_HORIZ = chr(0x2500) # '─'
263
+ BOX_VERT = chr(0x2502) # '│'
264
+ BOX_UP_RIGHT = chr(0x2514) # '└'
265
+ BOX_DOWN_RIGHT = chr(0x250c) # '┌'
266
+ BOX_DOWN_LEFT = chr(0x2510) # '┐'
267
+ BOX_UP_LEFT = chr(0x2518) # '┘'
268
+ BOX_VERT_RIGHT = chr(0x251c) # '├'
269
+ BOX_HORIZ_DOWN = chr(0x252c) # '┬'
270
+
271
+
272
+ # TODO: W0102: Dangerous default value [] as argument (dangerous-default-value)
273
+ def print_tree(
274
+ root,
275
+ child_func,
276
+ prune=0,
277
+ showtags=False,
278
+ margin=[0],
279
+ visited=None,
280
+ lastChild=False,
281
+ singleLineDraw=False,
282
+ ):
283
+ """Print a tree of nodes.
284
+
285
+ This is like func:`render_tree`, except it prints lines directly instead
286
+ of creating a string representation in memory, so that huge trees can
287
+ be handled.
288
+
289
+ Args:
290
+ root: the root node of the tree
291
+ child_func: the function called to get the children of a node
292
+ prune: don't visit the same node twice
293
+ showtags: print status information to the left of each node line
294
+ margin: the format of the left margin to use for children of `root`.
295
+ 1 results in a pipe, and 0 results in no pipe.
296
+ visited: a dictionary of visited nodes in the current branch if
297
+ prune` is 0, or in the whole tree if `prune` is 1.
298
+ singleLineDraw: use line-drawing characters rather than ASCII.
299
+ """
300
+
301
+ rname = str(root)
302
+
303
+ # Initialize 'visited' dict, if required
304
+ if visited is None:
305
+ visited = {}
306
+
307
+ if showtags:
308
+
309
+ if showtags == 2:
310
+ legend = (' E = exists\n' +
311
+ ' R = exists in repository only\n' +
312
+ ' b = implicit builder\n' +
313
+ ' B = explicit builder\n' +
314
+ ' S = side effect\n' +
315
+ ' P = precious\n' +
316
+ ' A = always build\n' +
317
+ ' C = current\n' +
318
+ ' N = no clean\n' +
319
+ ' H = no cache\n' +
320
+ '\n')
321
+ sys.stdout.write(legend)
322
+
323
+ tags = [
324
+ '[',
325
+ ' E'[IDX(root.exists())],
326
+ ' R'[IDX(root.rexists() and not root.exists())],
327
+ ' BbB'[
328
+ [0, 1][IDX(root.has_explicit_builder())] +
329
+ [0, 2][IDX(root.has_builder())]
330
+ ],
331
+ ' S'[IDX(root.side_effect)],
332
+ ' P'[IDX(root.precious)],
333
+ ' A'[IDX(root.always_build)],
334
+ ' C'[IDX(root.is_up_to_date())],
335
+ ' N'[IDX(root.noclean)],
336
+ ' H'[IDX(root.nocache)],
337
+ ']'
338
+ ]
339
+
340
+ else:
341
+ tags = []
342
+
343
+ def MMM(m):
344
+ if singleLineDraw:
345
+ return [" ", BOX_VERT + " "][m]
346
+
347
+ return [" ", "| "][m]
348
+
349
+ margins = list(map(MMM, margin[:-1]))
350
+ children = child_func(root)
351
+ cross = "+-"
352
+ if singleLineDraw:
353
+ cross = BOX_VERT_RIGHT + BOX_HORIZ # sign used to point to the leaf.
354
+ # check if this is the last leaf of the branch
355
+ if lastChild:
356
+ #if this if the last leaf, then terminate:
357
+ cross = BOX_UP_RIGHT + BOX_HORIZ # sign for the last leaf
358
+
359
+ # if this branch has children then split it
360
+ if children:
361
+ # if it's a leaf:
362
+ if prune and rname in visited and children:
363
+ cross += BOX_HORIZ
364
+ else:
365
+ cross += BOX_HORIZ_DOWN
366
+
367
+ if prune and rname in visited and children:
368
+ sys.stdout.write(''.join(tags + margins + [cross,'[', rname, ']']) + '\n')
369
+ return
370
+
371
+ sys.stdout.write(''.join(tags + margins + [cross, rname]) + '\n')
372
+
373
+ visited[rname] = 1
374
+
375
+ # if this item has children:
376
+ if children:
377
+ margin.append(1) # Initialize margin with 1 for vertical bar.
378
+ idx = IDX(showtags)
379
+ _child = 0 # Initialize this for the first child.
380
+ for C in children[:-1]:
381
+ _child = _child + 1 # number the children
382
+ print_tree(
383
+ C,
384
+ child_func,
385
+ prune,
386
+ idx,
387
+ margin,
388
+ visited,
389
+ (len(children) - _child) <= 0,
390
+ singleLineDraw,
391
+ )
392
+ # margins are with space (index 0) because we arrived to the last child.
393
+ margin[-1] = 0
394
+ # for this call child and nr of children needs to be set 0, to signal the second phase.
395
+ print_tree(children[-1], child_func, prune, idx, margin, visited, True, singleLineDraw)
396
+ margin.pop() # destroy the last margin added
397
+
398
+
399
+ # Functions for deciding if things are like various types, mainly to
400
+ # handle UserDict, UserList and UserString like their underlying types.
401
+ #
402
+ # Yes, all of this manual testing breaks polymorphism, and the real
403
+ # Pythonic way to do all of this would be to just try it and handle the
404
+ # exception, but handling the exception when it's not the right type is
405
+ # often too slow.
406
+
407
+ # We are using the following trick to speed up these
408
+ # functions. Default arguments are used to take a snapshot of
409
+ # the global functions and constants used by these functions. This
410
+ # transforms accesses to global variable into local variables
411
+ # accesses (i.e. LOAD_FAST instead of LOAD_GLOBAL).
412
+ # Since checkers dislike this, it's now annotated for pylint to flag
413
+ # (mostly for other readers of this code) we're doing this intentionally.
414
+ # TODO: PY3 check these are still valid choices for all of these funcs.
415
+
416
+ DictTypes = (dict, UserDict)
417
+ ListTypes = (list, UserList)
418
+
419
+ # Handle getting dictionary views.
420
+ SequenceTypes = (list, tuple, UserList, MappingView)
421
+
422
+ # Note that profiling data shows a speed-up when comparing
423
+ # explicitly with str instead of simply comparing
424
+ # with basestring. (at least on Python 2.5.1)
425
+ # TODO: PY3 check this benchmarking is still correct.
426
+ StringTypes = (str, UserString)
427
+
428
+ # Empirically, it is faster to check explicitly for str than for basestring.
429
+ BaseStringTypes = str
430
+
431
+ def is_Dict( # pylint: disable=redefined-outer-name,redefined-builtin
432
+ obj, isinstance=isinstance, DictTypes=DictTypes
433
+ ) -> bool:
434
+ return isinstance(obj, DictTypes)
435
+
436
+
437
+ def is_List( # pylint: disable=redefined-outer-name,redefined-builtin
438
+ obj, isinstance=isinstance, ListTypes=ListTypes
439
+ ) -> bool:
440
+ return isinstance(obj, ListTypes)
441
+
442
+
443
+ def is_Sequence( # pylint: disable=redefined-outer-name,redefined-builtin
444
+ obj, isinstance=isinstance, SequenceTypes=SequenceTypes
445
+ ) -> bool:
446
+ return isinstance(obj, SequenceTypes)
447
+
448
+
449
+ def is_Tuple( # pylint: disable=redefined-builtin
450
+ obj, isinstance=isinstance, tuple=tuple
451
+ ) -> bool:
452
+ return isinstance(obj, tuple)
453
+
454
+
455
+ def is_String( # pylint: disable=redefined-outer-name,redefined-builtin
456
+ obj, isinstance=isinstance, StringTypes=StringTypes
457
+ ) -> bool:
458
+ return isinstance(obj, StringTypes)
459
+
460
+
461
+ def is_Scalar( # pylint: disable=redefined-outer-name,redefined-builtin
462
+ obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes
463
+ ) -> bool:
464
+
465
+ # Profiling shows that there is an impressive speed-up of 2x
466
+ # when explicitly checking for strings instead of just not
467
+ # sequence when the argument (i.e. obj) is already a string.
468
+ # But, if obj is a not string then it is twice as fast to
469
+ # check only for 'not sequence'. The following code therefore
470
+ # assumes that the obj argument is a string most of the time.
471
+ return isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes)
472
+
473
+
474
+ def do_flatten(
475
+ sequence,
476
+ result,
477
+ isinstance=isinstance,
478
+ StringTypes=StringTypes,
479
+ SequenceTypes=SequenceTypes,
480
+ ): # pylint: disable=redefined-outer-name,redefined-builtin
481
+ for item in sequence:
482
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
483
+ result.append(item)
484
+ else:
485
+ do_flatten(item, result)
486
+
487
+
488
+ def flatten( # pylint: disable=redefined-outer-name,redefined-builtin
489
+ obj,
490
+ isinstance=isinstance,
491
+ StringTypes=StringTypes,
492
+ SequenceTypes=SequenceTypes,
493
+ do_flatten=do_flatten,
494
+ ) -> list:
495
+ """Flatten a sequence to a non-nested list.
496
+
497
+ Converts either a single scalar or a nested sequence to a non-nested list.
498
+ Note that :func:`flatten` considers strings
499
+ to be scalars instead of sequences like pure Python would.
500
+ """
501
+ if isinstance(obj, StringTypes) or not isinstance(obj, SequenceTypes):
502
+ return [obj]
503
+ result = []
504
+ for item in obj:
505
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
506
+ result.append(item)
507
+ else:
508
+ do_flatten(item, result)
509
+ return result
510
+
511
+
512
+ def flatten_sequence( # pylint: disable=redefined-outer-name,redefined-builtin
513
+ sequence,
514
+ isinstance=isinstance,
515
+ StringTypes=StringTypes,
516
+ SequenceTypes=SequenceTypes,
517
+ do_flatten=do_flatten,
518
+ ) -> list:
519
+ """Flatten a sequence to a non-nested list.
520
+
521
+ Same as :func:`flatten`, but it does not handle the single scalar case.
522
+ This is slightly more efficient when one knows that the sequence
523
+ to flatten can not be a scalar.
524
+ """
525
+ result = []
526
+ for item in sequence:
527
+ if isinstance(item, StringTypes) or not isinstance(item, SequenceTypes):
528
+ result.append(item)
529
+ else:
530
+ do_flatten(item, result)
531
+ return result
532
+
533
+ # Generic convert-to-string functions. The wrapper
534
+ # to_String_for_signature() will use a for_signature() method if the
535
+ # specified object has one.
536
+
537
+ def to_String( # pylint: disable=redefined-outer-name,redefined-builtin
538
+ obj,
539
+ isinstance=isinstance,
540
+ str=str,
541
+ UserString=UserString,
542
+ BaseStringTypes=BaseStringTypes,
543
+ ) -> str:
544
+ """Return a string version of obj."""
545
+
546
+ if isinstance(obj, BaseStringTypes):
547
+ # Early out when already a string!
548
+ return obj
549
+
550
+ if isinstance(obj, UserString):
551
+ # obj.data can only be a regular string. Please see the UserString initializer.
552
+ return obj.data
553
+
554
+ return str(obj)
555
+
556
+ def to_String_for_subst( # pylint: disable=redefined-outer-name,redefined-builtin
557
+ obj,
558
+ isinstance=isinstance,
559
+ str=str,
560
+ BaseStringTypes=BaseStringTypes,
561
+ SequenceTypes=SequenceTypes,
562
+ UserString=UserString,
563
+ ) -> str:
564
+ """Return a string version of obj for subst usage."""
565
+
566
+ # Note that the test cases are sorted by order of probability.
567
+ if isinstance(obj, BaseStringTypes):
568
+ return obj
569
+
570
+ if isinstance(obj, SequenceTypes):
571
+ return ' '.join([to_String_for_subst(e) for e in obj])
572
+
573
+ if isinstance(obj, UserString):
574
+ # obj.data can only a regular string. Please see the UserString initializer.
575
+ return obj.data
576
+
577
+ return str(obj)
578
+
579
+ def to_String_for_signature( # pylint: disable=redefined-outer-name,redefined-builtin
580
+ obj, to_String_for_subst=to_String_for_subst, AttributeError=AttributeError
581
+ ) -> str:
582
+ """Return a string version of obj for signature usage.
583
+
584
+ Like :func:`to_String_for_subst` but has special handling for
585
+ scons objects that have a :meth:`for_signature` method, and for dicts.
586
+ """
587
+
588
+ try:
589
+ f = obj.for_signature
590
+ except AttributeError:
591
+ if isinstance(obj, dict):
592
+ # pprint will output dictionary in key sorted order
593
+ # with py3.5 the order was randomized. In general depending on dictionary order
594
+ # which was undefined until py3.6 (where it's by insertion order) was not wise.
595
+ # TODO: Change code when floor is raised to PY36
596
+ return pprint.pformat(obj, width=1000000)
597
+ return to_String_for_subst(obj)
598
+ else:
599
+ return f()
600
+
601
+
602
+ # The SCons "semi-deep" copy.
603
+ #
604
+ # This makes separate copies of lists (including UserList objects)
605
+ # dictionaries (including UserDict objects) and tuples, but just copies
606
+ # references to anything else it finds.
607
+ #
608
+ # A special case is any object that has a __semi_deepcopy__() method,
609
+ # which we invoke to create the copy. Currently only used by
610
+ # BuilderDict to actually prevent the copy operation (as invalid on that object).
611
+ #
612
+ # The dispatch table approach used here is a direct rip-off from the
613
+ # normal Python copy module.
614
+
615
+ def semi_deepcopy_dict(obj, exclude=None) -> dict:
616
+ if exclude is None:
617
+ exclude = []
618
+ return {k: semi_deepcopy(v) for k, v in obj.items() if k not in exclude}
619
+
620
+ def _semi_deepcopy_list(obj) -> list:
621
+ return [semi_deepcopy(item) for item in obj]
622
+
623
+ def _semi_deepcopy_tuple(obj) -> tuple:
624
+ return tuple(map(semi_deepcopy, obj))
625
+
626
+ _semi_deepcopy_dispatch = {
627
+ dict: semi_deepcopy_dict,
628
+ list: _semi_deepcopy_list,
629
+ tuple: _semi_deepcopy_tuple,
630
+ }
631
+
632
+ def semi_deepcopy(obj):
633
+ copier = _semi_deepcopy_dispatch.get(type(obj))
634
+ if copier:
635
+ return copier(obj)
636
+
637
+ if hasattr(obj, '__semi_deepcopy__') and callable(obj.__semi_deepcopy__):
638
+ return obj.__semi_deepcopy__()
639
+
640
+ if isinstance(obj, UserDict):
641
+ return obj.__class__(semi_deepcopy_dict(obj))
642
+
643
+ if isinstance(obj, UserList):
644
+ return obj.__class__(_semi_deepcopy_list(obj))
645
+
646
+ return obj
647
+
648
+
649
+ class Proxy:
650
+ """A simple generic Proxy class, forwarding all calls to subject.
651
+
652
+ This means you can take an object, let's call it `'obj_a`,
653
+ and wrap it in this Proxy class, with a statement like this::
654
+
655
+ proxy_obj = Proxy(obj_a)
656
+
657
+ Then, if in the future, you do something like this::
658
+
659
+ x = proxy_obj.var1
660
+
661
+ since the :class:`Proxy` class does not have a :attr:`var1` attribute
662
+ (but presumably `objA` does), the request actually is equivalent to saying::
663
+
664
+ x = obj_a.var1
665
+
666
+ Inherit from this class to create a Proxy.
667
+
668
+ With Python 3.5+ this does *not* work transparently
669
+ for :class:`Proxy` subclasses that use special .__*__() method names,
670
+ because those names are now bound to the class, not the individual
671
+ instances. You now need to know in advance which special method names you
672
+ want to pass on to the underlying Proxy object, and specifically delegate
673
+ their calls like this::
674
+
675
+ class Foo(Proxy):
676
+ __str__ = Delegate('__str__')
677
+ """
678
+
679
+ def __init__(self, subject):
680
+ """Wrap an object as a Proxy object"""
681
+ self._subject = subject
682
+
683
+ def __getattr__(self, name):
684
+ """Retrieve an attribute from the wrapped object.
685
+
686
+ Raises:
687
+ AttributeError: if attribute `name` doesn't exist.
688
+ """
689
+ return getattr(self._subject, name)
690
+
691
+ def get(self):
692
+ """Retrieve the entire wrapped object"""
693
+ return self._subject
694
+
695
+ def __eq__(self, other):
696
+ if issubclass(other.__class__, self._subject.__class__):
697
+ return self._subject == other
698
+ return self.__dict__ == other.__dict__
699
+
700
+
701
+ class Delegate:
702
+ """A Python Descriptor class that delegates attribute fetches
703
+ to an underlying wrapped subject of a Proxy. Typical use::
704
+
705
+ class Foo(Proxy):
706
+ __str__ = Delegate('__str__')
707
+ """
708
+ def __init__(self, attribute):
709
+ self.attribute = attribute
710
+
711
+ def __get__(self, obj, cls):
712
+ if isinstance(obj, cls):
713
+ return getattr(obj._subject, self.attribute)
714
+
715
+ return self
716
+
717
+
718
+ class MethodWrapper:
719
+ """A generic Wrapper class that associates a method with an object.
720
+
721
+ As part of creating this MethodWrapper object an attribute with the
722
+ specified name (by default, the name of the supplied method) is added
723
+ to the underlying object. When that new "method" is called, our
724
+ :meth:`__call__` method adds the object as the first argument, simulating
725
+ the Python behavior of supplying "self" on method calls.
726
+
727
+ We hang on to the name by which the method was added to the underlying
728
+ base class so that we can provide a method to "clone" ourselves onto
729
+ a new underlying object being copied (without which we wouldn't need
730
+ to save that info).
731
+ """
732
+ def __init__(self, obj, method, name=None):
733
+ if name is None:
734
+ name = method.__name__
735
+ self.object = obj
736
+ self.method = method
737
+ self.name = name
738
+ setattr(self.object, name, self)
739
+
740
+ def __call__(self, *args, **kwargs):
741
+ nargs = (self.object,) + args
742
+ return self.method(*nargs, **kwargs)
743
+
744
+ def clone(self, new_object):
745
+ """
746
+ Returns an object that re-binds the underlying "method" to
747
+ the specified new object.
748
+ """
749
+ return self.__class__(new_object, self.method, self.name)
750
+
751
+
752
+ # attempt to load the windows registry module:
753
+ can_read_reg = False
754
+ try:
755
+ import winreg
756
+
757
+ can_read_reg = True
758
+ hkey_mod = winreg
759
+
760
+ except ImportError:
761
+ class _NoError(Exception):
762
+ pass
763
+ RegError = _NoError
764
+
765
+ if can_read_reg:
766
+ HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT
767
+ HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE
768
+ HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER
769
+ HKEY_USERS = hkey_mod.HKEY_USERS
770
+
771
+ RegOpenKeyEx = winreg.OpenKeyEx
772
+ RegEnumKey = winreg.EnumKey
773
+ RegEnumValue = winreg.EnumValue
774
+ RegQueryValueEx = winreg.QueryValueEx
775
+ RegError = winreg.error
776
+
777
+ def RegGetValue(root, key):
778
+ r"""Returns a registry value without having to open the key first.
779
+
780
+ Only available on Windows platforms with a version of Python that
781
+ can read the registry.
782
+
783
+ Returns the same thing as :func:`RegQueryValueEx`, except you just
784
+ specify the entire path to the value, and don't have to bother
785
+ opening the key first. So, instead of::
786
+
787
+ k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
788
+ r'SOFTWARE\Microsoft\Windows\CurrentVersion')
789
+ out = SCons.Util.RegQueryValueEx(k, 'ProgramFilesDir')
790
+
791
+ You can write::
792
+
793
+ out = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE,
794
+ r'SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir')
795
+ """
796
+ # I would use os.path.split here, but it's not a filesystem
797
+ # path...
798
+ p = key.rfind('\\') + 1
799
+ keyp = key[: p - 1] # -1 to omit trailing slash
800
+ val = key[p:]
801
+ k = RegOpenKeyEx(root, keyp)
802
+ return RegQueryValueEx(k, val)
803
+
804
+
805
+ else:
806
+ HKEY_CLASSES_ROOT = None
807
+ HKEY_LOCAL_MACHINE = None
808
+ HKEY_CURRENT_USER = None
809
+ HKEY_USERS = None
810
+
811
+ def RegGetValue(root, key):
812
+ raise OSError
813
+
814
+ def RegOpenKeyEx(root, key):
815
+ raise OSError
816
+
817
+
818
+ if sys.platform == 'win32':
819
+
820
+ def WhereIs(file, path=None, pathext=None, reject=None) -> Optional[str]:
821
+ if path is None:
822
+ try:
823
+ path = os.environ['PATH']
824
+ except KeyError:
825
+ return None
826
+ if is_String(path):
827
+ path = path.split(os.pathsep)
828
+ if pathext is None:
829
+ try:
830
+ pathext = os.environ['PATHEXT']
831
+ except KeyError:
832
+ pathext = '.COM;.EXE;.BAT;.CMD'
833
+ if is_String(pathext):
834
+ pathext = pathext.split(os.pathsep)
835
+ for ext in pathext:
836
+ if ext.lower() == file[-len(ext):].lower():
837
+ pathext = ['']
838
+ break
839
+ if reject is None:
840
+ reject = []
841
+ if not is_List(reject) and not is_Tuple(reject):
842
+ reject = [reject]
843
+ for p in path:
844
+ f = os.path.join(p, file)
845
+ for ext in pathext:
846
+ fext = f + ext
847
+ if os.path.isfile(fext):
848
+ try:
849
+ reject.index(fext)
850
+ except ValueError:
851
+ return os.path.normpath(fext)
852
+ continue
853
+ return None
854
+
855
+ elif os.name == 'os2':
856
+
857
+ def WhereIs(file, path=None, pathext=None, reject=None) -> Optional[str]:
858
+ if path is None:
859
+ try:
860
+ path = os.environ['PATH']
861
+ except KeyError:
862
+ return None
863
+ if is_String(path):
864
+ path = path.split(os.pathsep)
865
+ if pathext is None:
866
+ pathext = ['.exe', '.cmd']
867
+ for ext in pathext:
868
+ if ext.lower() == file[-len(ext):].lower():
869
+ pathext = ['']
870
+ break
871
+ if reject is None:
872
+ reject = []
873
+ if not is_List(reject) and not is_Tuple(reject):
874
+ reject = [reject]
875
+ for p in path:
876
+ f = os.path.join(p, file)
877
+ for ext in pathext:
878
+ fext = f + ext
879
+ if os.path.isfile(fext):
880
+ try:
881
+ reject.index(fext)
882
+ except ValueError:
883
+ return os.path.normpath(fext)
884
+ continue
885
+ return None
886
+
887
+ else:
888
+
889
+ def WhereIs(file, path=None, pathext=None, reject=None) -> Optional[str]:
890
+ import stat # pylint: disable=import-outside-toplevel
891
+
892
+ if path is None:
893
+ try:
894
+ path = os.environ['PATH']
895
+ except KeyError:
896
+ return None
897
+ if is_String(path):
898
+ path = path.split(os.pathsep)
899
+ if reject is None:
900
+ reject = []
901
+ if not is_List(reject) and not is_Tuple(reject):
902
+ reject = [reject]
903
+ for p in path:
904
+ f = os.path.join(p, file)
905
+ if os.path.isfile(f):
906
+ try:
907
+ st = os.stat(f)
908
+ except OSError:
909
+ # os.stat() raises OSError, not IOError if the file
910
+ # doesn't exist, so in this case we let IOError get
911
+ # raised so as to not mask possibly serious disk or
912
+ # network issues.
913
+ continue
914
+ if stat.S_IMODE(st[stat.ST_MODE]) & 0o111:
915
+ try:
916
+ reject.index(f)
917
+ except ValueError:
918
+ return os.path.normpath(f)
919
+ continue
920
+ return None
921
+
922
+ WhereIs.__doc__ = """\
923
+ Return the path to an executable that matches `file`.
924
+
925
+ Searches the given `path` for `file`, respecting any filename
926
+ extensions `pathext` (on the Windows platform only), and
927
+ returns the full path to the matching command. If no
928
+ command is found, return ``None``.
929
+
930
+ If `path` is not specified, :attr:`os.environ[PATH]` is used.
931
+ If `pathext` is not specified, :attr:`os.environ[PATHEXT]`
932
+ is used. Will not select any path name or names in the optional
933
+ `reject` list.
934
+ """
935
+
936
+ def PrependPath(
937
+ oldpath, newpath, sep=os.pathsep, delete_existing=True, canonicalize=None
938
+ ) -> Union[list, str]:
939
+ """Prepends `newpath` path elements to `oldpath`.
940
+
941
+ Will only add any particular path once (leaving the first one it
942
+ encounters and ignoring the rest, to preserve path order), and will
943
+ :mod:`os.path.normpath` and :mod:`os.path.normcase` all paths to help
944
+ assure this. This can also handle the case where `oldpath`
945
+ is a list instead of a string, in which case a list will be returned
946
+ instead of a string. For example:
947
+
948
+ >>> p = PrependPath("/foo/bar:/foo", "/biz/boom:/foo")
949
+ >>> print(p)
950
+ /biz/boom:/foo:/foo/bar
951
+
952
+ If `delete_existing` is ``False``, then adding a path that exists will
953
+ not move it to the beginning; it will stay where it is in the list.
954
+
955
+ >>> p = PrependPath("/foo/bar:/foo", "/biz/boom:/foo", delete_existing=False)
956
+ >>> print(p)
957
+ /biz/boom:/foo/bar:/foo
958
+
959
+ If `canonicalize` is not ``None``, it is applied to each element of
960
+ `newpath` before use.
961
+ """
962
+
963
+ orig = oldpath
964
+ is_list = True
965
+ paths = orig
966
+ if not is_List(orig) and not is_Tuple(orig):
967
+ paths = paths.split(sep)
968
+ is_list = False
969
+
970
+ if is_String(newpath):
971
+ newpaths = newpath.split(sep)
972
+ elif not is_List(newpath) and not is_Tuple(newpath):
973
+ newpaths = [ newpath ] # might be a Dir
974
+ else:
975
+ newpaths = newpath
976
+
977
+ if canonicalize:
978
+ newpaths=list(map(canonicalize, newpaths))
979
+
980
+ if not delete_existing:
981
+ # First uniquify the old paths, making sure to
982
+ # preserve the first instance (in Unix/Linux,
983
+ # the first one wins), and remembering them in normpaths.
984
+ # Then insert the new paths at the head of the list
985
+ # if they're not already in the normpaths list.
986
+ result = []
987
+ normpaths = []
988
+ for path in paths:
989
+ if not path:
990
+ continue
991
+ normpath = os.path.normpath(os.path.normcase(path))
992
+ if normpath not in normpaths:
993
+ result.append(path)
994
+ normpaths.append(normpath)
995
+ newpaths.reverse() # since we're inserting at the head
996
+ for path in newpaths:
997
+ if not path:
998
+ continue
999
+ normpath = os.path.normpath(os.path.normcase(path))
1000
+ if normpath not in normpaths:
1001
+ result.insert(0, path)
1002
+ normpaths.append(normpath)
1003
+ paths = result
1004
+
1005
+ else:
1006
+ newpaths = newpaths + paths # prepend new paths
1007
+
1008
+ normpaths = []
1009
+ paths = []
1010
+ # now we add them only if they are unique
1011
+ for path in newpaths:
1012
+ normpath = os.path.normpath(os.path.normcase(path))
1013
+ if path and normpath not in normpaths:
1014
+ paths.append(path)
1015
+ normpaths.append(normpath)
1016
+
1017
+ if is_list:
1018
+ return paths
1019
+
1020
+ return sep.join(paths)
1021
+
1022
+ def AppendPath(
1023
+ oldpath, newpath, sep=os.pathsep, delete_existing=True, canonicalize=None
1024
+ ) -> Union[list, str]:
1025
+ """Appends `newpath` path elements to `oldpath`.
1026
+
1027
+ Will only add any particular path once (leaving the last one it
1028
+ encounters and ignoring the rest, to preserve path order), and will
1029
+ :mod:`os.path.normpath` and :mod:`os.path.normcase` all paths to help
1030
+ assure this. This can also handle the case where `oldpath`
1031
+ is a list instead of a string, in which case a list will be returned
1032
+ instead of a string. For example:
1033
+
1034
+ >>> p = AppendPath("/foo/bar:/foo", "/biz/boom:/foo")
1035
+ >>> print(p)
1036
+ /foo/bar:/biz/boom:/foo
1037
+
1038
+ If `delete_existing` is ``False``, then adding a path that exists
1039
+ will not move it to the end; it will stay where it is in the list.
1040
+
1041
+ >>> p = AppendPath("/foo/bar:/foo", "/biz/boom:/foo", delete_existing=False)
1042
+ >>> print(p)
1043
+ /foo/bar:/foo:/biz/boom
1044
+
1045
+ If `canonicalize` is not ``None``, it is applied to each element of
1046
+ `newpath` before use.
1047
+ """
1048
+
1049
+ orig = oldpath
1050
+ is_list = True
1051
+ paths = orig
1052
+ if not is_List(orig) and not is_Tuple(orig):
1053
+ paths = paths.split(sep)
1054
+ is_list = False
1055
+
1056
+ if is_String(newpath):
1057
+ newpaths = newpath.split(sep)
1058
+ elif not is_List(newpath) and not is_Tuple(newpath):
1059
+ newpaths = [newpath] # might be a Dir
1060
+ else:
1061
+ newpaths = newpath
1062
+
1063
+ if canonicalize:
1064
+ newpaths=list(map(canonicalize, newpaths))
1065
+
1066
+ if not delete_existing:
1067
+ # add old paths to result, then
1068
+ # add new paths if not already present
1069
+ # (I thought about using a dict for normpaths for speed,
1070
+ # but it's not clear hashing the strings would be faster
1071
+ # than linear searching these typically short lists.)
1072
+ result = []
1073
+ normpaths = []
1074
+ for path in paths:
1075
+ if not path:
1076
+ continue
1077
+ result.append(path)
1078
+ normpaths.append(os.path.normpath(os.path.normcase(path)))
1079
+ for path in newpaths:
1080
+ if not path:
1081
+ continue
1082
+ normpath = os.path.normpath(os.path.normcase(path))
1083
+ if normpath not in normpaths:
1084
+ result.append(path)
1085
+ normpaths.append(normpath)
1086
+ paths = result
1087
+ else:
1088
+ # start w/ new paths, add old ones if not present,
1089
+ # then reverse.
1090
+ newpaths = paths + newpaths # append new paths
1091
+ newpaths.reverse()
1092
+
1093
+ normpaths = []
1094
+ paths = []
1095
+ # now we add them only if they are unique
1096
+ for path in newpaths:
1097
+ normpath = os.path.normpath(os.path.normcase(path))
1098
+ if path and normpath not in normpaths:
1099
+ paths.append(path)
1100
+ normpaths.append(normpath)
1101
+ paths.reverse()
1102
+
1103
+ if is_list:
1104
+ return paths
1105
+
1106
+ return sep.join(paths)
1107
+
1108
+ def AddPathIfNotExists(env_dict, key, path, sep=os.pathsep):
1109
+ """Add a path element to a construction variable.
1110
+
1111
+ `key` is looked up in `env_dict`, and `path` is added to it if it
1112
+ is not already present. `env_dict[key]` is assumed to be in the
1113
+ format of a PATH variable: a list of paths separated by `sep` tokens.
1114
+ Example:
1115
+
1116
+ >>> env = {'PATH': '/bin:/usr/bin:/usr/local/bin'}
1117
+ >>> AddPathIfNotExists(env, 'PATH', '/opt/bin')
1118
+ >>> print(env['PATH'])
1119
+ /opt/bin:/bin:/usr/bin:/usr/local/bin
1120
+ """
1121
+
1122
+ try:
1123
+ is_list = True
1124
+ paths = env_dict[key]
1125
+ if not is_List(env_dict[key]):
1126
+ paths = paths.split(sep)
1127
+ is_list = False
1128
+ if os.path.normcase(path) not in list(map(os.path.normcase, paths)):
1129
+ paths = [ path ] + paths
1130
+ if is_list:
1131
+ env_dict[key] = paths
1132
+ else:
1133
+ env_dict[key] = sep.join(paths)
1134
+ except KeyError:
1135
+ env_dict[key] = path
1136
+
1137
+ if sys.platform == 'cygwin':
1138
+ import subprocess # pylint: disable=import-outside-toplevel
1139
+
1140
+ def get_native_path(path) -> str:
1141
+ cp = subprocess.run(('cygpath', '-w', path), check=False, stdout=subprocess.PIPE)
1142
+ return cp.stdout.decode().replace('\n', '')
1143
+ else:
1144
+ def get_native_path(path) -> str:
1145
+ return path
1146
+
1147
+ get_native_path.__doc__ = """\
1148
+ Transform an absolute path into a native path for the system.
1149
+
1150
+ In Cygwin, this converts from a Cygwin path to a Windows path,
1151
+ without regard to whether `path` refers to an existing file
1152
+ system object. For other platforms, `path` is unchanged.
1153
+ """
1154
+
1155
+
1156
+ display = DisplayEngine()
1157
+
1158
+ def Split(arg) -> list:
1159
+ """Returns a list of file names or other objects.
1160
+
1161
+ If `arg` is a string, it will be split on strings of white-space
1162
+ characters within the string. If `arg` is already a list, the list
1163
+ will be returned untouched. If `arg` is any other type of object,
1164
+ it will be returned as a list containing just the object.
1165
+
1166
+ >>> print(Split(" this is a string "))
1167
+ ['this', 'is', 'a', 'string']
1168
+ >>> print(Split(["stringlist", " preserving ", " spaces "]))
1169
+ ['stringlist', ' preserving ', ' spaces ']
1170
+ """
1171
+ if is_List(arg) or is_Tuple(arg):
1172
+ return arg
1173
+
1174
+ if is_String(arg):
1175
+ return arg.split()
1176
+
1177
+ return [arg]
1178
+
1179
+
1180
+ class CLVar(UserList):
1181
+ """A container for command-line construction variables.
1182
+
1183
+ Forces the use of a list of strings intended as command-line
1184
+ arguments. Like :class:`collections.UserList`, but the argument
1185
+ passed to the initializter will be processed by the :func:`Split`
1186
+ function, which includes special handling for string types: they
1187
+ will be split into a list of words, not coereced directly to a list.
1188
+ The same happens if a string is added to a :class:`CLVar`,
1189
+ which allows doing the right thing with both
1190
+ :func:`Append`/:func:`Prepend` methods,
1191
+ as well as with pure Python addition, regardless of whether adding
1192
+ a list or a string to a construction variable.
1193
+
1194
+ Side effect: spaces will be stripped from individual string
1195
+ arguments. If you need spaces preserved, pass strings containing
1196
+ spaces inside a list argument.
1197
+
1198
+ >>> u = UserList("--some --opts and args")
1199
+ >>> print(len(u), repr(u))
1200
+ 22 ['-', '-', 's', 'o', 'm', 'e', ' ', '-', '-', 'o', 'p', 't', 's', ' ', 'a', 'n', 'd', ' ', 'a', 'r', 'g', 's']
1201
+ >>> c = CLVar("--some --opts and args")
1202
+ >>> print(len(c), repr(c))
1203
+ 4 ['--some', '--opts', 'and', 'args']
1204
+ >>> c += " strips spaces "
1205
+ >>> print(len(c), repr(c))
1206
+ 6 ['--some', '--opts', 'and', 'args', 'strips', 'spaces']
1207
+ """
1208
+
1209
+ def __init__(self, initlist=None):
1210
+ super().__init__(Split(initlist if initlist is not None else []))
1211
+
1212
+ def __add__(self, other):
1213
+ return super().__add__(CLVar(other))
1214
+
1215
+ def __radd__(self, other):
1216
+ return super().__radd__(CLVar(other))
1217
+
1218
+ def __iadd__(self, other):
1219
+ return super().__iadd__(CLVar(other))
1220
+
1221
+ def __str__(self):
1222
+ return ' '.join(self.data)
1223
+
1224
+
1225
+ class Selector(OrderedDict):
1226
+ """A callable ordered dictionary that maps file suffixes to
1227
+ dictionary values. We preserve the order in which items are added
1228
+ so that :func:`get_suffix` calls always return the first suffix added.
1229
+ """
1230
+ def __call__(self, env, source, ext=None):
1231
+ if ext is None:
1232
+ try:
1233
+ ext = source[0].get_suffix()
1234
+ except IndexError:
1235
+ ext = ""
1236
+ try:
1237
+ return self[ext]
1238
+ except KeyError:
1239
+ # Try to perform Environment substitution on the keys of
1240
+ # the dictionary before giving up.
1241
+ s_dict = {}
1242
+ for (k,v) in self.items():
1243
+ if k is not None:
1244
+ s_k = env.subst(k)
1245
+ if s_k in s_dict:
1246
+ # We only raise an error when variables point
1247
+ # to the same suffix. If one suffix is literal
1248
+ # and a variable suffix contains this literal,
1249
+ # the literal wins and we don't raise an error.
1250
+ raise KeyError(s_dict[s_k][0], k, s_k)
1251
+ s_dict[s_k] = (k,v)
1252
+ try:
1253
+ return s_dict[ext][1]
1254
+ except KeyError:
1255
+ try:
1256
+ return self[None]
1257
+ except KeyError:
1258
+ return None
1259
+
1260
+
1261
+ if sys.platform == 'cygwin':
1262
+ # On Cygwin, os.path.normcase() lies, so just report back the
1263
+ # fact that the underlying Windows OS is case-insensitive.
1264
+ def case_sensitive_suffixes(s1, s2) -> bool: # pylint: disable=unused-argument
1265
+ return False
1266
+
1267
+ else:
1268
+ def case_sensitive_suffixes(s1, s2) -> bool:
1269
+ return os.path.normcase(s1) != os.path.normcase(s2)
1270
+
1271
+
1272
+ def adjustixes(fname, pre, suf, ensure_suffix=False) -> str:
1273
+ """Adjust filename prefixes and suffixes as needed.
1274
+
1275
+ Add `prefix` to `fname` if specified.
1276
+ Add `suffix` to `fname` if specified and if `ensure_suffix` is ``True``
1277
+ """
1278
+
1279
+ if pre:
1280
+ path, fn = os.path.split(os.path.normpath(fname))
1281
+
1282
+ # Handle the odd case where the filename = the prefix.
1283
+ # In that case, we still want to add the prefix to the file
1284
+ if not fn.startswith(pre) or fn == pre:
1285
+ fname = os.path.join(path, pre + fn)
1286
+ # Only append a suffix if the suffix we're going to add isn't already
1287
+ # there, and if either we've been asked to ensure the specific suffix
1288
+ # is present or there's no suffix on it at all.
1289
+ # Also handle the odd case where the filename = the suffix.
1290
+ # in that case we still want to append the suffix
1291
+ if suf and not fname.endswith(suf) and \
1292
+ (ensure_suffix or not splitext(fname)[1]):
1293
+ fname = fname + suf
1294
+ return fname
1295
+
1296
+
1297
+
1298
+ # From Tim Peters,
1299
+ # https://code.activestate.com/recipes/52560
1300
+ # ASPN: Python Cookbook: Remove duplicates from a sequence
1301
+ # (Also in the printed Python Cookbook.)
1302
+ # Updated. This algorithm is used by some scanners and tools.
1303
+
1304
+ def unique(seq):
1305
+ """Return a list of the elements in seq without duplicates, ignoring order.
1306
+
1307
+ >>> mylist = unique([1, 2, 3, 1, 2, 3])
1308
+ >>> print(sorted(mylist))
1309
+ [1, 2, 3]
1310
+ >>> mylist = unique("abcabc")
1311
+ >>> print(sorted(mylist))
1312
+ ['a', 'b', 'c']
1313
+ >>> mylist = unique(([1, 2], [2, 3], [1, 2]))
1314
+ >>> print(sorted(mylist))
1315
+ [[1, 2], [2, 3]]
1316
+
1317
+ For best speed, all sequence elements should be hashable. Then
1318
+ unique() will usually work in linear time.
1319
+
1320
+ If not possible, the sequence elements should enjoy a total
1321
+ ordering, and if list(s).sort() doesn't raise TypeError it's
1322
+ assumed that they do enjoy a total ordering. Then unique() will
1323
+ usually work in O(N*log2(N)) time.
1324
+
1325
+ If that's not possible either, the sequence elements must support
1326
+ equality-testing. Then unique() will usually work in quadratic time.
1327
+ """
1328
+
1329
+ if not seq:
1330
+ return []
1331
+
1332
+ # Try using a dict first, as that's the fastest and will usually
1333
+ # work. If it doesn't work, it will usually fail quickly, so it
1334
+ # usually doesn't cost much to *try* it. It requires that all the
1335
+ # sequence elements be hashable, and support equality comparison.
1336
+ # TODO: should be even faster: return(list(set(seq)))
1337
+ with suppress(TypeError):
1338
+ return list(dict.fromkeys(seq))
1339
+
1340
+ # We couldn't hash all the elements (got a TypeError).
1341
+ # Next fastest is to sort, which brings the equal elements together;
1342
+ # then duplicates are easy to weed out in a single pass.
1343
+ # NOTE: Python's list.sort() was designed to be efficient in the
1344
+ # presence of many duplicate elements. This isn't true of all
1345
+ # sort functions in all languages or libraries, so this approach
1346
+ # is more effective in Python than it may be elsewhere.
1347
+ n = len(seq)
1348
+ try:
1349
+ t = sorted(seq)
1350
+ except TypeError:
1351
+ pass # move on to the next method
1352
+ else:
1353
+ last = t[0]
1354
+ lasti = i = 1
1355
+ while i < n:
1356
+ if t[i] != last:
1357
+ t[lasti] = last = t[i]
1358
+ lasti = lasti + 1
1359
+ i = i + 1
1360
+ return t[:lasti]
1361
+
1362
+ # Brute force is all that's left.
1363
+ u = []
1364
+ for x in seq:
1365
+ if x not in u:
1366
+ u.append(x)
1367
+ return u
1368
+
1369
+
1370
+ # From Alex Martelli,
1371
+ # https://code.activestate.com/recipes/52560
1372
+ # ASPN: Python Cookbook: Remove duplicates from a sequence
1373
+ # First comment, dated 2001/10/13.
1374
+ # (Also in the printed Python Cookbook.)
1375
+ # This not currently used, in favor of the next function...
1376
+
1377
+ def uniquer(seq, idfun=None):
1378
+ def default_idfun(x):
1379
+ return x
1380
+ if not idfun:
1381
+ idfun = default_idfun
1382
+ seen = {}
1383
+ result = []
1384
+ result_append = result.append # perf: avoid repeated method lookups
1385
+ for item in seq:
1386
+ marker = idfun(item)
1387
+ if marker in seen:
1388
+ continue
1389
+ seen[marker] = 1
1390
+ result_append(item)
1391
+ return result
1392
+
1393
+ # A more efficient implementation of Alex's uniquer(), this avoids the
1394
+ # idfun() argument and function-call overhead by assuming that all
1395
+ # items in the sequence are hashable. Order-preserving.
1396
+
1397
+ def uniquer_hashables(seq):
1398
+ seen = {}
1399
+ result = []
1400
+ result_append = result.append # perf: avoid repeated method lookups
1401
+ for item in seq:
1402
+ if item not in seen:
1403
+ seen[item] = 1
1404
+ result_append(item)
1405
+ return result
1406
+
1407
+
1408
+ # Recipe 19.11 "Reading Lines with Continuation Characters",
1409
+ # by Alex Martelli, straight from the Python CookBook (2nd edition).
1410
+ def logical_lines(physical_lines, joiner=''.join):
1411
+ logical_line = []
1412
+ for line in physical_lines:
1413
+ stripped = line.rstrip()
1414
+ if stripped.endswith('\\'):
1415
+ # a line which continues w/the next physical line
1416
+ logical_line.append(stripped[:-1])
1417
+ else:
1418
+ # a line which does not continue, end of logical line
1419
+ logical_line.append(line)
1420
+ yield joiner(logical_line)
1421
+ logical_line = []
1422
+ if logical_line:
1423
+ # end of sequence implies end of last logical line
1424
+ yield joiner(logical_line)
1425
+
1426
+
1427
+ class LogicalLines:
1428
+ """ Wrapper class for the logical_lines method.
1429
+
1430
+ Allows us to read all "logical" lines at once from a given file object.
1431
+ """
1432
+
1433
+ def __init__(self, fileobj):
1434
+ self.fileobj = fileobj
1435
+
1436
+ def readlines(self):
1437
+ return list(logical_lines(self.fileobj))
1438
+
1439
+
1440
+ class UniqueList(UserList):
1441
+ """A list which maintains uniqueness.
1442
+
1443
+ Uniquing is lazy: rather than being assured on list changes, it is fixed
1444
+ up on access by those methods which need to act on a uniqe list to be
1445
+ correct. That means things like "in" don't have to eat the uniquing time.
1446
+ """
1447
+ def __init__(self, initlist=None):
1448
+ super().__init__(initlist)
1449
+ self.unique = True
1450
+
1451
+ def __make_unique(self):
1452
+ if not self.unique:
1453
+ self.data = uniquer_hashables(self.data)
1454
+ self.unique = True
1455
+
1456
+ def __repr__(self):
1457
+ self.__make_unique()
1458
+ return super().__repr__()
1459
+
1460
+ def __lt__(self, other):
1461
+ self.__make_unique()
1462
+ return super().__lt__(other)
1463
+
1464
+ def __le__(self, other):
1465
+ self.__make_unique()
1466
+ return super().__le__(other)
1467
+
1468
+ def __eq__(self, other):
1469
+ self.__make_unique()
1470
+ return super().__eq__(other)
1471
+
1472
+ def __ne__(self, other):
1473
+ self.__make_unique()
1474
+ return super().__ne__(other)
1475
+
1476
+ def __gt__(self, other):
1477
+ self.__make_unique()
1478
+ return super().__gt__(other)
1479
+
1480
+ def __ge__(self, other):
1481
+ self.__make_unique()
1482
+ return super().__ge__(other)
1483
+
1484
+ # __contains__ doesn't need to worry about uniquing, inherit
1485
+
1486
+ def __len__(self):
1487
+ self.__make_unique()
1488
+ return super().__len__()
1489
+
1490
+ def __getitem__(self, i):
1491
+ self.__make_unique()
1492
+ return super().__getitem__(i)
1493
+
1494
+ def __setitem__(self, i, item):
1495
+ super().__setitem__(i, item)
1496
+ self.unique = False
1497
+
1498
+ # __delitem__ doesn't need to worry about uniquing, inherit
1499
+
1500
+ def __add__(self, other):
1501
+ result = super().__add__(other)
1502
+ result.unique = False
1503
+ return result
1504
+
1505
+ def __radd__(self, other):
1506
+ result = super().__radd__(other)
1507
+ result.unique = False
1508
+ return result
1509
+
1510
+ def __iadd__(self, other):
1511
+ result = super().__iadd__(other)
1512
+ result.unique = False
1513
+ return result
1514
+
1515
+ def __mul__(self, other):
1516
+ result = super().__mul__(other)
1517
+ result.unique = False
1518
+ return result
1519
+
1520
+ def __rmul__(self, other):
1521
+ result = super().__rmul__(other)
1522
+ result.unique = False
1523
+ return result
1524
+
1525
+ def __imul__(self, other):
1526
+ result = super().__imul__(other)
1527
+ result.unique = False
1528
+ return result
1529
+
1530
+ def append(self, item):
1531
+ super().append(item)
1532
+ self.unique = False
1533
+
1534
+ def insert(self, i, item):
1535
+ super().insert(i, item)
1536
+ self.unique = False
1537
+
1538
+ def count(self, item):
1539
+ self.__make_unique()
1540
+ return super().count(item)
1541
+
1542
+ def index(self, item, *args):
1543
+ self.__make_unique()
1544
+ return super().index(item, *args)
1545
+
1546
+ def reverse(self):
1547
+ self.__make_unique()
1548
+ super().reverse()
1549
+
1550
+ # TODO: Py3.8: def sort(self, /, *args, **kwds):
1551
+ def sort(self, *args, **kwds):
1552
+ self.__make_unique()
1553
+ return super().sort(*args, **kwds)
1554
+
1555
+ def extend(self, other):
1556
+ super().extend(other)
1557
+ self.unique = False
1558
+
1559
+
1560
+ class Unbuffered:
1561
+ """A proxy that wraps a file object, flushing after every write.
1562
+
1563
+ Delegates everything else to the wrapped object.
1564
+ """
1565
+ def __init__(self, file):
1566
+ self.file = file
1567
+
1568
+ def write(self, arg):
1569
+ # Stdout might be connected to a pipe that has been closed
1570
+ # by now. The most likely reason for the pipe being closed
1571
+ # is that the user has press ctrl-c. It this is the case,
1572
+ # then SCons is currently shutdown. We therefore ignore
1573
+ # IOError's here so that SCons can continue and shutdown
1574
+ # properly so that the .sconsign is correctly written
1575
+ # before SCons exits.
1576
+ with suppress(IOError):
1577
+ self.file.write(arg)
1578
+ self.file.flush()
1579
+
1580
+ def writelines(self, arg):
1581
+ with suppress(IOError):
1582
+ self.file.writelines(arg)
1583
+ self.file.flush()
1584
+
1585
+ def __getattr__(self, attr):
1586
+ return getattr(self.file, attr)
1587
+
1588
+ def make_path_relative(path) -> str:
1589
+ """Converts an absolute path name to a relative pathname."""
1590
+
1591
+ if os.path.isabs(path):
1592
+ drive_s, path = os.path.splitdrive(path)
1593
+
1594
+ if not drive_s:
1595
+ path=re.compile(r"/*(.*)").findall(path)[0]
1596
+ else:
1597
+ path=path[1:]
1598
+
1599
+ assert not os.path.isabs(path), path
1600
+ return path
1601
+
1602
+
1603
+ # The original idea for AddMethod() came from the
1604
+ # following post to the ActiveState Python Cookbook:
1605
+ #
1606
+ # ASPN: Python Cookbook : Install bound methods in an instance
1607
+ # https://code.activestate.com/recipes/223613
1608
+ #
1609
+ # Changed as follows:
1610
+ # * Switched the installmethod() "object" and "function" arguments,
1611
+ # so the order reflects that the left-hand side is the thing being
1612
+ # "assigned to" and the right-hand side is the value being assigned.
1613
+ # * The instance/class detection is changed a bit, as it's all
1614
+ # new-style classes now with Py3.
1615
+ # * The by-hand construction of the function object from renamefunction()
1616
+ # is not needed, the remaining bit is now used inline in AddMethod.
1617
+
1618
+ def AddMethod(obj, function, name=None):
1619
+ """Adds a method to an object.
1620
+
1621
+ Adds `function` to `obj` if `obj` is a class object.
1622
+ Adds `function` as a bound method if `obj` is an instance object.
1623
+ If `obj` looks like an environment instance, use `MethodWrapper`
1624
+ to add it. If `name` is supplied it is used as the name of `function`.
1625
+
1626
+ Although this works for any class object, the intent as a public
1627
+ API is to be used on Environment, to be able to add a method to all
1628
+ construction environments; it is preferred to use env.AddMethod
1629
+ to add to an individual environment.
1630
+
1631
+ >>> class A:
1632
+ ... ...
1633
+
1634
+ >>> a = A()
1635
+
1636
+ >>> def f(self, x, y):
1637
+ ... self.z = x + y
1638
+
1639
+ >>> AddMethod(A, f, "add")
1640
+ >>> a.add(2, 4)
1641
+ >>> print(a.z)
1642
+ 6
1643
+ >>> a.data = ['a', 'b', 'c', 'd', 'e', 'f']
1644
+ >>> AddMethod(a, lambda self, i: self.data[i], "listIndex")
1645
+ >>> print(a.listIndex(3))
1646
+ d
1647
+
1648
+ """
1649
+ if name is None:
1650
+ name = function.__name__
1651
+ else:
1652
+ # "rename"
1653
+ function = FunctionType(
1654
+ function.__code__, function.__globals__, name, function.__defaults__
1655
+ )
1656
+
1657
+ if hasattr(obj, '__class__') and obj.__class__ is not type:
1658
+ # obj is an instance, so it gets a bound method.
1659
+ if hasattr(obj, "added_methods"):
1660
+ method = MethodWrapper(obj, function, name)
1661
+ obj.added_methods.append(method)
1662
+ else:
1663
+ method = MethodType(function, obj)
1664
+ else:
1665
+ # obj is a class
1666
+ method = function
1667
+
1668
+ setattr(obj, name, method)
1669
+
1670
+
1671
+ # Default hash function and format. SCons-internal.
1672
+ DEFAULT_HASH_FORMATS = ['md5', 'sha1', 'sha256']
1673
+ ALLOWED_HASH_FORMATS = []
1674
+ _HASH_FUNCTION = None
1675
+ _HASH_FORMAT = None
1676
+
1677
+ def _attempt_init_of_python_3_9_hash_object(hash_function_object, sys_used=sys):
1678
+ """Python 3.9 and onwards lets us initialize the hash function object with the
1679
+ key "usedforsecurity"=false. This lets us continue to use algorithms that have
1680
+ been deprecated either by FIPS or by Python itself, as the MD5 algorithm SCons
1681
+ prefers is not being used for security purposes as much as a short, 32 char
1682
+ hash that is resistant to accidental collisions.
1683
+
1684
+ In prior versions of python, hashlib returns a native function wrapper, which
1685
+ errors out when it's queried for the optional parameter, so this function
1686
+ wraps that call.
1687
+
1688
+ It can still throw a ValueError if the initialization fails due to FIPS
1689
+ compliance issues, but that is assumed to be the responsibility of the caller.
1690
+ """
1691
+ if hash_function_object is None:
1692
+ return None
1693
+
1694
+ # https://stackoverflow.com/a/11887885 details how to check versions with the "packaging" library.
1695
+ # however, for our purposes checking the version is greater than or equal to 3.9 is good enough, as
1696
+ # the API is guaranteed to have support for the 'usedforsecurity' flag in 3.9. See
1697
+ # https://docs.python.org/3/library/hashlib.html#:~:text=usedforsecurity for the version support notes.
1698
+ if (sys_used.version_info.major > 3) or (sys_used.version_info.major == 3 and sys_used.version_info.minor >= 9):
1699
+ return hash_function_object(usedforsecurity=False)
1700
+
1701
+ # note that this can throw a ValueError in FIPS-enabled versions of Linux prior to 3.9
1702
+ # the OpenSSL hashlib will throw on first init here, but that is assumed to be responsibility of
1703
+ # the caller to diagnose the ValueError & potentially display the error to screen.
1704
+ return hash_function_object()
1705
+
1706
+ def _set_allowed_viable_default_hashes(hashlib_used, sys_used=sys):
1707
+ """Checks if SCons has ability to call the default algorithms normally supported.
1708
+
1709
+ This util class is sometimes called prior to setting the user-selected hash algorithm,
1710
+ meaning that on FIPS-compliant systems the library would default-initialize MD5
1711
+ and throw an exception in set_hash_format. A common case is using the SConf options,
1712
+ which can run prior to main, and thus ignore the options.hash_format variable.
1713
+
1714
+ This function checks the DEFAULT_HASH_FORMATS and sets the ALLOWED_HASH_FORMATS
1715
+ to only the ones that can be called. In Python >= 3.9 this will always default to
1716
+ MD5 as in Python 3.9 there is an optional attribute "usedforsecurity" set for the method.
1717
+
1718
+ Throws if no allowed hash formats are detected.
1719
+ """
1720
+ global ALLOWED_HASH_FORMATS
1721
+ _last_error = None
1722
+ # note: if you call this method repeatedly, example using timeout, this is needed.
1723
+ # otherwise it keeps appending valid formats to the string
1724
+ ALLOWED_HASH_FORMATS = []
1725
+
1726
+ for test_algorithm in DEFAULT_HASH_FORMATS:
1727
+ _test_hash = getattr(hashlib_used, test_algorithm, None)
1728
+ # we know hashlib claims to support it... check to see if we can call it.
1729
+ if _test_hash is not None:
1730
+ # the hashing library will throw an exception on initialization in FIPS mode,
1731
+ # meaning if we call the default algorithm returned with no parameters, it'll
1732
+ # throw if it's a bad algorithm, otherwise it will append it to the known
1733
+ # good formats.
1734
+ try:
1735
+ _attempt_init_of_python_3_9_hash_object(_test_hash, sys_used)
1736
+ ALLOWED_HASH_FORMATS.append(test_algorithm)
1737
+ except ValueError as e:
1738
+ _last_error = e
1739
+ continue
1740
+
1741
+ if len(ALLOWED_HASH_FORMATS) == 0:
1742
+ from SCons.Errors import SConsEnvironmentError # pylint: disable=import-outside-toplevel
1743
+ # chain the exception thrown with the most recent error from hashlib.
1744
+ raise SConsEnvironmentError(
1745
+ 'No usable hash algorithms found.'
1746
+ 'Most recent error from hashlib attached in trace.'
1747
+ ) from _last_error
1748
+ return
1749
+
1750
+ _set_allowed_viable_default_hashes(hashlib)
1751
+
1752
+
1753
+ def get_hash_format():
1754
+ """Retrieves the hash format or ``None`` if not overridden.
1755
+
1756
+ A return value of ``None``
1757
+ does not guarantee that MD5 is being used; instead, it means that the
1758
+ default precedence order documented in :func:`SCons.Util.set_hash_format`
1759
+ is respected.
1760
+ """
1761
+ return _HASH_FORMAT
1762
+
1763
+ def _attempt_get_hash_function(hash_name, hashlib_used=hashlib, sys_used=sys):
1764
+ """Wrapper used to try to initialize a hash function given.
1765
+
1766
+ If successful, returns the name of the hash function back to the user.
1767
+
1768
+ Otherwise returns None.
1769
+ """
1770
+ try:
1771
+ _fetch_hash = getattr(hashlib_used, hash_name, None)
1772
+ if _fetch_hash is None:
1773
+ return None
1774
+ _attempt_init_of_python_3_9_hash_object(_fetch_hash, sys_used)
1775
+ return hash_name
1776
+ except ValueError:
1777
+ # if attempt_init_of_python_3_9 throws, this is typically due to FIPS being enabled
1778
+ # however, if we get to this point, the viable hash function check has either been
1779
+ # bypassed or otherwise failed to properly restrict the user to only the supported
1780
+ # functions. As such throw the UserError as an internal assertion-like error.
1781
+ return None
1782
+
1783
+ def set_hash_format(hash_format, hashlib_used=hashlib, sys_used=sys):
1784
+ """Sets the default hash format used by SCons.
1785
+
1786
+ If `hash_format` is ``None`` or
1787
+ an empty string, the default is determined by this function.
1788
+
1789
+ Currently the default behavior is to use the first available format of
1790
+ the following options: MD5, SHA1, SHA256.
1791
+ """
1792
+ global _HASH_FORMAT, _HASH_FUNCTION
1793
+
1794
+ _HASH_FORMAT = hash_format
1795
+ if hash_format:
1796
+ hash_format_lower = hash_format.lower()
1797
+ if hash_format_lower not in ALLOWED_HASH_FORMATS:
1798
+ from SCons.Errors import UserError # pylint: disable=import-outside-toplevel
1799
+
1800
+ # user can select something not supported by their OS but normally supported by
1801
+ # SCons, example, selecting MD5 in an OS with FIPS-mode turned on. Therefore we first
1802
+ # check if SCons supports it, and then if their local OS supports it.
1803
+ if hash_format_lower in DEFAULT_HASH_FORMATS:
1804
+ raise UserError('While hash format "%s" is supported by SCons, the '
1805
+ 'local system indicates only the following hash '
1806
+ 'formats are supported by the hashlib library: %s' %
1807
+ (hash_format_lower,
1808
+ ', '.join(ALLOWED_HASH_FORMATS))
1809
+ )
1810
+ else:
1811
+ # the hash format isn't supported by SCons in any case. Warn the user, and
1812
+ # if we detect that SCons supports more algorithms than their local system
1813
+ # supports, warn the user about that too.
1814
+ if ALLOWED_HASH_FORMATS == DEFAULT_HASH_FORMATS:
1815
+ raise UserError('Hash format "%s" is not supported by SCons. Only '
1816
+ 'the following hash formats are supported: %s' %
1817
+ (hash_format_lower,
1818
+ ', '.join(ALLOWED_HASH_FORMATS))
1819
+ )
1820
+ else:
1821
+ raise UserError('Hash format "%s" is not supported by SCons. '
1822
+ 'SCons supports more hash formats than your local system '
1823
+ 'is reporting; SCons supports: %s. Your local system only '
1824
+ 'supports: %s' %
1825
+ (hash_format_lower,
1826
+ ', '.join(DEFAULT_HASH_FORMATS),
1827
+ ', '.join(ALLOWED_HASH_FORMATS))
1828
+ )
1829
+
1830
+ # this is not expected to fail. If this fails it means the set_allowed_viable_default_hashes
1831
+ # function did not throw, or when it threw, the exception was caught and ignored, or
1832
+ # the global ALLOWED_HASH_FORMATS was changed by an external user.
1833
+ _HASH_FUNCTION = _attempt_get_hash_function(hash_format_lower, hashlib_used, sys_used)
1834
+
1835
+ if _HASH_FUNCTION is None:
1836
+ from SCons.Errors import UserError # pylint: disable=import-outside-toplevel
1837
+
1838
+ raise UserError(
1839
+ 'Hash format "%s" is not available in your Python interpreter. '
1840
+ 'Expected to be supported algorithm by set_allowed_viable_default_hashes, '
1841
+ 'Assertion error in SCons.'
1842
+ % hash_format_lower
1843
+ )
1844
+ else:
1845
+ # Set the default hash format based on what is available, defaulting
1846
+ # to the first supported hash algorithm (usually md5) for backwards compatibility.
1847
+ # in FIPS-compliant systems this usually defaults to SHA1, unless that too has been
1848
+ # disabled.
1849
+ for choice in ALLOWED_HASH_FORMATS:
1850
+ _HASH_FUNCTION = _attempt_get_hash_function(choice, hashlib_used, sys_used)
1851
+
1852
+ if _HASH_FUNCTION is not None:
1853
+ break
1854
+ else:
1855
+ # This is not expected to happen in practice.
1856
+ from SCons.Errors import UserError # pylint: disable=import-outside-toplevel
1857
+
1858
+ raise UserError(
1859
+ 'Your Python interpreter does not have MD5, SHA1, or SHA256. '
1860
+ 'SCons requires at least one. Expected to support one or more '
1861
+ 'during set_allowed_viable_default_hashes.'
1862
+ )
1863
+
1864
+ # Ensure that this is initialized in case either:
1865
+ # 1. This code is running in a unit test.
1866
+ # 2. This code is running in a consumer that does hash operations while
1867
+ # SConscript files are being loaded.
1868
+ set_hash_format(None)
1869
+
1870
+
1871
+ def get_current_hash_algorithm_used():
1872
+ """Returns the current hash algorithm name used.
1873
+
1874
+ Where the python version >= 3.9, this is expected to return md5.
1875
+ If python's version is <= 3.8, this returns md5 on non-FIPS-mode platforms, and
1876
+ sha1 or sha256 on FIPS-mode Linux platforms.
1877
+
1878
+ This function is primarily useful for testing, where one expects a value to be
1879
+ one of N distinct hashes, and therefore the test needs to know which hash to select.
1880
+ """
1881
+ return _HASH_FUNCTION
1882
+
1883
+ def _get_hash_object(hash_format, hashlib_used=hashlib, sys_used=sys):
1884
+ """Allocates a hash object using the requested hash format.
1885
+
1886
+ Args:
1887
+ hash_format: Hash format to use.
1888
+
1889
+ Returns:
1890
+ hashlib object.
1891
+ """
1892
+ if hash_format is None:
1893
+ if _HASH_FUNCTION is None:
1894
+ from SCons.Errors import UserError # pylint: disable=import-outside-toplevel
1895
+
1896
+ raise UserError('There is no default hash function. Did you call '
1897
+ 'a hashing function before SCons was initialized?')
1898
+ return _attempt_init_of_python_3_9_hash_object(getattr(hashlib_used, _HASH_FUNCTION, None), sys_used)
1899
+
1900
+ if not hasattr(hashlib, hash_format):
1901
+ from SCons.Errors import UserError # pylint: disable=import-outside-toplevel
1902
+
1903
+ raise UserError(
1904
+ 'Hash format "%s" is not available in your Python interpreter.' %
1905
+ hash_format)
1906
+
1907
+ return _attempt_init_of_python_3_9_hash_object(getattr(hashlib, hash_format), sys_used)
1908
+
1909
+
1910
+ def hash_signature(s, hash_format=None):
1911
+ """
1912
+ Generate hash signature of a string
1913
+
1914
+ Args:
1915
+ s: either string or bytes. Normally should be bytes
1916
+ hash_format: Specify to override default hash format
1917
+
1918
+ Returns:
1919
+ String of hex digits representing the signature
1920
+ """
1921
+ m = _get_hash_object(hash_format)
1922
+ try:
1923
+ m.update(to_bytes(s))
1924
+ except TypeError:
1925
+ m.update(to_bytes(str(s)))
1926
+
1927
+ return m.hexdigest()
1928
+
1929
+
1930
+ def hash_file_signature(fname, chunksize=65536, hash_format=None):
1931
+ """
1932
+ Generate the md5 signature of a file
1933
+
1934
+ Args:
1935
+ fname: file to hash
1936
+ chunksize: chunk size to read
1937
+ hash_format: Specify to override default hash format
1938
+
1939
+ Returns:
1940
+ String of Hex digits representing the signature
1941
+ """
1942
+
1943
+ m = _get_hash_object(hash_format)
1944
+ with open(fname, "rb") as f:
1945
+ while True:
1946
+ blck = f.read(chunksize)
1947
+ if not blck:
1948
+ break
1949
+ m.update(to_bytes(blck))
1950
+ return m.hexdigest()
1951
+
1952
+
1953
+ def hash_collect(signatures, hash_format=None):
1954
+ """
1955
+ Collects a list of signatures into an aggregate signature.
1956
+
1957
+ Args:
1958
+ signatures: a list of signatures
1959
+ hash_format: Specify to override default hash format
1960
+
1961
+ Returns:
1962
+ the aggregate signature
1963
+ """
1964
+
1965
+ if len(signatures) == 1:
1966
+ return signatures[0]
1967
+
1968
+ return hash_signature(', '.join(signatures), hash_format)
1969
+
1970
+
1971
+ _MD5_WARNING_SHOWN = False
1972
+
1973
+ def _show_md5_warning(function_name):
1974
+ """Shows a deprecation warning for various MD5 functions."""
1975
+
1976
+ global _MD5_WARNING_SHOWN
1977
+
1978
+ if not _MD5_WARNING_SHOWN:
1979
+ import SCons.Warnings # pylint: disable=import-outside-toplevel
1980
+
1981
+ SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
1982
+ "Function %s is deprecated" % function_name)
1983
+ _MD5_WARNING_SHOWN = True
1984
+
1985
+
1986
+ def MD5signature(s):
1987
+ """Deprecated. Use :func:`hash_signature` instead."""
1988
+
1989
+ _show_md5_warning("MD5signature")
1990
+ return hash_signature(s)
1991
+
1992
+
1993
+ def MD5filesignature(fname, chunksize=65536):
1994
+ """Deprecated. Use :func:`hash_file_signature` instead."""
1995
+
1996
+ _show_md5_warning("MD5filesignature")
1997
+ return hash_file_signature(fname, chunksize)
1998
+
1999
+
2000
+ def MD5collect(signatures):
2001
+ """Deprecated. Use :func:`hash_collect` instead."""
2002
+
2003
+ _show_md5_warning("MD5collect")
2004
+ return hash_collect(signatures)
2005
+
2006
+
2007
+ def silent_intern(x):
2008
+ """
2009
+ Perform :mod:`sys.intern` on the passed argument and return the result.
2010
+ If the input is ineligible for interning the original argument is
2011
+ returned and no exception is thrown.
2012
+ """
2013
+ try:
2014
+ return sys.intern(x)
2015
+ except TypeError:
2016
+ return x
2017
+
2018
+
2019
+ # From Dinu C. Gherman,
2020
+ # Python Cookbook, second edition, recipe 6.17, p. 277.
2021
+ # Also: https://code.activestate.com/recipes/68205
2022
+ # ASPN: Python Cookbook: Null Object Design Pattern
2023
+
2024
+ class Null:
2025
+ """ Null objects always and reliably "do nothing." """
2026
+ def __new__(cls, *args, **kwargs):
2027
+ if '_instance' not in vars(cls):
2028
+ cls._instance = super(Null, cls).__new__(cls, *args, **kwargs)
2029
+ return cls._instance
2030
+ def __init__(self, *args, **kwargs):
2031
+ pass
2032
+ def __call__(self, *args, **kwargs):
2033
+ return self
2034
+ def __repr__(self):
2035
+ return "Null(0x%08X)" % id(self)
2036
+ def __bool__(self):
2037
+ return False
2038
+ def __getattr__(self, name):
2039
+ return self
2040
+ def __setattr__(self, name, value):
2041
+ return self
2042
+ def __delattr__(self, name):
2043
+ return self
2044
+
2045
+
2046
+ class NullSeq(Null):
2047
+ """ A Null object that can also be iterated over. """
2048
+ def __len__(self):
2049
+ return 0
2050
+ def __iter__(self):
2051
+ return iter(())
2052
+ def __getitem__(self, i):
2053
+ return self
2054
+ def __delitem__(self, i):
2055
+ return self
2056
+ def __setitem__(self, i, v):
2057
+ return self
2058
+
2059
+
2060
+ def to_bytes(s) -> bytes:
2061
+ if s is None:
2062
+ return b'None'
2063
+ if isinstance(s, (bytes, bytearray)):
2064
+ # if already bytes return.
2065
+ return s
2066
+ return bytes(s, 'utf-8')
2067
+
2068
+
2069
+ def to_str(s) -> str:
2070
+ if s is None:
2071
+ return 'None'
2072
+ if is_String(s):
2073
+ return s
2074
+ return str(s, 'utf-8')
2075
+
2076
+
2077
+ def cmp(a, b) -> bool:
2078
+ """A cmp function because one is no longer available in python3."""
2079
+ return (a > b) - (a < b)
2080
+
2081
+
2082
+ def get_env_bool(env, name, default=False) -> bool:
2083
+ """Convert a construction variable to bool.
2084
+
2085
+ If the value of `name` in `env` is 'true', 'yes', 'y', 'on' (case
2086
+ insensitive) or anything convertible to int that yields non-zero then
2087
+ return ``True``; if 'false', 'no', 'n', 'off' (case insensitive)
2088
+ or a number that converts to integer zero return ``False``.
2089
+ Otherwise, return `default`.
2090
+
2091
+ Args:
2092
+ env: construction environment, or any dict-like object
2093
+ name: name of the variable
2094
+ default: value to return if `name` not in `env` or cannot
2095
+ be converted (default: False)
2096
+
2097
+ Returns:
2098
+ the "truthiness" of `name`
2099
+ """
2100
+ try:
2101
+ var = env[name]
2102
+ except KeyError:
2103
+ return default
2104
+ try:
2105
+ return bool(int(var))
2106
+ except ValueError:
2107
+ if str(var).lower() in ('true', 'yes', 'y', 'on'):
2108
+ return True
2109
+
2110
+ if str(var).lower() in ('false', 'no', 'n', 'off'):
2111
+ return False
2112
+
2113
+ return default
2114
+
2115
+
2116
+ def get_os_env_bool(name, default=False) -> bool:
2117
+ """Convert an environment variable to bool.
2118
+
2119
+ Conversion is the same as for :func:`get_env_bool`.
2120
+ """
2121
+ return get_env_bool(os.environ, name, default)
2122
+
2123
+
2124
+ def print_time():
2125
+ """Hack to return a value from Main if can't import Main."""
2126
+ # pylint: disable=redefined-outer-name,import-outside-toplevel
2127
+ from SCons.Script.Main import print_time
2128
+ return print_time
2129
+
2130
+ # Local Variables:
2131
+ # tab-width:4
2132
+ # indent-tabs-mode:nil
2133
+ # End:
2134
+ # vim: set expandtab tabstop=4 shiftwidth=4: