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,2561 @@
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
+ """Base class for construction Environments.
25
+
26
+ These are the primary objects used to communicate dependency and
27
+ construction information to the build engine.
28
+
29
+ Keyword arguments supplied when the construction Environment is created
30
+ are construction variables used to initialize the Environment.
31
+ """
32
+
33
+ import copy
34
+ import os
35
+ import sys
36
+ import re
37
+ import shlex
38
+ from collections import UserDict
39
+
40
+ import SCons.Action
41
+ import SCons.Builder
42
+ import SCons.Debug
43
+ from SCons.Debug import logInstanceCreation
44
+ import SCons.Defaults
45
+ from SCons.Errors import UserError, BuildError
46
+ import SCons.Memoize
47
+ import SCons.Node
48
+ import SCons.Node.Alias
49
+ import SCons.Node.FS
50
+ import SCons.Node.Python
51
+ import SCons.Platform
52
+ import SCons.SConf
53
+ import SCons.SConsign
54
+ import SCons.Subst
55
+ import SCons.Tool
56
+ import SCons.Warnings
57
+ from SCons.Util import (
58
+ AppendPath,
59
+ CLVar,
60
+ LogicalLines,
61
+ MethodWrapper,
62
+ PrependPath,
63
+ Split,
64
+ WhereIs,
65
+ flatten,
66
+ is_Dict,
67
+ is_List,
68
+ is_Sequence,
69
+ is_String,
70
+ is_Tuple,
71
+ semi_deepcopy,
72
+ semi_deepcopy_dict,
73
+ to_String_for_subst,
74
+ uniquer_hashables,
75
+ )
76
+
77
+ class _Null:
78
+ pass
79
+
80
+ _null = _Null
81
+
82
+ _warn_copy_deprecated = True
83
+ _warn_source_signatures_deprecated = True
84
+ _warn_target_signatures_deprecated = True
85
+
86
+ CleanTargets = {}
87
+ CalculatorArgs = {}
88
+
89
+ def alias_builder(env, target, source):
90
+ pass
91
+
92
+ AliasBuilder = SCons.Builder.Builder(
93
+ action=alias_builder,
94
+ target_factory=SCons.Node.Alias.default_ans.Alias,
95
+ source_factory=SCons.Node.FS.Entry,
96
+ multi=True,
97
+ is_explicit=None,
98
+ name='AliasBuilder',
99
+ )
100
+
101
+ def apply_tools(env, tools, toolpath):
102
+ # Store the toolpath in the Environment.
103
+ # This is expected to work even if no tools are given, so do this first.
104
+ if toolpath is not None:
105
+ env['toolpath'] = toolpath
106
+ if not tools:
107
+ return
108
+
109
+ # Filter out null tools from the list.
110
+ for tool in [_f for _f in tools if _f]:
111
+ if is_List(tool) or is_Tuple(tool):
112
+ # toolargs should be a dict of kw args
113
+ toolname, toolargs, *rest = tool
114
+ _ = env.Tool(toolname, **toolargs)
115
+ else:
116
+ _ = env.Tool(tool)
117
+
118
+ # These names are (or will be) controlled by SCons; users should never
119
+ # set or override them. The warning can optionally be turned off,
120
+ # but scons will still ignore the illegal variable names even if it's off.
121
+ reserved_construction_var_names = [
122
+ 'CHANGED_SOURCES',
123
+ 'CHANGED_TARGETS',
124
+ 'SOURCE',
125
+ 'SOURCES',
126
+ 'TARGET',
127
+ 'TARGETS',
128
+ 'UNCHANGED_SOURCES',
129
+ 'UNCHANGED_TARGETS',
130
+ ]
131
+
132
+ future_reserved_construction_var_names = [
133
+ #'HOST_OS',
134
+ #'HOST_ARCH',
135
+ #'HOST_CPU',
136
+ ]
137
+
138
+ def copy_non_reserved_keywords(dict):
139
+ result = semi_deepcopy(dict)
140
+ for k in result.copy().keys():
141
+ if k in reserved_construction_var_names:
142
+ msg = "Ignoring attempt to set reserved variable `$%s'"
143
+ SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % k)
144
+ del result[k]
145
+ return result
146
+
147
+ def _set_reserved(env, key, value):
148
+ msg = "Ignoring attempt to set reserved variable `$%s'"
149
+ SCons.Warnings.warn(SCons.Warnings.ReservedVariableWarning, msg % key)
150
+
151
+ def _set_future_reserved(env, key, value):
152
+ env._dict[key] = value
153
+ msg = "`$%s' will be reserved in a future release and setting it will become ignored"
154
+ SCons.Warnings.warn(SCons.Warnings.FutureReservedVariableWarning, msg % key)
155
+
156
+ def _set_BUILDERS(env, key, value):
157
+ try:
158
+ bd = env._dict[key]
159
+ for k in bd.copy().keys():
160
+ del bd[k]
161
+ except KeyError:
162
+ bd = BuilderDict(bd, env)
163
+ env._dict[key] = bd
164
+ for k, v in value.items():
165
+ if not SCons.Builder.is_a_Builder(v):
166
+ raise UserError('%s is not a Builder.' % repr(v))
167
+ bd.update(value)
168
+
169
+ def _del_SCANNERS(env, key):
170
+ del env._dict[key]
171
+ env.scanner_map_delete()
172
+
173
+ def _set_SCANNERS(env, key, value):
174
+ env._dict[key] = value
175
+ env.scanner_map_delete()
176
+
177
+ def _delete_duplicates(l, keep_last):
178
+ """Delete duplicates from a sequence, keeping the first or last."""
179
+ seen=set()
180
+ result=[]
181
+ if keep_last: # reverse in & out, then keep first
182
+ l.reverse()
183
+ for i in l:
184
+ try:
185
+ if i not in seen:
186
+ result.append(i)
187
+ seen.add(i)
188
+ except TypeError:
189
+ # probably unhashable. Just keep it.
190
+ result.append(i)
191
+ if keep_last:
192
+ result.reverse()
193
+ return result
194
+
195
+
196
+
197
+ # The following is partly based on code in a comment added by Peter
198
+ # Shannon at the following page (there called the "transplant" class):
199
+ #
200
+ # ASPN : Python Cookbook : Dynamically added methods to a class
201
+ # https://code.activestate.com/recipes/81732/
202
+ #
203
+ # We had independently been using the idiom as BuilderWrapper, but
204
+ # factoring out the common parts into this base class, and making
205
+ # BuilderWrapper a subclass that overrides __call__() to enforce specific
206
+ # Builder calling conventions, simplified some of our higher-layer code.
207
+ #
208
+ # Note: MethodWrapper moved to SCons.Util as it was needed there
209
+ # and otherwise we had a circular import problem.
210
+
211
+ class BuilderWrapper(MethodWrapper):
212
+ """
213
+ A MethodWrapper subclass that that associates an environment with
214
+ a Builder.
215
+
216
+ This mainly exists to wrap the __call__() function so that all calls
217
+ to Builders can have their argument lists massaged in the same way
218
+ (treat a lone argument as the source, treat two arguments as target
219
+ then source, make sure both target and source are lists) without
220
+ having to have cut-and-paste code to do it.
221
+
222
+ As a bit of obsessive backwards compatibility, we also intercept
223
+ attempts to get or set the "env" or "builder" attributes, which were
224
+ the names we used before we put the common functionality into the
225
+ MethodWrapper base class. We'll keep this around for a while in case
226
+ people shipped Tool modules that reached into the wrapper (like the
227
+ Tool/qt.py module does, or did). There shouldn't be a lot attribute
228
+ fetching or setting on these, so a little extra work shouldn't hurt.
229
+ """
230
+ def __call__(self, target=None, source=_null, *args, **kw):
231
+ if source is _null:
232
+ source = target
233
+ target = None
234
+ if target is not None and not is_List(target):
235
+ target = [target]
236
+ if source is not None and not is_List(source):
237
+ source = [source]
238
+ return super().__call__(target, source, *args, **kw)
239
+
240
+ def __repr__(self):
241
+ return '<BuilderWrapper %s>' % repr(self.name)
242
+
243
+ def __str__(self):
244
+ return self.__repr__()
245
+
246
+ def __getattr__(self, name):
247
+ if name == 'env':
248
+ return self.object
249
+ elif name == 'builder':
250
+ return self.method
251
+ else:
252
+ raise AttributeError(name)
253
+
254
+ def __setattr__(self, name, value):
255
+ if name == 'env':
256
+ self.object = value
257
+ elif name == 'builder':
258
+ self.method = value
259
+ else:
260
+ self.__dict__[name] = value
261
+
262
+ # This allows a Builder to be executed directly
263
+ # through the Environment to which it's attached.
264
+ # In practice, we shouldn't need this, because
265
+ # builders actually get executed through a Node.
266
+ # But we do have a unit test for this, and can't
267
+ # yet rule out that it would be useful in the
268
+ # future, so leave it for now.
269
+ #def execute(self, **kw):
270
+ # kw['env'] = self.env
271
+ # self.builder.execute(**kw)
272
+
273
+ class BuilderDict(UserDict):
274
+ """This is a dictionary-like class used by an Environment to hold
275
+ the Builders. We need to do this because every time someone changes
276
+ the Builders in the Environment's BUILDERS dictionary, we must
277
+ update the Environment's attributes."""
278
+ def __init__(self, dict, env):
279
+ # Set self.env before calling the superclass initialization,
280
+ # because it will end up calling our other methods, which will
281
+ # need to point the values in this dictionary to self.env.
282
+ self.env = env
283
+ UserDict.__init__(self, dict)
284
+
285
+ def __semi_deepcopy__(self):
286
+ # These cannot be copied since they would both modify the same builder object, and indeed
287
+ # just copying would modify the original builder
288
+ raise TypeError( 'cannot semi_deepcopy a BuilderDict' )
289
+
290
+ def __setitem__(self, item, val):
291
+ try:
292
+ method = getattr(self.env, item).method
293
+ except AttributeError:
294
+ pass
295
+ else:
296
+ self.env.RemoveMethod(method)
297
+ UserDict.__setitem__(self, item, val)
298
+ BuilderWrapper(self.env, val, item)
299
+
300
+ def __delitem__(self, item):
301
+ UserDict.__delitem__(self, item)
302
+ delattr(self.env, item)
303
+
304
+ def update(self, dict):
305
+ for i, v in dict.items():
306
+ self.__setitem__(i, v)
307
+
308
+
309
+
310
+ _is_valid_var = re.compile(r'[_a-zA-Z]\w*$')
311
+
312
+ def is_valid_construction_var(varstr):
313
+ """Return if the specified string is a legitimate construction
314
+ variable.
315
+ """
316
+ return _is_valid_var.match(varstr)
317
+
318
+
319
+
320
+ class SubstitutionEnvironment:
321
+ """Base class for different flavors of construction environments.
322
+
323
+ This class contains a minimal set of methods that handle construction
324
+ variable expansion and conversion of strings to Nodes, which may or
325
+ may not be actually useful as a stand-alone class. Which methods
326
+ ended up in this class is pretty arbitrary right now. They're
327
+ basically the ones which we've empirically determined are common to
328
+ the different construction environment subclasses, and most of the
329
+ others that use or touch the underlying dictionary of construction
330
+ variables.
331
+
332
+ Eventually, this class should contain all the methods that we
333
+ determine are necessary for a "minimal" interface to the build engine.
334
+ A full "native Python" SCons environment has gotten pretty heavyweight
335
+ with all of the methods and Tools and construction variables we've
336
+ jammed in there, so it would be nice to have a lighter weight
337
+ alternative for interfaces that don't need all of the bells and
338
+ whistles. (At some point, we'll also probably rename this class
339
+ "Base," since that more reflects what we want this class to become,
340
+ but because we've released comments that tell people to subclass
341
+ Environment.Base to create their own flavors of construction
342
+ environment, we'll save that for a future refactoring when this
343
+ class actually becomes useful.)
344
+ """
345
+
346
+ def __init__(self, **kw):
347
+ """Initialization of an underlying SubstitutionEnvironment class.
348
+ """
349
+ if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.SubstitutionEnvironment')
350
+ self.fs = SCons.Node.FS.get_default_fs()
351
+ self.ans = SCons.Node.Alias.default_ans
352
+ self.lookup_list = SCons.Node.arg2nodes_lookups
353
+ self._dict = kw.copy()
354
+ self._init_special()
355
+ self.added_methods = []
356
+ #self._memo = {}
357
+
358
+ def _init_special(self):
359
+ """Initial the dispatch tables for special handling of
360
+ special construction variables."""
361
+ self._special_del = {}
362
+ self._special_del['SCANNERS'] = _del_SCANNERS
363
+
364
+ self._special_set = {}
365
+ for key in reserved_construction_var_names:
366
+ self._special_set[key] = _set_reserved
367
+ for key in future_reserved_construction_var_names:
368
+ self._special_set[key] = _set_future_reserved
369
+ self._special_set['BUILDERS'] = _set_BUILDERS
370
+ self._special_set['SCANNERS'] = _set_SCANNERS
371
+
372
+ # Freeze the keys of self._special_set in a list for use by
373
+ # methods that need to check.
374
+ self._special_set_keys = list(self._special_set.keys())
375
+
376
+ def __eq__(self, other):
377
+ return self._dict == other._dict
378
+
379
+ def __delitem__(self, key):
380
+ special = self._special_del.get(key)
381
+ if special:
382
+ special(self, key)
383
+ else:
384
+ del self._dict[key]
385
+
386
+ def __getitem__(self, key):
387
+ return self._dict[key]
388
+
389
+ def __setitem__(self, key, value):
390
+ # This is heavily used. This implementation is the best we have
391
+ # according to the timings in bench/env.__setitem__.py.
392
+ #
393
+ # The "key in self._special_set_keys" test here seems to perform
394
+ # pretty well for the number of keys we have. A hard-coded
395
+ # list worked a little better in Python 2.5, but that has the
396
+ # disadvantage of maybe getting out of sync if we ever add more
397
+ # variable names.
398
+ # So right now it seems like a good trade-off, but feel free to
399
+ # revisit this with bench/env.__setitem__.py as needed (and
400
+ # as newer versions of Python come out).
401
+ if key in self._special_set_keys:
402
+ self._special_set[key](self, key, value)
403
+ else:
404
+ # If we already have the entry, then it's obviously a valid
405
+ # key and we don't need to check. If we do check, using a
406
+ # global, pre-compiled regular expression directly is more
407
+ # efficient than calling another function or a method.
408
+ if key not in self._dict and not _is_valid_var.match(key):
409
+ raise UserError("Illegal construction variable `%s'" % key)
410
+ self._dict[key] = value
411
+
412
+ def get(self, key, default=None):
413
+ """Emulates the get() method of dictionaries."""
414
+ return self._dict.get(key, default)
415
+
416
+ def __contains__(self, key):
417
+ return key in self._dict
418
+
419
+ def keys(self):
420
+ """Emulates the keys() method of dictionaries."""
421
+ return self._dict.keys()
422
+
423
+ def values(self):
424
+ """Emulates the values() method of dictionaries."""
425
+ return self._dict.values()
426
+
427
+ def items(self):
428
+ """Emulates the items() method of dictionaries."""
429
+ return self._dict.items()
430
+
431
+ def setdefault(self, key, default=None):
432
+ """Emulates the setdefault() method of dictionaries."""
433
+ return self._dict.setdefault(key, default)
434
+
435
+ def arg2nodes(self, args, node_factory=_null, lookup_list=_null, **kw):
436
+ if node_factory is _null:
437
+ node_factory = self.fs.File
438
+ if lookup_list is _null:
439
+ lookup_list = self.lookup_list
440
+
441
+ if not args:
442
+ return []
443
+
444
+ args = flatten(args)
445
+
446
+ nodes = []
447
+ for v in args:
448
+ if is_String(v):
449
+ n = None
450
+ for l in lookup_list:
451
+ n = l(v)
452
+ if n is not None:
453
+ break
454
+ if n is not None:
455
+ if is_String(n):
456
+ # n = self.subst(n, raw=1, **kw)
457
+ kw['raw'] = 1
458
+ n = self.subst(n, **kw)
459
+ if node_factory:
460
+ n = node_factory(n)
461
+ if is_List(n):
462
+ nodes.extend(n)
463
+ else:
464
+ nodes.append(n)
465
+ elif node_factory:
466
+ # v = node_factory(self.subst(v, raw=1, **kw))
467
+ kw['raw'] = 1
468
+ v = node_factory(self.subst(v, **kw))
469
+ if is_List(v):
470
+ nodes.extend(v)
471
+ else:
472
+ nodes.append(v)
473
+ else:
474
+ nodes.append(v)
475
+
476
+ return nodes
477
+
478
+ def gvars(self):
479
+ return self._dict
480
+
481
+ def lvars(self):
482
+ return {}
483
+
484
+ def subst(self, string, raw=0, target=None, source=None, conv=None, executor=None):
485
+ """Recursively interpolates construction variables from the
486
+ Environment into the specified string, returning the expanded
487
+ result. Construction variables are specified by a $ prefix
488
+ in the string and begin with an initial underscore or
489
+ alphabetic character followed by any number of underscores
490
+ or alphanumeric characters. The construction variable names
491
+ may be surrounded by curly braces to separate the name from
492
+ trailing characters.
493
+ """
494
+ gvars = self.gvars()
495
+ lvars = self.lvars()
496
+ lvars['__env__'] = self
497
+ if executor:
498
+ lvars.update(executor.get_lvars())
499
+ return SCons.Subst.scons_subst(string, self, raw, target, source, gvars, lvars, conv)
500
+
501
+ def subst_kw(self, kw, raw=0, target=None, source=None):
502
+ nkw = {}
503
+ for k, v in kw.items():
504
+ k = self.subst(k, raw, target, source)
505
+ if is_String(v):
506
+ v = self.subst(v, raw, target, source)
507
+ nkw[k] = v
508
+ return nkw
509
+
510
+ def subst_list(self, string, raw=0, target=None, source=None, conv=None, executor=None):
511
+ """Calls through to SCons.Subst.scons_subst_list(). See
512
+ the documentation for that function."""
513
+ gvars = self.gvars()
514
+ lvars = self.lvars()
515
+ lvars['__env__'] = self
516
+ if executor:
517
+ lvars.update(executor.get_lvars())
518
+ return SCons.Subst.scons_subst_list(string, self, raw, target, source, gvars, lvars, conv)
519
+
520
+ def subst_path(self, path, target=None, source=None):
521
+ """Substitute a path list, turning EntryProxies into Nodes
522
+ and leaving Nodes (and other objects) as-is."""
523
+
524
+ if not is_List(path):
525
+ path = [path]
526
+
527
+ def s(obj):
528
+ """This is the "string conversion" routine that we have our
529
+ substitutions use to return Nodes, not strings. This relies
530
+ on the fact that an EntryProxy object has a get() method that
531
+ returns the underlying Node that it wraps, which is a bit of
532
+ architectural dependence that we might need to break or modify
533
+ in the future in response to additional requirements."""
534
+ try:
535
+ get = obj.get
536
+ except AttributeError:
537
+ obj = to_String_for_subst(obj)
538
+ else:
539
+ obj = get()
540
+ return obj
541
+
542
+ r = []
543
+ for p in path:
544
+ if is_String(p):
545
+ p = self.subst(p, target=target, source=source, conv=s)
546
+ if is_List(p):
547
+ if len(p) == 1:
548
+ p = p[0]
549
+ else:
550
+ # We have an object plus a string, or multiple
551
+ # objects that we need to smush together. No choice
552
+ # but to make them into a string.
553
+ p = ''.join(map(to_String_for_subst, p))
554
+ else:
555
+ p = s(p)
556
+ r.append(p)
557
+ return r
558
+
559
+ subst_target_source = subst
560
+
561
+ def backtick(self, command):
562
+ import subprocess
563
+ # common arguments
564
+ kw = { 'stdin' : 'devnull',
565
+ 'stdout' : subprocess.PIPE,
566
+ 'stderr' : subprocess.PIPE,
567
+ 'universal_newlines' : True,
568
+ }
569
+ # if the command is a list, assume it's been quoted
570
+ # othewise force a shell
571
+ if not is_List(command): kw['shell'] = True
572
+ # run constructed command
573
+ p = SCons.Action._subproc(self, command, **kw)
574
+ out,err = p.communicate()
575
+ status = p.wait()
576
+ if err:
577
+ sys.stderr.write("" + err)
578
+ if status:
579
+ raise OSError("'%s' exited %d" % (command, status))
580
+ return out
581
+
582
+ def AddMethod(self, function, name=None):
583
+ """
584
+ Adds the specified function as a method of this construction
585
+ environment with the specified name. If the name is omitted,
586
+ the default name is the name of the function itself.
587
+ """
588
+ method = MethodWrapper(self, function, name)
589
+ self.added_methods.append(method)
590
+
591
+ def RemoveMethod(self, function):
592
+ """
593
+ Removes the specified function's MethodWrapper from the
594
+ added_methods list, so we don't re-bind it when making a clone.
595
+ """
596
+ self.added_methods = [dm for dm in self.added_methods if dm.method is not function]
597
+
598
+ def Override(self, overrides):
599
+ """
600
+ Produce a modified environment whose variables are overridden by
601
+ the overrides dictionaries. "overrides" is a dictionary that
602
+ will override the variables of this environment.
603
+
604
+ This function is much more efficient than Clone() or creating
605
+ a new Environment because it doesn't copy the construction
606
+ environment dictionary, it just wraps the underlying construction
607
+ environment, and doesn't even create a wrapper object if there
608
+ are no overrides.
609
+ """
610
+ if not overrides: return self
611
+ o = copy_non_reserved_keywords(overrides)
612
+ if not o: return self
613
+ overrides = {}
614
+ merges = None
615
+ for key, value in o.items():
616
+ if key == 'parse_flags':
617
+ merges = value
618
+ else:
619
+ overrides[key] = SCons.Subst.scons_subst_once(value, self, key)
620
+ env = OverrideEnvironment(self, overrides)
621
+ if merges:
622
+ env.MergeFlags(merges)
623
+ return env
624
+
625
+ def ParseFlags(self, *flags):
626
+ """Return a dict of parsed flags.
627
+
628
+ Parse ``flags`` and return a dict with the flags distributed into
629
+ the appropriate construction variable names. The flags are treated
630
+ as a typical set of command-line flags for a GNU-like toolchain,
631
+ such as might have been generated by one of the {foo}-config scripts,
632
+ and used to populate the entries based on knowledge embedded in
633
+ this method - the choices are not expected to be portable to other
634
+ toolchains.
635
+
636
+ If one of the ``flags`` strings begins with a bang (exclamation mark),
637
+ it is assumed to be a command and the rest of the string is executed;
638
+ the result of that evaluation is then added to the dict.
639
+ """
640
+ dict = {
641
+ 'ASFLAGS' : CLVar(''),
642
+ 'CFLAGS' : CLVar(''),
643
+ 'CCFLAGS' : CLVar(''),
644
+ 'CXXFLAGS' : CLVar(''),
645
+ 'CPPDEFINES' : [],
646
+ 'CPPFLAGS' : CLVar(''),
647
+ 'CPPPATH' : [],
648
+ 'FRAMEWORKPATH' : CLVar(''),
649
+ 'FRAMEWORKS' : CLVar(''),
650
+ 'LIBPATH' : [],
651
+ 'LIBS' : [],
652
+ 'LINKFLAGS' : CLVar(''),
653
+ 'RPATH' : [],
654
+ }
655
+
656
+ def do_parse(arg):
657
+ # if arg is a sequence, recurse with each element
658
+ if not arg:
659
+ return
660
+
661
+ if not is_String(arg):
662
+ for t in arg: do_parse(t)
663
+ return
664
+
665
+ # if arg is a command, execute it
666
+ if arg[0] == '!':
667
+ arg = self.backtick(arg[1:])
668
+
669
+ # utility function to deal with -D option
670
+ def append_define(name, dict = dict):
671
+ t = name.split('=')
672
+ if len(t) == 1:
673
+ dict['CPPDEFINES'].append(name)
674
+ else:
675
+ dict['CPPDEFINES'].append([t[0], '='.join(t[1:])])
676
+
677
+ # Loop through the flags and add them to the appropriate option.
678
+ # This tries to strike a balance between checking for all possible
679
+ # flags and keeping the logic to a finite size, so it doesn't
680
+ # check for some that don't occur often. It particular, if the
681
+ # flag is not known to occur in a config script and there's a way
682
+ # of passing the flag to the right place (by wrapping it in a -W
683
+ # flag, for example) we don't check for it. Note that most
684
+ # preprocessor options are not handled, since unhandled options
685
+ # are placed in CCFLAGS, so unless the preprocessor is invoked
686
+ # separately, these flags will still get to the preprocessor.
687
+ # Other options not currently handled:
688
+ # -iqoutedir (preprocessor search path)
689
+ # -u symbol (linker undefined symbol)
690
+ # -s (linker strip files)
691
+ # -static* (linker static binding)
692
+ # -shared* (linker dynamic binding)
693
+ # -symbolic (linker global binding)
694
+ # -R dir (deprecated linker rpath)
695
+ # IBM compilers may also accept -qframeworkdir=foo
696
+
697
+ params = shlex.split(arg)
698
+ append_next_arg_to = None # for multi-word args
699
+ for arg in params:
700
+ if append_next_arg_to:
701
+ if append_next_arg_to == 'CPPDEFINES':
702
+ append_define(arg)
703
+ elif append_next_arg_to == '-include':
704
+ t = ('-include', self.fs.File(arg))
705
+ dict['CCFLAGS'].append(t)
706
+ elif append_next_arg_to == '-imacros':
707
+ t = ('-imacros', self.fs.File(arg))
708
+ dict['CCFLAGS'].append(t)
709
+ elif append_next_arg_to == '-isysroot':
710
+ t = ('-isysroot', arg)
711
+ dict['CCFLAGS'].append(t)
712
+ dict['LINKFLAGS'].append(t)
713
+ elif append_next_arg_to == '-isystem':
714
+ t = ('-isystem', arg)
715
+ dict['CCFLAGS'].append(t)
716
+ elif append_next_arg_to == '-iquote':
717
+ t = ('-iquote', arg)
718
+ dict['CCFLAGS'].append(t)
719
+ elif append_next_arg_to == '-idirafter':
720
+ t = ('-idirafter', arg)
721
+ dict['CCFLAGS'].append(t)
722
+ elif append_next_arg_to == '-arch':
723
+ t = ('-arch', arg)
724
+ dict['CCFLAGS'].append(t)
725
+ dict['LINKFLAGS'].append(t)
726
+ elif append_next_arg_to == '--param':
727
+ t = ('--param', arg)
728
+ dict['CCFLAGS'].append(t)
729
+ else:
730
+ dict[append_next_arg_to].append(arg)
731
+ append_next_arg_to = None
732
+ elif not arg[0] in ['-', '+']:
733
+ dict['LIBS'].append(self.fs.File(arg))
734
+ elif arg == '-dylib_file':
735
+ dict['LINKFLAGS'].append(arg)
736
+ append_next_arg_to = 'LINKFLAGS'
737
+ elif arg[:2] == '-L':
738
+ if arg[2:]:
739
+ dict['LIBPATH'].append(arg[2:])
740
+ else:
741
+ append_next_arg_to = 'LIBPATH'
742
+ elif arg[:2] == '-l':
743
+ if arg[2:]:
744
+ dict['LIBS'].append(arg[2:])
745
+ else:
746
+ append_next_arg_to = 'LIBS'
747
+ elif arg[:2] == '-I':
748
+ if arg[2:]:
749
+ dict['CPPPATH'].append(arg[2:])
750
+ else:
751
+ append_next_arg_to = 'CPPPATH'
752
+ elif arg[:4] == '-Wa,':
753
+ dict['ASFLAGS'].append(arg[4:])
754
+ dict['CCFLAGS'].append(arg)
755
+ elif arg[:4] == '-Wl,':
756
+ if arg[:11] == '-Wl,-rpath=':
757
+ dict['RPATH'].append(arg[11:])
758
+ elif arg[:7] == '-Wl,-R,':
759
+ dict['RPATH'].append(arg[7:])
760
+ elif arg[:6] == '-Wl,-R':
761
+ dict['RPATH'].append(arg[6:])
762
+ else:
763
+ dict['LINKFLAGS'].append(arg)
764
+ elif arg[:4] == '-Wp,':
765
+ dict['CPPFLAGS'].append(arg)
766
+ elif arg[:2] == '-D':
767
+ if arg[2:]:
768
+ append_define(arg[2:])
769
+ else:
770
+ append_next_arg_to = 'CPPDEFINES'
771
+ elif arg == '-framework':
772
+ append_next_arg_to = 'FRAMEWORKS'
773
+ elif arg[:14] == '-frameworkdir=':
774
+ dict['FRAMEWORKPATH'].append(arg[14:])
775
+ elif arg[:2] == '-F':
776
+ if arg[2:]:
777
+ dict['FRAMEWORKPATH'].append(arg[2:])
778
+ else:
779
+ append_next_arg_to = 'FRAMEWORKPATH'
780
+ elif arg in [
781
+ '-mno-cygwin',
782
+ '-pthread',
783
+ '-openmp',
784
+ '-fmerge-all-constants',
785
+ '-fopenmp',
786
+ ]:
787
+ dict['CCFLAGS'].append(arg)
788
+ dict['LINKFLAGS'].append(arg)
789
+ elif arg == '-mwindows':
790
+ dict['LINKFLAGS'].append(arg)
791
+ elif arg[:5] == '-std=':
792
+ if '++' in arg[5:]:
793
+ key='CXXFLAGS'
794
+ else:
795
+ key='CFLAGS'
796
+ dict[key].append(arg)
797
+ elif arg[0] == '+':
798
+ dict['CCFLAGS'].append(arg)
799
+ dict['LINKFLAGS'].append(arg)
800
+ elif arg in [
801
+ '-include',
802
+ '-imacros',
803
+ '-isysroot',
804
+ '-isystem',
805
+ '-iquote',
806
+ '-idirafter',
807
+ '-arch',
808
+ '--param',
809
+ ]:
810
+ append_next_arg_to = arg
811
+ else:
812
+ dict['CCFLAGS'].append(arg)
813
+
814
+ for arg in flags:
815
+ do_parse(arg)
816
+ return dict
817
+
818
+ def MergeFlags(self, args, unique=True):
819
+ """Merge flags into construction variables.
820
+
821
+ Merges the flags from ``args`` into this construction environent.
822
+ If ``args`` is not a dict, it is first converted to a dictionary with
823
+ flags distributed into appropriate construction variables.
824
+ See :meth:`ParseFlags`.
825
+
826
+ Args:
827
+ args: flags to merge
828
+ unique: merge flags rather than appending (default: True)
829
+
830
+ """
831
+ if not is_Dict(args):
832
+ args = self.ParseFlags(args)
833
+
834
+ if not unique:
835
+ self.Append(**args)
836
+ return
837
+
838
+ for key, value in args.items():
839
+ if not value:
840
+ continue
841
+ value = Split(value)
842
+ try:
843
+ orig = self[key]
844
+ except KeyError:
845
+ orig = value
846
+ else:
847
+ if not orig:
848
+ orig = value
849
+ elif value:
850
+ # Add orig and value. The logic here was lifted from
851
+ # part of env.Append() (see there for a lot of comments
852
+ # about the order in which things are tried) and is
853
+ # used mainly to handle coercion of strings to CLVar to
854
+ # "do the right thing" given (e.g.) an original CCFLAGS
855
+ # string variable like '-pipe -Wall'.
856
+ try:
857
+ orig = orig + value
858
+ except (KeyError, TypeError):
859
+ try:
860
+ add_to_orig = orig.append
861
+ except AttributeError:
862
+ value.insert(0, orig)
863
+ orig = value
864
+ else:
865
+ add_to_orig(value)
866
+ t = []
867
+ if key[-4:] == 'PATH':
868
+ ### keep left-most occurence
869
+ for v in orig:
870
+ if v not in t:
871
+ t.append(v)
872
+ else:
873
+ ### keep right-most occurence
874
+ for v in orig[::-1]:
875
+ if v not in t:
876
+ t.insert(0, v)
877
+ self[key] = t
878
+
879
+
880
+ def default_decide_source(dependency, target, prev_ni, repo_node=None):
881
+ f = SCons.Defaults.DefaultEnvironment().decide_source
882
+ return f(dependency, target, prev_ni, repo_node)
883
+
884
+
885
+ def default_decide_target(dependency, target, prev_ni, repo_node=None):
886
+ f = SCons.Defaults.DefaultEnvironment().decide_target
887
+ return f(dependency, target, prev_ni, repo_node)
888
+
889
+
890
+ def default_copy_from_cache(env, src, dst):
891
+ return SCons.CacheDir.CacheDir.copy_from_cache(env, src, dst)
892
+
893
+
894
+ def default_copy_to_cache(env, src, dst):
895
+ return SCons.CacheDir.CacheDir.copy_to_cache(env, src, dst)
896
+
897
+
898
+ class Base(SubstitutionEnvironment):
899
+ """Base class for "real" construction Environments.
900
+
901
+ These are the primary objects used to communicate dependency
902
+ and construction information to the build engine.
903
+
904
+ Keyword arguments supplied when the construction Environment
905
+ is created are construction variables used to initialize the
906
+ Environment.
907
+ """
908
+
909
+ #######################################################################
910
+ # This is THE class for interacting with the SCons build engine,
911
+ # and it contains a lot of stuff, so we're going to try to keep this
912
+ # a little organized by grouping the methods.
913
+ #######################################################################
914
+
915
+ #######################################################################
916
+ # Methods that make an Environment act like a dictionary. These have
917
+ # the expected standard names for Python mapping objects. Note that
918
+ # we don't actually make an Environment a subclass of UserDict for
919
+ # performance reasons. Note also that we only supply methods for
920
+ # dictionary functionality that we actually need and use.
921
+ #######################################################################
922
+
923
+ def __init__(
924
+ self,
925
+ platform=None,
926
+ tools=None,
927
+ toolpath=None,
928
+ variables=None,
929
+ parse_flags=None,
930
+ **kw
931
+ ):
932
+ """Initialization of a basic SCons construction environment.
933
+
934
+ Sets up special construction variables like BUILDER,
935
+ PLATFORM, etc., and searches for and applies available Tools.
936
+
937
+ Note that we do *not* call the underlying base class
938
+ (SubsitutionEnvironment) initialization, because we need to
939
+ initialize things in a very specific order that doesn't work
940
+ with the much simpler base class initialization.
941
+ """
942
+ if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.Base')
943
+ self._memo = {}
944
+ self.fs = SCons.Node.FS.get_default_fs()
945
+ self.ans = SCons.Node.Alias.default_ans
946
+ self.lookup_list = SCons.Node.arg2nodes_lookups
947
+ self._dict = semi_deepcopy(SCons.Defaults.ConstructionEnvironment)
948
+ self._init_special()
949
+ self.added_methods = []
950
+
951
+ # We don't use AddMethod, or define these as methods in this
952
+ # class, because we *don't* want these functions to be bound
953
+ # methods. They need to operate independently so that the
954
+ # settings will work properly regardless of whether a given
955
+ # target ends up being built with a Base environment or an
956
+ # OverrideEnvironment or what have you.
957
+ self.decide_target = default_decide_target
958
+ self.decide_source = default_decide_source
959
+
960
+ self.cache_timestamp_newer = False
961
+
962
+ self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self)
963
+
964
+ if platform is None:
965
+ platform = self._dict.get('PLATFORM', None)
966
+ if platform is None:
967
+ platform = SCons.Platform.Platform()
968
+ if is_String(platform):
969
+ platform = SCons.Platform.Platform(platform)
970
+ self._dict['PLATFORM'] = str(platform)
971
+ platform(self)
972
+
973
+ # these should be set by the platform, backstop just in case
974
+ self._dict['HOST_OS'] = self._dict.get('HOST_OS', None)
975
+ self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH', None)
976
+
977
+ # these are not currently set by the platform, give them a default
978
+ self._dict['TARGET_OS'] = self._dict.get('TARGET_OS', None)
979
+ self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH', None)
980
+
981
+ # Apply the passed-in and customizable variables to the
982
+ # environment before calling the tools, because they may use
983
+ # some of them during initialization.
984
+ if 'options' in kw:
985
+ # Backwards compatibility: they may stll be using the
986
+ # old "options" keyword.
987
+ variables = kw['options']
988
+ del kw['options']
989
+ self.Replace(**kw)
990
+ keys = list(kw.keys())
991
+ if variables:
992
+ keys = keys + list(variables.keys())
993
+ variables.Update(self)
994
+
995
+ save = {}
996
+ for k in keys:
997
+ try:
998
+ save[k] = self._dict[k]
999
+ except KeyError:
1000
+ # No value may have been set if they tried to pass in a
1001
+ # reserved variable name like TARGETS.
1002
+ pass
1003
+
1004
+ SCons.Tool.Initializers(self)
1005
+
1006
+ if tools is None:
1007
+ tools = self._dict.get('TOOLS', None)
1008
+ if tools is None:
1009
+ tools = ['default']
1010
+ apply_tools(self, tools, toolpath)
1011
+
1012
+ # Now restore the passed-in and customized variables
1013
+ # to the environment, since the values the user set explicitly
1014
+ # should override any values set by the tools.
1015
+ for key, val in save.items():
1016
+ self._dict[key] = val
1017
+
1018
+ # Finally, apply any flags to be merged in
1019
+ if parse_flags:
1020
+ self.MergeFlags(parse_flags)
1021
+
1022
+ #######################################################################
1023
+ # Utility methods that are primarily for internal use by SCons.
1024
+ # These begin with lower-case letters.
1025
+ #######################################################################
1026
+
1027
+ def get_builder(self, name):
1028
+ """Fetch the builder with the specified name from the environment.
1029
+ """
1030
+ try:
1031
+ return self._dict['BUILDERS'][name]
1032
+ except KeyError:
1033
+ return None
1034
+
1035
+ def validate_CacheDir_class(self, custom_class=None):
1036
+ """Validate the passed custom CacheDir class, or if no args are passed,
1037
+ validate the custom CacheDir class from the environment.
1038
+ """
1039
+
1040
+ if custom_class is None:
1041
+ custom_class = self.get("CACHEDIR_CLASS", SCons.CacheDir.CacheDir)
1042
+ if not issubclass(custom_class, SCons.CacheDir.CacheDir):
1043
+ raise UserError("Custom CACHEDIR_CLASS %s not derived from CacheDir" % str(custom_class))
1044
+ return custom_class
1045
+
1046
+ def get_CacheDir(self):
1047
+ try:
1048
+ path = self._CacheDir_path
1049
+ except AttributeError:
1050
+ path = SCons.Defaults.DefaultEnvironment()._CacheDir_path
1051
+
1052
+ cachedir_class = self.validate_CacheDir_class()
1053
+ try:
1054
+ if (path == self._last_CacheDir_path
1055
+ # this checks if the cachedir class type has changed from what the
1056
+ # instantiated cache dir type is. If the are exactly the same we
1057
+ # can just keep using the existing one, otherwise the user is requesting
1058
+ # something new, so we will re-instantiate below.
1059
+ and type(self._last_CacheDir) is cachedir_class):
1060
+ return self._last_CacheDir
1061
+ except AttributeError:
1062
+ pass
1063
+
1064
+ cd = cachedir_class(path)
1065
+ self._last_CacheDir_path = path
1066
+ self._last_CacheDir = cd
1067
+ return cd
1068
+
1069
+ def get_factory(self, factory, default='File'):
1070
+ """Return a factory function for creating Nodes for this
1071
+ construction environment.
1072
+ """
1073
+ name = default
1074
+ try:
1075
+ is_node = issubclass(factory, SCons.Node.FS.Base)
1076
+ except TypeError:
1077
+ # The specified factory isn't a Node itself--it's
1078
+ # most likely None, or possibly a callable.
1079
+ pass
1080
+ else:
1081
+ if is_node:
1082
+ # The specified factory is a Node (sub)class. Try to
1083
+ # return the FS method that corresponds to the Node's
1084
+ # name--that is, we return self.fs.Dir if they want a Dir,
1085
+ # self.fs.File for a File, etc.
1086
+ try: name = factory.__name__
1087
+ except AttributeError: pass
1088
+ else: factory = None
1089
+ if not factory:
1090
+ # They passed us None, or we picked up a name from a specified
1091
+ # class, so return the FS method. (Note that we *don't*
1092
+ # use our own self.{Dir,File} methods because that would
1093
+ # cause env.subst() to be called twice on the file name,
1094
+ # interfering with files that have $$ in them.)
1095
+ factory = getattr(self.fs, name)
1096
+ return factory
1097
+
1098
+ @SCons.Memoize.CountMethodCall
1099
+ def _gsm(self):
1100
+ try:
1101
+ return self._memo['_gsm']
1102
+ except KeyError:
1103
+ pass
1104
+
1105
+ result = {}
1106
+
1107
+ try:
1108
+ scanners = self._dict['SCANNERS']
1109
+ except KeyError:
1110
+ pass
1111
+ else:
1112
+ # Reverse the scanner list so that, if multiple scanners
1113
+ # claim they can scan the same suffix, earlier scanners
1114
+ # in the list will overwrite later scanners, so that
1115
+ # the result looks like a "first match" to the user.
1116
+ if not is_List(scanners):
1117
+ scanners = [scanners]
1118
+ else:
1119
+ scanners = scanners[:] # copy so reverse() doesn't mod original
1120
+ scanners.reverse()
1121
+ for scanner in scanners:
1122
+ for k in scanner.get_skeys(self):
1123
+ if k and self['PLATFORM'] == 'win32':
1124
+ k = k.lower()
1125
+ result[k] = scanner
1126
+
1127
+ self._memo['_gsm'] = result
1128
+
1129
+ return result
1130
+
1131
+ def get_scanner(self, skey):
1132
+ """Find the appropriate scanner given a key (usually a file suffix).
1133
+ """
1134
+ if skey and self['PLATFORM'] == 'win32':
1135
+ skey = skey.lower()
1136
+ return self._gsm().get(skey)
1137
+
1138
+ def scanner_map_delete(self, kw=None):
1139
+ """Delete the cached scanner map (if we need to).
1140
+ """
1141
+ try:
1142
+ del self._memo['_gsm']
1143
+ except KeyError:
1144
+ pass
1145
+
1146
+ def _update(self, other):
1147
+ """Private method to update an environment's consvar dict directly.
1148
+
1149
+ Bypasses the normal checks that occur when users try to set items.
1150
+ """
1151
+ self._dict.update(other)
1152
+
1153
+ def _update_onlynew(self, other):
1154
+ """Private method to add new items to an environment's consvar dict.
1155
+
1156
+ Only adds items from `other` whose keys do not already appear in
1157
+ the existing dict; values from `other` are not used for replacement.
1158
+ Bypasses the normal checks that occur when users try to set items.
1159
+ """
1160
+ for k, v in other.items():
1161
+ if k not in self._dict:
1162
+ self._dict[k] = v
1163
+
1164
+
1165
+ def get_src_sig_type(self):
1166
+ try:
1167
+ return self.src_sig_type
1168
+ except AttributeError:
1169
+ t = SCons.Defaults.DefaultEnvironment().src_sig_type
1170
+ self.src_sig_type = t
1171
+ return t
1172
+
1173
+ def get_tgt_sig_type(self):
1174
+ try:
1175
+ return self.tgt_sig_type
1176
+ except AttributeError:
1177
+ t = SCons.Defaults.DefaultEnvironment().tgt_sig_type
1178
+ self.tgt_sig_type = t
1179
+ return t
1180
+
1181
+ #######################################################################
1182
+ # Public methods for manipulating an Environment. These begin with
1183
+ # upper-case letters. The essential characteristic of methods in
1184
+ # this section is that they do *not* have corresponding same-named
1185
+ # global functions. For example, a stand-alone Append() function
1186
+ # makes no sense, because Append() is all about appending values to
1187
+ # an Environment's construction variables.
1188
+ #######################################################################
1189
+
1190
+ def Append(self, **kw):
1191
+ """Append values to construction variables in an Environment.
1192
+
1193
+ The variable is created if it is not already present.
1194
+ """
1195
+
1196
+ kw = copy_non_reserved_keywords(kw)
1197
+ for key, val in kw.items():
1198
+ try:
1199
+ if key == 'CPPDEFINES' and is_String(self._dict[key]):
1200
+ self._dict[key] = [self._dict[key]]
1201
+ orig = self._dict[key]
1202
+ except KeyError:
1203
+ # No existing var in the environment, so set to the new value.
1204
+ if key == 'CPPDEFINES' and is_String(val):
1205
+ self._dict[key] = [val]
1206
+ else:
1207
+ self._dict[key] = val
1208
+ continue
1209
+
1210
+ try:
1211
+ # Check if the original looks like a dict: has .update?
1212
+ update_dict = orig.update
1213
+ except AttributeError:
1214
+ try:
1215
+ # Just try to add them together. This will work
1216
+ # in most cases, when the original and new values
1217
+ # are compatible types.
1218
+ self._dict[key] = orig + val
1219
+ except (KeyError, TypeError):
1220
+ try:
1221
+ # Check if the original is a list: has .append?
1222
+ add_to_orig = orig.append
1223
+ except AttributeError:
1224
+ # The original isn't a list, but the new
1225
+ # value is (by process of elimination),
1226
+ # so insert the original in the new value
1227
+ # (if there's one to insert) and replace
1228
+ # the variable with it.
1229
+ if orig:
1230
+ val.insert(0, orig)
1231
+ self._dict[key] = val
1232
+ else:
1233
+ # The original is a list, so append the new
1234
+ # value to it (if there's a value to append).
1235
+ if val:
1236
+ add_to_orig(val)
1237
+ continue
1238
+
1239
+ # The original looks like a dictionary, so update it
1240
+ # based on what we think the value looks like.
1241
+ # We can't just try adding the value because
1242
+ # dictionaries don't have __add__() methods, and
1243
+ # things like UserList will incorrectly coerce the
1244
+ # original dict to a list (which we don't want).
1245
+ if is_List(val):
1246
+ if key == 'CPPDEFINES':
1247
+ tmp = []
1248
+ for (k, v) in orig.items():
1249
+ if v is not None:
1250
+ tmp.append((k, v))
1251
+ else:
1252
+ tmp.append((k,))
1253
+ orig = tmp
1254
+ orig += val
1255
+ self._dict[key] = orig
1256
+ else:
1257
+ for v in val:
1258
+ orig[v] = None
1259
+ else:
1260
+ try:
1261
+ update_dict(val)
1262
+ except (AttributeError, TypeError, ValueError):
1263
+ if is_Dict(val):
1264
+ for k, v in val.items():
1265
+ orig[k] = v
1266
+ else:
1267
+ orig[val] = None
1268
+
1269
+ self.scanner_map_delete(kw)
1270
+
1271
+ def _canonicalize(self, path):
1272
+ """Allow Dirs and strings beginning with # for top-relative.
1273
+
1274
+ Note this uses the current env's fs (in self).
1275
+ """
1276
+ if not is_String(path): # typically a Dir
1277
+ path = str(path)
1278
+ if path and path[0] == '#':
1279
+ path = str(self.fs.Dir(path))
1280
+ return path
1281
+
1282
+ def AppendENVPath(self, name, newpath, envname = 'ENV',
1283
+ sep = os.pathsep, delete_existing=0):
1284
+ """Append path elements to the path 'name' in the 'ENV'
1285
+ dictionary for this environment. Will only add any particular
1286
+ path once, and will normpath and normcase all paths to help
1287
+ assure this. This can also handle the case where the env
1288
+ variable is a list instead of a string.
1289
+
1290
+ If delete_existing is 0, a newpath which is already in the path
1291
+ will not be moved to the end (it will be left where it is).
1292
+ """
1293
+
1294
+ orig = ''
1295
+ if envname in self._dict and name in self._dict[envname]:
1296
+ orig = self._dict[envname][name]
1297
+
1298
+ nv = AppendPath(orig, newpath, sep, delete_existing, canonicalize=self._canonicalize)
1299
+
1300
+ if envname not in self._dict:
1301
+ self._dict[envname] = {}
1302
+
1303
+ self._dict[envname][name] = nv
1304
+
1305
+ def AppendUnique(self, delete_existing=0, **kw):
1306
+ """Append values to existing construction variables
1307
+ in an Environment, if they're not already there.
1308
+ If delete_existing is 1, removes existing values first, so
1309
+ values move to end.
1310
+ """
1311
+ kw = copy_non_reserved_keywords(kw)
1312
+ for key, val in kw.items():
1313
+ if is_List(val):
1314
+ val = _delete_duplicates(val, delete_existing)
1315
+ if key not in self._dict or self._dict[key] in ('', None):
1316
+ self._dict[key] = val
1317
+ elif is_Dict(self._dict[key]) and is_Dict(val):
1318
+ self._dict[key].update(val)
1319
+ elif is_List(val):
1320
+ dk = self._dict[key]
1321
+ if key == 'CPPDEFINES':
1322
+ tmp = []
1323
+ for i in val:
1324
+ if is_List(i):
1325
+ if len(i) >= 2:
1326
+ tmp.append((i[0], i[1]))
1327
+ else:
1328
+ tmp.append((i[0],))
1329
+ elif is_Tuple(i):
1330
+ tmp.append(i)
1331
+ else:
1332
+ tmp.append((i,))
1333
+ val = tmp
1334
+ # Construct a list of (key, value) tuples.
1335
+ if is_Dict(dk):
1336
+ tmp = []
1337
+ for (k, v) in dk.items():
1338
+ if v is not None:
1339
+ tmp.append((k, v))
1340
+ else:
1341
+ tmp.append((k,))
1342
+ dk = tmp
1343
+ elif is_String(dk):
1344
+ dk = [(dk,)]
1345
+ else:
1346
+ tmp = []
1347
+ for i in dk:
1348
+ if is_List(i):
1349
+ if len(i) >= 2:
1350
+ tmp.append((i[0], i[1]))
1351
+ else:
1352
+ tmp.append((i[0],))
1353
+ elif is_Tuple(i):
1354
+ tmp.append(i)
1355
+ else:
1356
+ tmp.append((i,))
1357
+ dk = tmp
1358
+ else:
1359
+ if not is_List(dk):
1360
+ dk = [dk]
1361
+ if delete_existing:
1362
+ dk = [x for x in dk if x not in val]
1363
+ else:
1364
+ val = [x for x in val if x not in dk]
1365
+ self._dict[key] = dk + val
1366
+ else:
1367
+ dk = self._dict[key]
1368
+ if is_List(dk):
1369
+ if key == 'CPPDEFINES':
1370
+ tmp = []
1371
+ for i in dk:
1372
+ if is_List(i):
1373
+ if len(i) >= 2:
1374
+ tmp.append((i[0], i[1]))
1375
+ else:
1376
+ tmp.append((i[0],))
1377
+ elif is_Tuple(i):
1378
+ tmp.append(i)
1379
+ else:
1380
+ tmp.append((i,))
1381
+ dk = tmp
1382
+ # Construct a list of (key, value) tuples.
1383
+ if is_Dict(val):
1384
+ tmp = []
1385
+ for (k, v) in val.items():
1386
+ if v is not None:
1387
+ tmp.append((k, v))
1388
+ else:
1389
+ tmp.append((k,))
1390
+ val = tmp
1391
+ elif is_String(val):
1392
+ val = [(val,)]
1393
+ if delete_existing:
1394
+ dk = list(filter(lambda x, val=val: x not in val, dk))
1395
+ self._dict[key] = dk + val
1396
+ else:
1397
+ dk = [x for x in dk if x not in val]
1398
+ self._dict[key] = dk + val
1399
+ else:
1400
+ # By elimination, val is not a list. Since dk is a
1401
+ # list, wrap val in a list first.
1402
+ if delete_existing:
1403
+ dk = list(filter(lambda x, val=val: x not in val, dk))
1404
+ self._dict[key] = dk + [val]
1405
+ else:
1406
+ if val not in dk:
1407
+ self._dict[key] = dk + [val]
1408
+ else:
1409
+ if key == 'CPPDEFINES':
1410
+ if is_String(dk):
1411
+ dk = [dk]
1412
+ elif is_Dict(dk):
1413
+ tmp = []
1414
+ for (k, v) in dk.items():
1415
+ if v is not None:
1416
+ tmp.append((k, v))
1417
+ else:
1418
+ tmp.append((k,))
1419
+ dk = tmp
1420
+ if is_String(val):
1421
+ if val in dk:
1422
+ val = []
1423
+ else:
1424
+ val = [val]
1425
+ elif is_Dict(val):
1426
+ tmp = []
1427
+ for i,j in val.items():
1428
+ if j is not None:
1429
+ tmp.append((i,j))
1430
+ else:
1431
+ tmp.append(i)
1432
+ val = tmp
1433
+ if delete_existing:
1434
+ dk = [x for x in dk if x not in val]
1435
+ self._dict[key] = dk + val
1436
+ self.scanner_map_delete(kw)
1437
+
1438
+ def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw):
1439
+ """Return a copy of a construction Environment.
1440
+
1441
+ The copy is like a Python "deep copy"--that is, independent
1442
+ copies are made recursively of each objects--except that
1443
+ a reference is copied when an object is not deep-copyable
1444
+ (like a function). There are no references to any mutable
1445
+ objects in the original Environment.
1446
+ """
1447
+
1448
+ builders = self._dict.get('BUILDERS', {})
1449
+
1450
+ clone = copy.copy(self)
1451
+ # BUILDERS is not safe to do a simple copy
1452
+ clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS'])
1453
+ clone._dict['BUILDERS'] = BuilderDict(builders, clone)
1454
+
1455
+ # Check the methods added via AddMethod() and re-bind them to
1456
+ # the cloned environment. Only do this if the attribute hasn't
1457
+ # been overwritten by the user explicitly and still points to
1458
+ # the added method.
1459
+ clone.added_methods = []
1460
+ for mw in self.added_methods:
1461
+ if mw == getattr(self, mw.name):
1462
+ clone.added_methods.append(mw.clone(clone))
1463
+
1464
+ clone._memo = {}
1465
+
1466
+ # Apply passed-in variables before the tools
1467
+ # so the tools can use the new variables
1468
+ kw = copy_non_reserved_keywords(kw)
1469
+ new = {}
1470
+ for key, value in kw.items():
1471
+ new[key] = SCons.Subst.scons_subst_once(value, self, key)
1472
+ clone.Replace(**new)
1473
+
1474
+ apply_tools(clone, tools, toolpath)
1475
+
1476
+ # apply them again in case the tools overwrote them
1477
+ clone.Replace(**new)
1478
+
1479
+ # Finally, apply any flags to be merged in
1480
+ if parse_flags:
1481
+ clone.MergeFlags(parse_flags)
1482
+
1483
+ if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.EnvironmentClone')
1484
+ return clone
1485
+
1486
+ def _changed_build(self, dependency, target, prev_ni, repo_node=None):
1487
+ if dependency.changed_state(target, prev_ni, repo_node):
1488
+ return 1
1489
+ return self.decide_source(dependency, target, prev_ni, repo_node)
1490
+
1491
+ def _changed_content(self, dependency, target, prev_ni, repo_node=None):
1492
+ return dependency.changed_content(target, prev_ni, repo_node)
1493
+
1494
+ def _changed_source(self, dependency, target, prev_ni, repo_node=None):
1495
+ target_env = dependency.get_build_env()
1496
+ type = target_env.get_tgt_sig_type()
1497
+ if type == 'source':
1498
+ return target_env.decide_source(dependency, target, prev_ni, repo_node)
1499
+ else:
1500
+ return target_env.decide_target(dependency, target, prev_ni, repo_node)
1501
+
1502
+ def _changed_timestamp_then_content(self, dependency, target, prev_ni, repo_node=None):
1503
+ return dependency.changed_timestamp_then_content(target, prev_ni, repo_node)
1504
+
1505
+ def _changed_timestamp_newer(self, dependency, target, prev_ni, repo_node=None):
1506
+ return dependency.changed_timestamp_newer(target, prev_ni, repo_node)
1507
+
1508
+ def _changed_timestamp_match(self, dependency, target, prev_ni, repo_node=None):
1509
+ return dependency.changed_timestamp_match(target, prev_ni, repo_node)
1510
+
1511
+ def Decider(self, function):
1512
+ self.cache_timestamp_newer = False
1513
+ if function in ('MD5', 'content'):
1514
+ # TODO: Handle if user requests MD5 and not content with deprecation notice
1515
+ function = self._changed_content
1516
+ elif function in ('MD5-timestamp', 'content-timestamp'):
1517
+ function = self._changed_timestamp_then_content
1518
+ elif function in ('timestamp-newer', 'make'):
1519
+ function = self._changed_timestamp_newer
1520
+ self.cache_timestamp_newer = True
1521
+ elif function == 'timestamp-match':
1522
+ function = self._changed_timestamp_match
1523
+ elif not callable(function):
1524
+ raise UserError("Unknown Decider value %s" % repr(function))
1525
+
1526
+ # We don't use AddMethod because we don't want to turn the
1527
+ # function, which only expects three arguments, into a bound
1528
+ # method, which would add self as an initial, fourth argument.
1529
+ self.decide_target = function
1530
+ self.decide_source = function
1531
+
1532
+
1533
+ def Detect(self, progs):
1534
+ """Return the first available program from one or more possibilities.
1535
+
1536
+ Args:
1537
+ progs (str or list): one or more command names to check for
1538
+
1539
+ """
1540
+ if not is_List(progs):
1541
+ progs = [progs]
1542
+ for prog in progs:
1543
+ path = self.WhereIs(prog)
1544
+ if path: return prog
1545
+ return None
1546
+
1547
+
1548
+ def Dictionary(self, *args):
1549
+ r"""Return construction variables from an environment.
1550
+
1551
+ Args:
1552
+ \*args (optional): variable names to look up
1553
+
1554
+ Returns:
1555
+ If `args` omitted, the dictionary of all construction variables.
1556
+ If one arg, the corresponding value is returned.
1557
+ If more than one arg, a list of values is returned.
1558
+
1559
+ Raises:
1560
+ KeyError: if any of `args` is not in the construction environment.
1561
+
1562
+ """
1563
+ if not args:
1564
+ return self._dict
1565
+ dlist = [self._dict[x] for x in args]
1566
+ if len(dlist) == 1:
1567
+ dlist = dlist[0]
1568
+ return dlist
1569
+
1570
+
1571
+ def Dump(self, key=None, format='pretty'):
1572
+ """ Return construction variables serialized to a string.
1573
+
1574
+ Args:
1575
+ key (optional): if None, format the whole dict of variables.
1576
+ Else format the value of `key` (Default value = None)
1577
+ format (str, optional): specify the format to serialize to.
1578
+ `"pretty"` generates a pretty-printed string,
1579
+ `"json"` a JSON-formatted string.
1580
+ (Default value = `"pretty"`)
1581
+
1582
+ """
1583
+ if key:
1584
+ cvars = self.Dictionary(key)
1585
+ else:
1586
+ cvars = self.Dictionary()
1587
+
1588
+ fmt = format.lower()
1589
+
1590
+ if fmt == 'pretty':
1591
+ import pprint
1592
+ pp = pprint.PrettyPrinter(indent=2)
1593
+
1594
+ # TODO: pprint doesn't do a nice job on path-style values
1595
+ # if the paths contain spaces (i.e. Windows), because the
1596
+ # algorithm tries to break lines on spaces, while breaking
1597
+ # on the path-separator would be more "natural". Is there
1598
+ # a better way to format those?
1599
+ return pp.pformat(cvars)
1600
+
1601
+ elif fmt == 'json':
1602
+ import json
1603
+ def non_serializable(obj):
1604
+ return str(type(obj).__qualname__)
1605
+ return json.dumps(cvars, indent=4, default=non_serializable)
1606
+ else:
1607
+ raise ValueError("Unsupported serialization format: %s." % fmt)
1608
+
1609
+
1610
+ def FindIxes(self, paths, prefix, suffix):
1611
+ """Search a list of paths for something that matches the prefix and suffix.
1612
+
1613
+ Args:
1614
+ paths: the list of paths or nodes.
1615
+ prefix: construction variable for the prefix.
1616
+ suffix: construction variable for the suffix.
1617
+
1618
+ Returns: the matched path or None
1619
+
1620
+ """
1621
+
1622
+ suffix = self.subst('$'+suffix)
1623
+ prefix = self.subst('$'+prefix)
1624
+
1625
+ for path in paths:
1626
+ name = os.path.basename(str(path))
1627
+ if name[:len(prefix)] == prefix and name[-len(suffix):] == suffix:
1628
+ return path
1629
+
1630
+ def ParseConfig(self, command, function=None, unique=True):
1631
+ """
1632
+ Use the specified function to parse the output of the command
1633
+ in order to modify the current environment. The 'command' can
1634
+ be a string or a list of strings representing a command and
1635
+ its arguments. 'Function' is an optional argument that takes
1636
+ the environment, the output of the command, and the unique flag.
1637
+ If no function is specified, MergeFlags, which treats the output
1638
+ as the result of a typical 'X-config' command (i.e. gtk-config),
1639
+ will merge the output into the appropriate variables.
1640
+ """
1641
+ if function is None:
1642
+ def parse_conf(env, cmd, unique=unique):
1643
+ return env.MergeFlags(cmd, unique)
1644
+ function = parse_conf
1645
+ if is_List(command):
1646
+ command = ' '.join(command)
1647
+ command = self.subst(command)
1648
+ return function(self, self.backtick(command))
1649
+
1650
+ def ParseDepends(self, filename, must_exist=None, only_one=False):
1651
+ """
1652
+ Parse a mkdep-style file for explicit dependencies. This is
1653
+ completely abusable, and should be unnecessary in the "normal"
1654
+ case of proper SCons configuration, but it may help make
1655
+ the transition from a Make hierarchy easier for some people
1656
+ to swallow. It can also be genuinely useful when using a tool
1657
+ that can write a .d file, but for which writing a scanner would
1658
+ be too complicated.
1659
+ """
1660
+ filename = self.subst(filename)
1661
+ try:
1662
+ with open(filename, 'r') as fp:
1663
+ lines = LogicalLines(fp).readlines()
1664
+ except IOError:
1665
+ if must_exist:
1666
+ raise
1667
+ return
1668
+ lines = [l for l in lines if l[0] != '#']
1669
+ tdlist = []
1670
+ for line in lines:
1671
+ try:
1672
+ target, depends = line.split(':', 1)
1673
+ except (AttributeError, ValueError):
1674
+ # Throws AttributeError if line isn't a string. Can throw
1675
+ # ValueError if line doesn't split into two or more elements.
1676
+ pass
1677
+ else:
1678
+ tdlist.append((target.split(), depends.split()))
1679
+ if only_one:
1680
+ targets = []
1681
+ for td in tdlist:
1682
+ targets.extend(td[0])
1683
+ if len(targets) > 1:
1684
+ raise UserError(
1685
+ "More than one dependency target found in `%s': %s"
1686
+ % (filename, targets))
1687
+ for target, depends in tdlist:
1688
+ self.Depends(target, depends)
1689
+
1690
+ def Platform(self, platform):
1691
+ platform = self.subst(platform)
1692
+ return SCons.Platform.Platform(platform)(self)
1693
+
1694
+ def Prepend(self, **kw):
1695
+ """Prepend values to construction variables in an Environment.
1696
+
1697
+ The variable is created if it is not already present.
1698
+ """
1699
+
1700
+ kw = copy_non_reserved_keywords(kw)
1701
+ for key, val in kw.items():
1702
+ try:
1703
+ orig = self._dict[key]
1704
+ except KeyError:
1705
+ # No existing var in the environment so set to the new value.
1706
+ self._dict[key] = val
1707
+ continue
1708
+
1709
+ try:
1710
+ # Check if the original looks like a dict: has .update?
1711
+ update_dict = orig.update
1712
+ except AttributeError:
1713
+ try:
1714
+ # Just try to add them together. This will work
1715
+ # in most cases, when the original and new values
1716
+ # are compatible types.
1717
+ self._dict[key] = val + orig
1718
+ except (KeyError, TypeError):
1719
+ try:
1720
+ # Check if the added value is a list: has .append?
1721
+ add_to_val = val.append
1722
+ except AttributeError:
1723
+ # The added value isn't a list, but the
1724
+ # original is (by process of elimination),
1725
+ # so insert the the new value in the original
1726
+ # (if there's one to insert).
1727
+ if val:
1728
+ orig.insert(0, val)
1729
+ else:
1730
+ # The added value is a list, so append
1731
+ # the original to it (if there's a value
1732
+ # to append) and replace the original.
1733
+ if orig:
1734
+ add_to_val(orig)
1735
+ self._dict[key] = val
1736
+ continue
1737
+
1738
+ # The original looks like a dictionary, so update it
1739
+ # based on what we think the value looks like.
1740
+ # We can't just try adding the value because
1741
+ # dictionaries don't have __add__() methods, and
1742
+ # things like UserList will incorrectly coerce the
1743
+ # original dict to a list (which we don't want).
1744
+ if is_List(val):
1745
+ for v in val:
1746
+ orig[v] = None
1747
+ else:
1748
+ try:
1749
+ update_dict(val)
1750
+ except (AttributeError, TypeError, ValueError):
1751
+ if is_Dict(val):
1752
+ for k, v in val.items():
1753
+ orig[k] = v
1754
+ else:
1755
+ orig[val] = None
1756
+
1757
+ self.scanner_map_delete(kw)
1758
+
1759
+ def PrependENVPath(self, name, newpath, envname = 'ENV', sep = os.pathsep,
1760
+ delete_existing=1):
1761
+ """Prepend path elements to the path 'name' in the 'ENV'
1762
+ dictionary for this environment. Will only add any particular
1763
+ path once, and will normpath and normcase all paths to help
1764
+ assure this. This can also handle the case where the env
1765
+ variable is a list instead of a string.
1766
+
1767
+ If delete_existing is 0, a newpath which is already in the path
1768
+ will not be moved to the front (it will be left where it is).
1769
+ """
1770
+
1771
+ orig = ''
1772
+ if envname in self._dict and name in self._dict[envname]:
1773
+ orig = self._dict[envname][name]
1774
+
1775
+ nv = PrependPath(orig, newpath, sep, delete_existing,
1776
+ canonicalize=self._canonicalize)
1777
+
1778
+ if envname not in self._dict:
1779
+ self._dict[envname] = {}
1780
+
1781
+ self._dict[envname][name] = nv
1782
+
1783
+ def PrependUnique(self, delete_existing=0, **kw):
1784
+ """Prepend values to existing construction variables
1785
+ in an Environment, if they're not already there.
1786
+ If delete_existing is 1, removes existing values first, so
1787
+ values move to front.
1788
+ """
1789
+ kw = copy_non_reserved_keywords(kw)
1790
+ for key, val in kw.items():
1791
+ if is_List(val):
1792
+ val = _delete_duplicates(val, not delete_existing)
1793
+ if key not in self._dict or self._dict[key] in ('', None):
1794
+ self._dict[key] = val
1795
+ elif is_Dict(self._dict[key]) and is_Dict(val):
1796
+ self._dict[key].update(val)
1797
+ elif is_List(val):
1798
+ dk = self._dict[key]
1799
+ if not is_List(dk):
1800
+ dk = [dk]
1801
+ if delete_existing:
1802
+ dk = [x for x in dk if x not in val]
1803
+ else:
1804
+ val = [x for x in val if x not in dk]
1805
+ self._dict[key] = val + dk
1806
+ else:
1807
+ dk = self._dict[key]
1808
+ if is_List(dk):
1809
+ # By elimination, val is not a list. Since dk is a
1810
+ # list, wrap val in a list first.
1811
+ if delete_existing:
1812
+ dk = [x for x in dk if x not in val]
1813
+ self._dict[key] = [val] + dk
1814
+ else:
1815
+ if val not in dk:
1816
+ self._dict[key] = [val] + dk
1817
+ else:
1818
+ if delete_existing:
1819
+ dk = [x for x in dk if x not in val]
1820
+ self._dict[key] = val + dk
1821
+ self.scanner_map_delete(kw)
1822
+
1823
+ def Replace(self, **kw):
1824
+ """Replace existing construction variables in an Environment
1825
+ with new construction variables and/or values.
1826
+ """
1827
+ try:
1828
+ kwbd = kw['BUILDERS']
1829
+ except KeyError:
1830
+ pass
1831
+ else:
1832
+ kwbd = BuilderDict(kwbd,self)
1833
+ del kw['BUILDERS']
1834
+ self.__setitem__('BUILDERS', kwbd)
1835
+ kw = copy_non_reserved_keywords(kw)
1836
+ self._update(semi_deepcopy(kw))
1837
+ self.scanner_map_delete(kw)
1838
+
1839
+ def ReplaceIxes(self, path, old_prefix, old_suffix, new_prefix, new_suffix):
1840
+ """
1841
+ Replace old_prefix with new_prefix and old_suffix with new_suffix.
1842
+
1843
+ env - Environment used to interpolate variables.
1844
+ path - the path that will be modified.
1845
+ old_prefix - construction variable for the old prefix.
1846
+ old_suffix - construction variable for the old suffix.
1847
+ new_prefix - construction variable for the new prefix.
1848
+ new_suffix - construction variable for the new suffix.
1849
+ """
1850
+ old_prefix = self.subst('$'+old_prefix)
1851
+ old_suffix = self.subst('$'+old_suffix)
1852
+
1853
+ new_prefix = self.subst('$'+new_prefix)
1854
+ new_suffix = self.subst('$'+new_suffix)
1855
+
1856
+ dir,name = os.path.split(str(path))
1857
+ if name[:len(old_prefix)] == old_prefix:
1858
+ name = name[len(old_prefix):]
1859
+ if name[-len(old_suffix):] == old_suffix:
1860
+ name = name[:-len(old_suffix)]
1861
+ return os.path.join(dir, new_prefix+name+new_suffix)
1862
+
1863
+ def SetDefault(self, **kw):
1864
+ for k in list(kw.keys()):
1865
+ if k in self._dict:
1866
+ del kw[k]
1867
+ self.Replace(**kw)
1868
+
1869
+ def _find_toolpath_dir(self, tp):
1870
+ return self.fs.Dir(self.subst(tp)).srcnode().get_abspath()
1871
+
1872
+ def Tool(self, tool, toolpath=None, **kwargs) -> SCons.Tool.Tool:
1873
+ if is_String(tool):
1874
+ tool = self.subst(tool)
1875
+ if toolpath is None:
1876
+ toolpath = self.get('toolpath', [])
1877
+ toolpath = list(map(self._find_toolpath_dir, toolpath))
1878
+ tool = SCons.Tool.Tool(tool, toolpath, **kwargs)
1879
+ tool(self)
1880
+ return tool
1881
+
1882
+ def WhereIs(self, prog, path=None, pathext=None, reject=None):
1883
+ """Find prog in the path. """
1884
+ if not prog: # nothing to search for, just give up
1885
+ return None
1886
+ if path is None:
1887
+ try:
1888
+ path = self['ENV']['PATH']
1889
+ except KeyError:
1890
+ pass
1891
+ elif is_String(path):
1892
+ path = self.subst(path)
1893
+ if pathext is None:
1894
+ try:
1895
+ pathext = self['ENV']['PATHEXT']
1896
+ except KeyError:
1897
+ pass
1898
+ elif is_String(pathext):
1899
+ pathext = self.subst(pathext)
1900
+ prog = CLVar(self.subst(prog)) # support "program --with-args"
1901
+ path = WhereIs(prog[0], path, pathext, reject)
1902
+ if path:
1903
+ return path
1904
+ return None
1905
+
1906
+ #######################################################################
1907
+ # Public methods for doing real "SCons stuff" (manipulating
1908
+ # dependencies, setting attributes on targets, etc.). These begin
1909
+ # with upper-case letters. The essential characteristic of methods
1910
+ # in this section is that they all *should* have corresponding
1911
+ # same-named global functions.
1912
+ #######################################################################
1913
+
1914
+ def Action(self, *args, **kw):
1915
+ def subst_string(a, self=self):
1916
+ if is_String(a):
1917
+ a = self.subst(a)
1918
+ return a
1919
+ nargs = list(map(subst_string, args))
1920
+ nkw = self.subst_kw(kw)
1921
+ return SCons.Action.Action(*nargs, **nkw)
1922
+
1923
+ def AddPreAction(self, files, action):
1924
+ nodes = self.arg2nodes(files, self.fs.Entry)
1925
+ action = SCons.Action.Action(action)
1926
+ uniq = {}
1927
+ for executor in [n.get_executor() for n in nodes]:
1928
+ uniq[executor] = 1
1929
+ for executor in uniq.keys():
1930
+ executor.add_pre_action(action)
1931
+ return nodes
1932
+
1933
+ def AddPostAction(self, files, action):
1934
+ nodes = self.arg2nodes(files, self.fs.Entry)
1935
+ action = SCons.Action.Action(action)
1936
+ uniq = {}
1937
+ for executor in [n.get_executor() for n in nodes]:
1938
+ uniq[executor] = 1
1939
+ for executor in uniq.keys():
1940
+ executor.add_post_action(action)
1941
+ return nodes
1942
+
1943
+ def Alias(self, target, source=[], action=None, **kw):
1944
+ tlist = self.arg2nodes(target, self.ans.Alias)
1945
+ if not is_List(source):
1946
+ source = [source]
1947
+ source = [_f for _f in source if _f]
1948
+
1949
+ if not action:
1950
+ if not source:
1951
+ # There are no source files and no action, so just
1952
+ # return a target list of classic Alias Nodes, without
1953
+ # any builder. The externally visible effect is that
1954
+ # this will make the wrapping Script.BuildTask class
1955
+ # say that there's "Nothing to be done" for this Alias,
1956
+ # instead of that it's "up to date."
1957
+ return tlist
1958
+
1959
+ # No action, but there are sources. Re-call all the target
1960
+ # builders to add the sources to each target.
1961
+ result = []
1962
+ for t in tlist:
1963
+ bld = t.get_builder(AliasBuilder)
1964
+ result.extend(bld(self, t, source))
1965
+ return result
1966
+
1967
+ nkw = self.subst_kw(kw)
1968
+ nkw.update({
1969
+ 'action' : SCons.Action.Action(action),
1970
+ 'source_factory' : self.fs.Entry,
1971
+ 'multi' : 1,
1972
+ 'is_explicit' : None,
1973
+ })
1974
+ bld = SCons.Builder.Builder(**nkw)
1975
+
1976
+ # Apply the Builder separately to each target so that the Aliases
1977
+ # stay separate. If we did one "normal" Builder call with the
1978
+ # whole target list, then all of the target Aliases would be
1979
+ # associated under a single Executor.
1980
+ result = []
1981
+ for t in tlist:
1982
+ # Calling the convert() method will cause a new Executor to be
1983
+ # created from scratch, so we have to explicitly initialize
1984
+ # it with the target's existing sources, plus our new ones,
1985
+ # so nothing gets lost.
1986
+ b = t.get_builder()
1987
+ if b is None or b is AliasBuilder:
1988
+ b = bld
1989
+ else:
1990
+ nkw['action'] = b.action + action
1991
+ b = SCons.Builder.Builder(**nkw)
1992
+ t.convert()
1993
+ result.extend(b(self, t, t.sources + source))
1994
+ return result
1995
+
1996
+ def AlwaysBuild(self, *targets):
1997
+ tlist = []
1998
+ for t in targets:
1999
+ tlist.extend(self.arg2nodes(t, self.fs.Entry))
2000
+ for t in tlist:
2001
+ t.set_always_build()
2002
+ return tlist
2003
+
2004
+ def Builder(self, **kw):
2005
+ nkw = self.subst_kw(kw)
2006
+ return SCons.Builder.Builder(**nkw)
2007
+
2008
+ def CacheDir(self, path, custom_class=None):
2009
+ if path is not None:
2010
+ path = self.subst(path)
2011
+ self._CacheDir_path = path
2012
+
2013
+ if custom_class:
2014
+ self['CACHEDIR_CLASS'] = self.validate_CacheDir_class(custom_class)
2015
+
2016
+ if SCons.Action.execute_actions:
2017
+ # Only initialize the CacheDir if -n/-no_exec was NOT specified.
2018
+ # Now initialized the CacheDir and prevent a race condition which can
2019
+ # happen when there's no existing cache dir and you are building with
2020
+ # multiple threads, but initializing it before the task walk starts
2021
+ self.get_CacheDir()
2022
+
2023
+ def Clean(self, targets, files):
2024
+ global CleanTargets
2025
+ tlist = self.arg2nodes(targets, self.fs.Entry)
2026
+ flist = self.arg2nodes(files, self.fs.Entry)
2027
+ for t in tlist:
2028
+ try:
2029
+ CleanTargets[t].extend(flist)
2030
+ except KeyError:
2031
+ CleanTargets[t] = flist
2032
+
2033
+ def Configure(self, *args, **kw):
2034
+ nargs = [self]
2035
+ if args:
2036
+ nargs = nargs + self.subst_list(args)[0]
2037
+ nkw = self.subst_kw(kw)
2038
+ nkw['_depth'] = kw.get('_depth', 0) + 1
2039
+ try:
2040
+ nkw['custom_tests'] = self.subst_kw(nkw['custom_tests'])
2041
+ except KeyError:
2042
+ pass
2043
+ return SCons.SConf.SConf(*nargs, **nkw)
2044
+
2045
+ def Command(self, target, source, action, **kw):
2046
+ """Builds the supplied target files from the supplied
2047
+ source files using the supplied action. Action may
2048
+ be any type that the Builder constructor will accept
2049
+ for an action."""
2050
+ bkw = {
2051
+ 'action': action,
2052
+ 'target_factory': self.fs.Entry,
2053
+ 'source_factory': self.fs.Entry,
2054
+ }
2055
+ # source scanner
2056
+ try:
2057
+ bkw['source_scanner'] = kw['source_scanner']
2058
+ except KeyError:
2059
+ pass
2060
+ else:
2061
+ del kw['source_scanner']
2062
+
2063
+ # target scanner
2064
+ try:
2065
+ bkw['target_scanner'] = kw['target_scanner']
2066
+ except KeyError:
2067
+ pass
2068
+ else:
2069
+ del kw['target_scanner']
2070
+
2071
+ # source factory
2072
+ try:
2073
+ bkw['source_factory'] = kw['source_factory']
2074
+ except KeyError:
2075
+ pass
2076
+ else:
2077
+ del kw['source_factory']
2078
+
2079
+ # target factory
2080
+ try:
2081
+ bkw['target_factory'] = kw['target_factory']
2082
+ except KeyError:
2083
+ pass
2084
+ else:
2085
+ del kw['target_factory']
2086
+
2087
+ bld = SCons.Builder.Builder(**bkw)
2088
+ return bld(self, target, source, **kw)
2089
+
2090
+ def Depends(self, target, dependency):
2091
+ """Explicity specify that 'target's depend on 'dependency'."""
2092
+ tlist = self.arg2nodes(target, self.fs.Entry)
2093
+ dlist = self.arg2nodes(dependency, self.fs.Entry)
2094
+ for t in tlist:
2095
+ t.add_dependency(dlist)
2096
+ return tlist
2097
+
2098
+ def Dir(self, name, *args, **kw):
2099
+ """
2100
+ """
2101
+ s = self.subst(name)
2102
+ if is_Sequence(s):
2103
+ result=[]
2104
+ for e in s:
2105
+ result.append(self.fs.Dir(e, *args, **kw))
2106
+ return result
2107
+ return self.fs.Dir(s, *args, **kw)
2108
+
2109
+ def PyPackageDir(self, modulename):
2110
+ s = self.subst(modulename)
2111
+ if is_Sequence(s):
2112
+ result=[]
2113
+ for e in s:
2114
+ result.append(self.fs.PyPackageDir(e))
2115
+ return result
2116
+ return self.fs.PyPackageDir(s)
2117
+
2118
+ def NoClean(self, *targets):
2119
+ """Tags a target so that it will not be cleaned by -c"""
2120
+ tlist = []
2121
+ for t in targets:
2122
+ tlist.extend(self.arg2nodes(t, self.fs.Entry))
2123
+ for t in tlist:
2124
+ t.set_noclean()
2125
+ return tlist
2126
+
2127
+ def NoCache(self, *targets):
2128
+ """Tags a target so that it will not be cached"""
2129
+ tlist = []
2130
+ for t in targets:
2131
+ tlist.extend(self.arg2nodes(t, self.fs.Entry))
2132
+ for t in tlist:
2133
+ t.set_nocache()
2134
+ return tlist
2135
+
2136
+ def Entry(self, name, *args, **kw):
2137
+ """
2138
+ """
2139
+ s = self.subst(name)
2140
+ if is_Sequence(s):
2141
+ result=[]
2142
+ for e in s:
2143
+ result.append(self.fs.Entry(e, *args, **kw))
2144
+ return result
2145
+ return self.fs.Entry(s, *args, **kw)
2146
+
2147
+ def Environment(self, **kw):
2148
+ return SCons.Environment.Environment(**self.subst_kw(kw))
2149
+
2150
+ def Execute(self, action, *args, **kw):
2151
+ """Directly execute an action through an Environment
2152
+ """
2153
+ action = self.Action(action, *args, **kw)
2154
+ result = action([], [], self)
2155
+ if isinstance(result, BuildError):
2156
+ errstr = result.errstr
2157
+ if result.filename:
2158
+ errstr = result.filename + ': ' + errstr
2159
+ sys.stderr.write("scons: *** %s\n" % errstr)
2160
+ return result.status
2161
+ else:
2162
+ return result
2163
+
2164
+ def File(self, name, *args, **kw):
2165
+ """
2166
+ """
2167
+ s = self.subst(name)
2168
+ if is_Sequence(s):
2169
+ result=[]
2170
+ for e in s:
2171
+ result.append(self.fs.File(e, *args, **kw))
2172
+ return result
2173
+ return self.fs.File(s, *args, **kw)
2174
+
2175
+ def FindFile(self, file, dirs):
2176
+ file = self.subst(file)
2177
+ nodes = self.arg2nodes(dirs, self.fs.Dir)
2178
+ return SCons.Node.FS.find_file(file, tuple(nodes))
2179
+
2180
+ def Flatten(self, sequence):
2181
+ return flatten(sequence)
2182
+
2183
+ def GetBuildPath(self, files):
2184
+ result = list(map(str, self.arg2nodes(files, self.fs.Entry)))
2185
+ if is_List(files):
2186
+ return result
2187
+ else:
2188
+ return result[0]
2189
+
2190
+ def Glob(self, pattern, ondisk=True, source=False, strings=False, exclude=None):
2191
+ return self.fs.Glob(self.subst(pattern), ondisk, source, strings, exclude)
2192
+
2193
+ def Ignore(self, target, dependency):
2194
+ """Ignore a dependency."""
2195
+ tlist = self.arg2nodes(target, self.fs.Entry)
2196
+ dlist = self.arg2nodes(dependency, self.fs.Entry)
2197
+ for t in tlist:
2198
+ t.add_ignore(dlist)
2199
+ return tlist
2200
+
2201
+ def Literal(self, string):
2202
+ return SCons.Subst.Literal(string)
2203
+
2204
+ def Local(self, *targets):
2205
+ ret = []
2206
+ for targ in targets:
2207
+ if isinstance(targ, SCons.Node.Node):
2208
+ targ.set_local()
2209
+ ret.append(targ)
2210
+ else:
2211
+ for t in self.arg2nodes(targ, self.fs.Entry):
2212
+ t.set_local()
2213
+ ret.append(t)
2214
+ return ret
2215
+
2216
+ def Precious(self, *targets):
2217
+ tlist = []
2218
+ for t in targets:
2219
+ tlist.extend(self.arg2nodes(t, self.fs.Entry))
2220
+ for t in tlist:
2221
+ t.set_precious()
2222
+ return tlist
2223
+
2224
+ def Pseudo(self, *targets):
2225
+ tlist = []
2226
+ for t in targets:
2227
+ tlist.extend(self.arg2nodes(t, self.fs.Entry))
2228
+ for t in tlist:
2229
+ t.set_pseudo()
2230
+ return tlist
2231
+
2232
+ def Repository(self, *dirs, **kw):
2233
+ dirs = self.arg2nodes(list(dirs), self.fs.Dir)
2234
+ self.fs.Repository(*dirs, **kw)
2235
+
2236
+ def Requires(self, target, prerequisite):
2237
+ """Specify that 'prerequisite' must be built before 'target',
2238
+ (but 'target' does not actually depend on 'prerequisite'
2239
+ and need not be rebuilt if it changes)."""
2240
+ tlist = self.arg2nodes(target, self.fs.Entry)
2241
+ plist = self.arg2nodes(prerequisite, self.fs.Entry)
2242
+ for t in tlist:
2243
+ t.add_prerequisite(plist)
2244
+ return tlist
2245
+
2246
+ def Scanner(self, *args, **kw):
2247
+ nargs = []
2248
+ for arg in args:
2249
+ if is_String(arg):
2250
+ arg = self.subst(arg)
2251
+ nargs.append(arg)
2252
+ nkw = self.subst_kw(kw)
2253
+ return SCons.Scanner.ScannerBase(*nargs, **nkw)
2254
+
2255
+ def SConsignFile(self, name=SCons.SConsign.current_sconsign_filename(), dbm_module=None):
2256
+ if name is not None:
2257
+ name = self.subst(name)
2258
+ if not os.path.isabs(name):
2259
+ name = os.path.join(str(self.fs.SConstruct_dir), name)
2260
+ if name:
2261
+ name = os.path.normpath(name)
2262
+ sconsign_dir = os.path.dirname(name)
2263
+ if sconsign_dir and not os.path.exists(sconsign_dir):
2264
+ self.Execute(SCons.Defaults.Mkdir(sconsign_dir))
2265
+ SCons.SConsign.File(name, dbm_module)
2266
+
2267
+ def SideEffect(self, side_effect, target):
2268
+ """Tell scons that side_effects are built as side
2269
+ effects of building targets."""
2270
+ side_effects = self.arg2nodes(side_effect, self.fs.Entry)
2271
+ targets = self.arg2nodes(target, self.fs.Entry)
2272
+
2273
+ added_side_effects = []
2274
+ for side_effect in side_effects:
2275
+ if side_effect.multiple_side_effect_has_builder():
2276
+ raise UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect))
2277
+ side_effect.add_source(targets)
2278
+ side_effect.side_effect = 1
2279
+ self.Precious(side_effect)
2280
+ added = False
2281
+ for target in targets:
2282
+ if side_effect not in target.side_effects:
2283
+ target.side_effects.append(side_effect)
2284
+ added = True
2285
+ if added:
2286
+ added_side_effects.append(side_effect)
2287
+ return added_side_effects
2288
+
2289
+ def Split(self, arg):
2290
+ """This function converts a string or list into a list of strings
2291
+ or Nodes. This makes things easier for users by allowing files to
2292
+ be specified as a white-space separated list to be split.
2293
+
2294
+ The input rules are:
2295
+ - A single string containing names separated by spaces. These will be
2296
+ split apart at the spaces.
2297
+ - A single Node instance
2298
+ - A list containing either strings or Node instances. Any strings
2299
+ in the list are not split at spaces.
2300
+
2301
+ In all cases, the function returns a list of Nodes and strings."""
2302
+
2303
+ if is_List(arg):
2304
+ return list(map(self.subst, arg))
2305
+ elif is_String(arg):
2306
+ return self.subst(arg).split()
2307
+ else:
2308
+ return [self.subst(arg)]
2309
+
2310
+ def Value(self, value, built_value=None, name=None):
2311
+ """
2312
+ """
2313
+ return SCons.Node.Python.ValueWithMemo(value, built_value, name)
2314
+
2315
+ def VariantDir(self, variant_dir, src_dir, duplicate=1):
2316
+ variant_dir = self.arg2nodes(variant_dir, self.fs.Dir)[0]
2317
+ src_dir = self.arg2nodes(src_dir, self.fs.Dir)[0]
2318
+ self.fs.VariantDir(variant_dir, src_dir, duplicate)
2319
+
2320
+ def FindSourceFiles(self, node='.'):
2321
+ """ returns a list of all source files.
2322
+ """
2323
+ node = self.arg2nodes(node, self.fs.Entry)[0]
2324
+
2325
+ sources = []
2326
+ def build_source(ss):
2327
+ for s in ss:
2328
+ if isinstance(s, SCons.Node.FS.Dir):
2329
+ build_source(s.all_children())
2330
+ elif s.has_builder():
2331
+ build_source(s.sources)
2332
+ elif isinstance(s.disambiguate(), SCons.Node.FS.File):
2333
+ sources.append(s)
2334
+ build_source(node.all_children())
2335
+
2336
+ def final_source(node):
2337
+ while node != node.srcnode():
2338
+ node = node.srcnode()
2339
+ return node
2340
+ sources = list(map(final_source, sources))
2341
+ # remove duplicates
2342
+ return list(set(sources))
2343
+
2344
+ def FindInstalledFiles(self):
2345
+ """ returns the list of all targets of the Install and InstallAs Builder.
2346
+ """
2347
+ from SCons.Tool import install
2348
+ if install._UNIQUE_INSTALLED_FILES is None:
2349
+ install._UNIQUE_INSTALLED_FILES = uniquer_hashables(install._INSTALLED_FILES)
2350
+ return install._UNIQUE_INSTALLED_FILES
2351
+
2352
+
2353
+ class OverrideEnvironment(Base):
2354
+ """A proxy that overrides variables in a wrapped construction
2355
+ environment by returning values from an overrides dictionary in
2356
+ preference to values from the underlying subject environment.
2357
+
2358
+ This is a lightweight (I hope) proxy that passes through most use of
2359
+ attributes to the underlying Environment.Base class, but has just
2360
+ enough additional methods defined to act like a real construction
2361
+ environment with overridden values. It can wrap either a Base
2362
+ construction environment, or another OverrideEnvironment, which
2363
+ can in turn nest arbitrary OverrideEnvironments...
2364
+
2365
+ Note that we do *not* call the underlying base class
2366
+ (SubsitutionEnvironment) initialization, because we get most of those
2367
+ from proxying the attributes of the subject construction environment.
2368
+ But because we subclass SubstitutionEnvironment, this class also
2369
+ has inherited arg2nodes() and subst*() methods; those methods can't
2370
+ be proxied because they need *this* object's methods to fetch the
2371
+ values from the overrides dictionary.
2372
+ """
2373
+
2374
+ def __init__(self, subject, overrides=None):
2375
+ if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.OverrideEnvironment')
2376
+ self.__dict__['__subject'] = subject
2377
+ if overrides is None:
2378
+ self.__dict__['overrides'] = dict()
2379
+ else:
2380
+ self.__dict__['overrides'] = overrides
2381
+
2382
+ # Methods that make this class act like a proxy.
2383
+ def __getattr__(self, name):
2384
+ attr = getattr(self.__dict__['__subject'], name)
2385
+ # Here we check if attr is one of the Wrapper classes. For
2386
+ # example when a pseudo-builder is being called from an
2387
+ # OverrideEnvironment.
2388
+ #
2389
+ # These wrappers when they're constructed capture the
2390
+ # Environment they are being constructed with and so will not
2391
+ # have access to overrided values. So we rebuild them with the
2392
+ # OverrideEnvironment so they have access to overrided values.
2393
+ if isinstance(attr, MethodWrapper):
2394
+ return attr.clone(self)
2395
+ else:
2396
+ return attr
2397
+
2398
+ def __setattr__(self, name, value):
2399
+ setattr(self.__dict__['__subject'], name, value)
2400
+
2401
+ # Methods that make this class act like a dictionary.
2402
+ def __getitem__(self, key):
2403
+ try:
2404
+ return self.__dict__['overrides'][key]
2405
+ except KeyError:
2406
+ return self.__dict__['__subject'].__getitem__(key)
2407
+
2408
+ def __setitem__(self, key, value):
2409
+ if not is_valid_construction_var(key):
2410
+ raise UserError("Illegal construction variable `%s'" % key)
2411
+ self.__dict__['overrides'][key] = value
2412
+
2413
+ def __delitem__(self, key):
2414
+ try:
2415
+ del self.__dict__['overrides'][key]
2416
+ except KeyError:
2417
+ deleted = 0
2418
+ else:
2419
+ deleted = 1
2420
+ try:
2421
+ result = self.__dict__['__subject'].__delitem__(key)
2422
+ except KeyError:
2423
+ if not deleted:
2424
+ raise
2425
+ result = None
2426
+ return result
2427
+
2428
+ def get(self, key, default=None):
2429
+ """Emulates the get() method of dictionaries."""
2430
+ try:
2431
+ return self.__dict__['overrides'][key]
2432
+ except KeyError:
2433
+ return self.__dict__['__subject'].get(key, default)
2434
+
2435
+ def __contains__(self, key):
2436
+ if key in self.__dict__['overrides']:
2437
+ return True
2438
+ return key in self.__dict__['__subject']
2439
+
2440
+ def Dictionary(self, *args):
2441
+ d = self.__dict__['__subject'].Dictionary().copy()
2442
+ d.update(self.__dict__['overrides'])
2443
+ if not args:
2444
+ return d
2445
+ dlist = [d[x] for x in args]
2446
+ if len(dlist) == 1:
2447
+ dlist = dlist[0]
2448
+ return dlist
2449
+
2450
+ def items(self):
2451
+ """Emulates the items() method of dictionaries."""
2452
+ return self.Dictionary().items()
2453
+
2454
+ def keys(self):
2455
+ """Emulates the keys() method of dictionaries."""
2456
+ return self.Dictionary().keys()
2457
+
2458
+ def values(self):
2459
+ """Emulates the values() method of dictionaries."""
2460
+ return self.Dictionary().values()
2461
+
2462
+ def setdefault(self, key, default=None):
2463
+ """Emulates the setdefault() method of dictionaries."""
2464
+ try:
2465
+ return self.__getitem__(key)
2466
+ except KeyError:
2467
+ self.__dict__['overrides'][key] = default
2468
+ return default
2469
+
2470
+ # Overridden private construction environment methods.
2471
+ def _update(self, other):
2472
+ self.__dict__['overrides'].update(other)
2473
+
2474
+ def _update_onlynew(self, other):
2475
+ for k, v in other.items():
2476
+ if k not in self.__dict__['overrides']:
2477
+ self.__dict__['overrides'][k] = v
2478
+
2479
+ def gvars(self):
2480
+ return self.__dict__['__subject'].gvars()
2481
+
2482
+ def lvars(self):
2483
+ lvars = self.__dict__['__subject'].lvars()
2484
+ lvars.update(self.__dict__['overrides'])
2485
+ return lvars
2486
+
2487
+ # Overridden public construction environment methods.
2488
+ def Replace(self, **kw):
2489
+ kw = copy_non_reserved_keywords(kw)
2490
+ self.__dict__['overrides'].update(semi_deepcopy(kw))
2491
+
2492
+
2493
+ # The entry point that will be used by the external world
2494
+ # to refer to a construction environment. This allows the wrapper
2495
+ # interface to extend a construction environment for its own purposes
2496
+ # by subclassing SCons.Environment.Base and then assigning the
2497
+ # class to SCons.Environment.Environment.
2498
+
2499
+ Environment = Base
2500
+
2501
+
2502
+ def NoSubstitutionProxy(subject):
2503
+ """
2504
+ An entry point for returning a proxy subclass instance that overrides
2505
+ the subst*() methods so they don't actually perform construction
2506
+ variable substitution. This is specifically intended to be the shim
2507
+ layer in between global function calls (which don't want construction
2508
+ variable substitution) and the DefaultEnvironment() (which would
2509
+ substitute variables if left to its own devices).
2510
+
2511
+ We have to wrap this in a function that allows us to delay definition of
2512
+ the class until it's necessary, so that when it subclasses Environment
2513
+ it will pick up whatever Environment subclass the wrapper interface
2514
+ might have assigned to SCons.Environment.Environment.
2515
+ """
2516
+ class _NoSubstitutionProxy(Environment):
2517
+ def __init__(self, subject):
2518
+ self.__dict__['__subject'] = subject
2519
+ def __getattr__(self, name):
2520
+ return getattr(self.__dict__['__subject'], name)
2521
+ def __setattr__(self, name, value):
2522
+ return setattr(self.__dict__['__subject'], name, value)
2523
+ def executor_to_lvars(self, kwdict):
2524
+ if 'executor' in kwdict:
2525
+ kwdict['lvars'] = kwdict['executor'].get_lvars()
2526
+ del kwdict['executor']
2527
+ else:
2528
+ kwdict['lvars'] = {}
2529
+ def raw_to_mode(self, dict):
2530
+ try:
2531
+ raw = dict['raw']
2532
+ except KeyError:
2533
+ pass
2534
+ else:
2535
+ del dict['raw']
2536
+ dict['mode'] = raw
2537
+ def subst(self, string, *args, **kwargs):
2538
+ return string
2539
+ def subst_kw(self, kw, *args, **kwargs):
2540
+ return kw
2541
+ def subst_list(self, string, *args, **kwargs):
2542
+ nargs = (string, self,) + args
2543
+ nkw = kwargs.copy()
2544
+ nkw['gvars'] = {}
2545
+ self.executor_to_lvars(nkw)
2546
+ self.raw_to_mode(nkw)
2547
+ return SCons.Subst.scons_subst_list(*nargs, **nkw)
2548
+ def subst_target_source(self, string, *args, **kwargs):
2549
+ nargs = (string, self,) + args
2550
+ nkw = kwargs.copy()
2551
+ nkw['gvars'] = {}
2552
+ self.executor_to_lvars(nkw)
2553
+ self.raw_to_mode(nkw)
2554
+ return SCons.Subst.scons_subst(*nargs, **nkw)
2555
+ return _NoSubstitutionProxy(subject)
2556
+
2557
+ # Local Variables:
2558
+ # tab-width:4
2559
+ # indent-tabs-mode:nil
2560
+ # End:
2561
+ # vim: set expandtab tabstop=4 shiftwidth=4: