pytron-kit 0.3.12__py3-none-macosx_11_0_universal2.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. pytron/__init__.py +112 -0
  2. pytron/application.py +562 -0
  3. pytron/apputils/__init__.py +0 -0
  4. pytron/apputils/chrome_ipc.py +203 -0
  5. pytron/apputils/codegen.py +261 -0
  6. pytron/apputils/config.py +303 -0
  7. pytron/apputils/deadmansswitch.py +47 -0
  8. pytron/apputils/extras.py +76 -0
  9. pytron/apputils/native.py +148 -0
  10. pytron/apputils/shell.py +73 -0
  11. pytron/apputils/windows.py +286 -0
  12. pytron/cli.py +384 -0
  13. pytron/commands/__init__.py +0 -0
  14. pytron/commands/android.py +28 -0
  15. pytron/commands/build.py +26 -0
  16. pytron/commands/doctor.py +221 -0
  17. pytron/commands/engine.py +23 -0
  18. pytron/commands/frontend.py +60 -0
  19. pytron/commands/harvest.py +112 -0
  20. pytron/commands/helpers.py +239 -0
  21. pytron/commands/info.py +50 -0
  22. pytron/commands/init.py +521 -0
  23. pytron/commands/install.py +294 -0
  24. pytron/commands/login.py +130 -0
  25. pytron/commands/package.py +228 -0
  26. pytron/commands/plugin.py +442 -0
  27. pytron/commands/run.py +312 -0
  28. pytron/commands/scan.py +210 -0
  29. pytron/commands/show.py +23 -0
  30. pytron/commands/uninstall.py +150 -0
  31. pytron/commands/utils.py +42 -0
  32. pytron/commands/workflow.py +95 -0
  33. pytron/console.py +133 -0
  34. pytron/core.py +18 -0
  35. pytron/dependencies/WebView2Loader.dll +0 -0
  36. pytron/dependencies/__init__.py +1 -0
  37. pytron/dependencies/pytron_native.so +0 -0
  38. pytron/engines/chrome/adapter.py +445 -0
  39. pytron/engines/chrome/engine.py +576 -0
  40. pytron/engines/chrome/forge.py +147 -0
  41. pytron/engines/chrome/shell/package.json +8 -0
  42. pytron/engines/chrome/shell/preload.js +12 -0
  43. pytron/engines/chrome/shell/shell.js +534 -0
  44. pytron/exceptions.py +36 -0
  45. pytron/inspector.py +201 -0
  46. pytron/inspector_ui.py +512 -0
  47. pytron/installer/Installation.nsi +236 -0
  48. pytron/installer/header.bmp +0 -0
  49. pytron/installer/pytron.ico +0 -0
  50. pytron/installer/sidebar.bmp +0 -0
  51. pytron/llms.md +98 -0
  52. pytron/manifests/README.md +29 -0
  53. pytron/manifests/windows-utf8.manifest +44 -0
  54. pytron/menu.py +128 -0
  55. pytron/nsis-setup.exe +0 -0
  56. pytron/pack/__init__.py +0 -0
  57. pytron/pack/assets.py +131 -0
  58. pytron/pack/compilers.py +289 -0
  59. pytron/pack/crystal.py +297 -0
  60. pytron/pack/graph.py +377 -0
  61. pytron/pack/inference.py +157 -0
  62. pytron/pack/installers.py +402 -0
  63. pytron/pack/introspect.py +357 -0
  64. pytron/pack/metadata.py +213 -0
  65. pytron/pack/modules.py +618 -0
  66. pytron/pack/nuitka.py +108 -0
  67. pytron/pack/pipeline.py +107 -0
  68. pytron/pack/pyinstaller.py +176 -0
  69. pytron/pack/rust_engine.py +273 -0
  70. pytron/pack/secure.py +309 -0
  71. pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
  72. pytron/pack/secure_loader/icon.ico +0 -0
  73. pytron/pack/utils.py +110 -0
  74. pytron/pack/virtual_root.py +124 -0
  75. pytron/platforms/__init__.py +0 -0
  76. pytron/platforms/android/__init__.py +3 -0
  77. pytron/platforms/android/android.py +103 -0
  78. pytron/platforms/android/builder.py +736 -0
  79. pytron/platforms/android/ops/build.py +79 -0
  80. pytron/platforms/android/ops/init.py +63 -0
  81. pytron/platforms/android/ops/run.py +79 -0
  82. pytron/platforms/android/ops/sync.py +770 -0
  83. pytron/platforms/android/ops/utils.py +8 -0
  84. pytron/platforms/android/shell/README.md +30 -0
  85. pytron/platforms/android/shell/app/build.gradle +64 -0
  86. pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
  87. pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
  88. pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
  89. pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
  90. pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
  91. pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
  92. pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
  93. pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
  94. pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
  95. pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
  96. pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
  97. pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
  98. pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
  99. pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
  100. pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
  101. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
  102. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
  103. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
  104. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
  105. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
  106. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
  107. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
  108. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
  109. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
  110. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
  111. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
  112. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
  113. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
  114. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
  115. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
  116. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
  117. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
  118. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
  119. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
  120. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
  121. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
  122. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
  123. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
  124. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
  125. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
  126. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
  127. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
  128. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
  129. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
  130. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
  131. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
  132. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
  133. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
  134. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
  135. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
  136. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
  137. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
  138. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
  139. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
  140. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
  141. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
  142. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
  143. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
  144. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
  145. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
  146. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
  147. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
  148. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
  149. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
  150. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
  151. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
  152. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
  153. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
  154. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
  155. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
  156. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
  157. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
  158. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
  159. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
  160. pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
  161. pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
  162. pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
  163. pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
  164. pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
  165. pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
  166. pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
  167. pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
  168. pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
  169. pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
  170. pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
  171. pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
  172. pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
  173. pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
  174. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
  175. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
  176. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
  177. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
  178. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
  179. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
  180. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
  181. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
  182. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
  183. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
  184. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
  185. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
  186. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
  187. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
  188. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
  189. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
  190. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
  191. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
  192. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
  193. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
  194. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
  195. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
  196. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
  197. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
  198. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
  199. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
  200. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
  201. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
  202. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
  203. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
  204. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
  205. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
  206. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
  207. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
  208. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
  209. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
  210. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
  211. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
  212. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
  213. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
  214. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
  215. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
  216. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
  217. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
  218. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
  219. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
  220. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
  221. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
  222. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
  223. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
  224. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
  225. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
  226. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
  227. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
  228. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
  229. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
  230. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
  231. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
  232. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
  233. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
  234. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
  235. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
  236. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
  237. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
  238. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
  239. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
  240. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
  241. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
  242. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
  243. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
  244. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
  245. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
  246. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
  247. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
  248. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
  249. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
  250. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
  251. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
  252. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
  253. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
  254. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
  255. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
  256. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
  257. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
  258. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
  259. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
  260. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
  261. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
  262. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
  263. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
  264. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
  265. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
  266. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
  267. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
  268. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
  269. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
  270. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
  271. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
  272. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
  273. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
  274. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
  275. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
  276. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
  277. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
  278. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
  279. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
  280. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
  281. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
  282. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
  283. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
  284. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
  285. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
  286. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
  287. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
  288. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
  289. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
  290. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
  291. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
  292. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
  293. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
  294. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
  295. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
  296. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
  297. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
  298. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
  299. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
  300. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
  301. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
  302. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
  303. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
  304. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
  305. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
  306. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
  307. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
  308. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
  309. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
  310. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
  311. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
  312. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
  313. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
  314. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
  315. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
  316. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
  317. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
  318. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
  319. pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
  320. pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
  321. pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
  322. pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
  323. pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
  324. pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
  325. pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
  326. pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
  327. pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
  328. pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
  329. pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
  330. pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
  331. pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
  332. pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
  333. pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
  334. pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
  335. pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
  336. pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
  337. pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
  338. pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
  339. pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
  340. pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
  341. pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
  342. pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
  343. pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
  344. pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
  345. pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
  346. pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
  347. pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
  348. pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
  349. pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
  350. pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
  351. pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
  352. pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
  353. pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
  354. pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
  355. pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
  356. pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
  357. pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
  358. pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
  359. pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
  360. pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
  361. pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
  362. pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
  363. pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
  364. pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
  365. pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
  366. pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
  367. pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
  368. pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
  369. pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
  370. pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
  371. pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
  372. pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
  373. pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
  374. pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
  375. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  376. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  377. pytron/platforms/android/shell/build.gradle +11 -0
  378. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
  379. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
  380. pytron/platforms/android/shell/gradle.properties +2 -0
  381. pytron/platforms/android/shell/gradlew.bat +85 -0
  382. pytron/platforms/android/shell/settings.gradle +16 -0
  383. pytron/platforms/darwin.py +82 -0
  384. pytron/platforms/darwin_ops/libs.py +31 -0
  385. pytron/platforms/darwin_ops/system.py +182 -0
  386. pytron/platforms/darwin_ops/utils.py +85 -0
  387. pytron/platforms/darwin_ops/webview.py +5 -0
  388. pytron/platforms/darwin_ops/window.py +102 -0
  389. pytron/platforms/interface.py +152 -0
  390. pytron/platforms/linux.py +82 -0
  391. pytron/platforms/linux_ops/libs.py +49 -0
  392. pytron/platforms/linux_ops/system.py +316 -0
  393. pytron/platforms/linux_ops/utils.py +19 -0
  394. pytron/platforms/linux_ops/webview.py +5 -0
  395. pytron/platforms/linux_ops/window.py +115 -0
  396. pytron/platforms/windows.py +136 -0
  397. pytron/platforms/windows_ops/__init__.py +0 -0
  398. pytron/platforms/windows_ops/constants.py +126 -0
  399. pytron/platforms/windows_ops/system.py +518 -0
  400. pytron/platforms/windows_ops/utils.py +3 -0
  401. pytron/platforms/windows_ops/webview.py +5 -0
  402. pytron/platforms/windows_ops/window.py +361 -0
  403. pytron/plugin.py +467 -0
  404. pytron/rcedit-x64.exe +0 -0
  405. pytron/router.py +146 -0
  406. pytron/serializer.py +240 -0
  407. pytron/shortcuts.py +279 -0
  408. pytron/state.py +76 -0
  409. pytron/tray.py +399 -0
  410. pytron/updater.py +181 -0
  411. pytron/utf8_hook.py +112 -0
  412. pytron/utils.py +44 -0
  413. pytron/webview.py +722 -0
  414. pytron_kit-0.3.12.dist-info/METADATA +131 -0
  415. pytron_kit-0.3.12.dist-info/RECORD +419 -0
  416. pytron_kit-0.3.12.dist-info/WHEEL +5 -0
  417. pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
  418. pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
  419. pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
pytron/pack/nuitka.py ADDED
@@ -0,0 +1,108 @@
1
+ import os
2
+ import sys
3
+ import shutil
4
+ import subprocess # nosec B404
5
+ import platform
6
+ from pathlib import Path
7
+ from ..console import log, run_command_with_output, console, Rule
8
+ from ..commands.helpers import get_python_executable, get_venv_site_packages
9
+ from .installers import build_installer
10
+
11
+
12
+ from .pipeline import BuildContext
13
+
14
+
15
+ def run_nuitka_build(context: BuildContext):
16
+ """
17
+ Core Nuitka compiler stage.
18
+ """
19
+ log("Packaging using Nuitka (Native Compilation)...", style="info")
20
+
21
+ # 1. Check for Nuitka
22
+ import shutil
23
+ from .pipeline import BuildContext
24
+ from ..commands.helpers import get_python_executable, get_venv_site_packages
25
+
26
+ python_exe = get_python_executable()
27
+ if (
28
+ not shutil.which("nuitka")
29
+ and not get_venv_site_packages(python_exe).joinpath("nuitka").exists()
30
+ ):
31
+ log("Nuitka not found. Installing...", style="warning")
32
+ subprocess.check_call(
33
+ [python_exe, "-m", "pip", "install", "nuitka", "zstandard"]
34
+ )
35
+
36
+ # 2. Build Nuitka Command
37
+ cmd = [
38
+ python_exe,
39
+ "-m",
40
+ "nuitka",
41
+ "--standalone",
42
+ "--assume-yes-for-downloads",
43
+ "--output-dir=dist",
44
+ ]
45
+
46
+ if context.is_onefile:
47
+ cmd.append("--onefile")
48
+ ext = ".exe" if sys.platform == "win32" else ".bin"
49
+ cmd.append(f"--output-filename={context.out_name}{ext}")
50
+
51
+ # Metadata
52
+ title = context.settings.get("title") or context.out_name
53
+ version = context.settings.get("version", "1.0.0")
54
+ author = context.settings.get("author") or "Pytron User"
55
+
56
+ cmd.extend(
57
+ [
58
+ f"--company-name={author}",
59
+ f"--product-name={title}",
60
+ f"--file-version={version}",
61
+ f"--product-version={version}",
62
+ ]
63
+ )
64
+
65
+ if context.app_icon:
66
+ if sys.platform == "win32":
67
+ cmd.append(f"--windows-icon-from-ico={context.app_icon}")
68
+ elif sys.platform == "linux":
69
+ cmd.append(f"--linux-icon={context.app_icon}")
70
+
71
+ if context.settings.get("console"):
72
+ if sys.platform == "win32":
73
+ cmd.append("--windows-console-mode=force")
74
+ else:
75
+ if sys.platform == "win32":
76
+ cmd.append("--windows-console-mode=disable")
77
+
78
+ # Assets
79
+ # Native Engine Binaries
80
+ from .utils import get_native_engine_binaries
81
+
82
+ binaries = get_native_engine_binaries()
83
+
84
+ for bin_name in binaries:
85
+ bin_src = context.package_dir / "pytron" / "dependencies" / bin_name
86
+ if bin_src.exists():
87
+ cmd.append(f"--include-data-file={bin_src}=pytron/dependencies/{bin_name}")
88
+
89
+ for item in context.add_data:
90
+ if os.pathsep in item:
91
+ src, dst = item.split(os.pathsep, 1)
92
+ if os.path.isdir(src):
93
+ cmd.append(f"--include-data-dir={src}={dst}")
94
+ else:
95
+ if dst == ".":
96
+ dst = os.path.basename(src)
97
+ cmd.append(f"--include-data-file={src}={dst}")
98
+
99
+ # Hidden Imports
100
+ for imp in context.hidden_imports:
101
+ cmd.append(f"--include-module={imp}")
102
+
103
+ cmd.append(str(context.script))
104
+
105
+ log(f"Running Nuitka: {' '.join(cmd)}", style="dim")
106
+ ret_code = run_command_with_output(cmd, style="dim")
107
+
108
+ return ret_code
@@ -0,0 +1,107 @@
1
+ import os
2
+ import sys
3
+ import json
4
+ from pathlib import Path
5
+ from dataclasses import dataclass, field
6
+ from typing import List, Dict, Any, Optional
7
+ from ..console import log, console, get_progress
8
+
9
+
10
+ @dataclass
11
+ class BuildContext:
12
+ # CLI Arguments
13
+ script: Path
14
+ out_name: str
15
+ app_icon: Optional[str] = None
16
+ settings: Dict[str, Any] = field(default_factory=dict)
17
+
18
+ # Bundle Data
19
+ add_data: List[str] = field(default_factory=list)
20
+ binaries: List[str] = field(default_factory=list)
21
+ hidden_imports: List[str] = field(default_factory=list)
22
+ excludes: List[str] = field(default_factory=list)
23
+ pathex: List[str] = field(default_factory=list)
24
+ extra_args: List[str] = field(default_factory=list)
25
+ runtime_hooks: List[str] = field(default_factory=list)
26
+
27
+ # Path Helpers
28
+ package_dir: Path = field(init=False)
29
+ script_dir: Path = field(init=False)
30
+ build_dir: Path = field(init=False)
31
+ dist_dir: Path = field(init=False)
32
+
33
+ # Engine & Security Flags
34
+ engine: Optional[str] = None
35
+ is_secure: bool = False
36
+ is_nuitka: bool = False
37
+ is_onefile: bool = False
38
+
39
+ # Internal State
40
+ progress: Any = None
41
+ task_id: Any = None
42
+
43
+ def __post_init__(self):
44
+ import pytron
45
+
46
+ self.package_dir = Path(pytron.__file__).resolve().parent.parent
47
+ self.script_dir = self.script.parent
48
+ self.build_dir = Path("build")
49
+ self.dist_dir = Path("dist") / self.out_name
50
+
51
+
52
+ class BuildModule:
53
+ """Base class for build modules."""
54
+
55
+ def prepare(self, context: BuildContext):
56
+ """Phase 1: Gather assets and requirements."""
57
+ pass
58
+
59
+ def build_wrapper(self, context: BuildContext, build_func):
60
+ """Phase 2: Wrap or modify the actual build execution.
61
+ Must return a function or call build_func.
62
+ """
63
+ return build_func(context)
64
+
65
+ def post_build(self, context: BuildContext):
66
+ """Phase 3: Cleanup, patching, signing."""
67
+ pass
68
+
69
+
70
+ class Pipeline:
71
+ def __init__(self, context: BuildContext):
72
+ self.context = context
73
+ self.modules: List[BuildModule] = []
74
+
75
+ def add_module(self, module: BuildModule):
76
+ self.modules.append(module)
77
+
78
+ def run(self, core_build_func):
79
+ """
80
+ Execution flow:
81
+ 1. Prepare (All modules)
82
+ 2. Build Wrapper (Nested call)
83
+ 3. Post Build (All modules, reverse order)
84
+ """
85
+ # 1. Prepare
86
+ for module in self.modules:
87
+ module.prepare(self.context)
88
+
89
+ # 2. Build Wrapper (Chain them)
90
+ current_build_func = core_build_func
91
+
92
+ # We wrap it in reverse order so the first module added is the outermost wrapper
93
+ for module in reversed(self.modules):
94
+ # Create a closure to capture the current state of build_func
95
+ def make_wrapper(m, func):
96
+ return lambda ctx: m.build_wrapper(ctx, func)
97
+
98
+ current_build_func = make_wrapper(module, current_build_func)
99
+
100
+ ret_code = current_build_func(self.context)
101
+
102
+ # 3. Post Build
103
+ if ret_code == 0:
104
+ for module in self.modules:
105
+ module.post_build(self.context)
106
+
107
+ return ret_code
@@ -0,0 +1,176 @@
1
+ import os
2
+ import sys
3
+ import subprocess # nosec B404
4
+ import platform
5
+ from pathlib import Path
6
+ from ..console import log, run_command_with_output, console, Rule
7
+ from ..commands.helpers import get_python_executable, get_venv_site_packages
8
+ from ..commands.harvest import generate_nuclear_hooks
9
+ from .installers import build_installer
10
+ from .utils import cleanup_dist
11
+
12
+ from .metadata import MetadataEditor
13
+ from .pipeline import BuildContext
14
+
15
+
16
+ def run_pyinstaller_build(context: BuildContext):
17
+ """
18
+ Core PyInstaller compiler stage.
19
+ """
20
+ try:
21
+ log("Generating spec file...", style="info")
22
+ context.progress.update(
23
+ context.task_id, description="Generating Spec...", completed=30
24
+ )
25
+
26
+ # 1. Resolve Platform-Specific Libs
27
+ # 1. Resolve Platform-Specific Libs
28
+ from .utils import get_native_engine_binaries
29
+
30
+ binaries = get_native_engine_binaries()
31
+ dll_dest = os.path.join("pytron", "dependencies")
32
+
33
+ # 2. Build Makespec Command
34
+ makespec_cmd = [
35
+ get_python_executable(),
36
+ "-m",
37
+ "PyInstaller.utils.cliutils.makespec",
38
+ "--name",
39
+ context.out_name,
40
+ ]
41
+
42
+ if context.is_onefile:
43
+ makespec_cmd.append("--onefile")
44
+ else:
45
+ makespec_cmd.append("--onedir")
46
+
47
+ # Console handling
48
+ # Note: We'd ideally have this in the context, but for now we read from context.settings/args if available
49
+ # In this refactor, we'll assume context has what it needs.
50
+ # For simplicity, if --console was passed to CLI, we should have it in extra_args or similar.
51
+ # But let's check settings for now.
52
+ if context.settings.get("console"):
53
+ makespec_cmd.append("--console")
54
+ else:
55
+ makespec_cmd.append("--noconsole")
56
+
57
+ # Add Core Native Engine Binaries
58
+ for bin_name in binaries:
59
+ bin_src = context.package_dir / "pytron" / "dependencies" / bin_name
60
+ if bin_src.exists():
61
+ makespec_cmd.append(f"--add-binary={bin_src}{os.pathsep}{dll_dest}")
62
+
63
+ # Add Scripts
64
+ # For secure builds, we add BOTH the bootstrap and the original script
65
+ # PyInstaller will analyze both for dependencies, but bootstrap (first)
66
+ # stays as the primary entry point script.
67
+ makespec_cmd.append(str(context.script))
68
+
69
+ if context.is_secure and hasattr(context, "original_script"):
70
+ makespec_cmd.append(str(context.original_script))
71
+
72
+ # Add Runtime Hooks
73
+ if sys.platform == "win32":
74
+ utf8_hook = context.package_dir / "pytron" / "utf8_hook.py"
75
+ if utf8_hook.exists():
76
+ makespec_cmd.append(f"--runtime-hook={utf8_hook}")
77
+
78
+ for hook in context.runtime_hooks:
79
+ makespec_cmd.append(f"--runtime-hook={hook}")
80
+
81
+ # Add Assets (from Modules)
82
+ for item in context.add_data:
83
+ makespec_cmd.extend(["--add-data", item])
84
+
85
+ for item in context.binaries:
86
+ makespec_cmd.extend(["--add-binary", item])
87
+
88
+ for imp in context.hidden_imports:
89
+ makespec_cmd.append(f"--hidden-import={imp}")
90
+
91
+ for ex in context.excludes:
92
+ makespec_cmd.append(f"--exclude-module={ex}")
93
+
94
+ for p in context.pathex:
95
+ makespec_cmd.append(f"--paths={p}")
96
+
97
+ # Force Package (Collect All from Settings)
98
+ forced_pkgs = context.settings.get("force-package", [])
99
+ if forced_pkgs:
100
+ for pkg in forced_pkgs:
101
+ # Use collect-all to ensure data files (like .pyi stubs for lazy_loader) are included
102
+ makespec_cmd.append(f"--collect-all={pkg}")
103
+ log(f"Forcing collect-all for packages: {forced_pkgs}", style="dim")
104
+
105
+ makespec_cmd.extend(context.extra_args)
106
+
107
+ if context.app_icon:
108
+ makespec_cmd.extend(["--icon", context.app_icon])
109
+
110
+ # Splash Screen
111
+ splash_image = context.settings.get("splash_image")
112
+ if splash_image:
113
+ splash_path = context.script_dir / splash_image
114
+ if splash_path.exists():
115
+ makespec_cmd.extend(["--splash", str(splash_path)])
116
+ log(f"Splash screen enabled: {splash_image}", style="dim")
117
+ else:
118
+ log(
119
+ f"Warning: Splash image not found at {splash_path}", style="warning"
120
+ )
121
+
122
+ # Run Makespec
123
+ log(f"Running makespec: {' '.join(makespec_cmd)}", style="dim")
124
+ makespec_ret = run_command_with_output(makespec_cmd, style="dim")
125
+ if makespec_ret != 0:
126
+ return 1
127
+
128
+ spec_file = Path(f"{context.out_name}.spec")
129
+ if not spec_file.exists():
130
+ log(f"Error: spec file {spec_file} not found", style="error")
131
+ return 1
132
+
133
+ # Fortress / Spec Optimization Hook
134
+ if (
135
+ context.settings.get("optimize_spec")
136
+ or context.is_secure
137
+ or hasattr(context, "fortress_active")
138
+ ):
139
+ try:
140
+ from fortress import SpecOptimizer
141
+
142
+ optimizer = SpecOptimizer(spec_file)
143
+ optimizer.optimize()
144
+ log("Fortress: Spec optimization applied.", style="dim")
145
+ except ImportError:
146
+ pass
147
+ except Exception as e:
148
+ log(f"Warning: Spec optimization failed: {e}", style="warning")
149
+
150
+ # 3. Execution Phase
151
+ build_cmd = [
152
+ get_python_executable(),
153
+ "-m",
154
+ "PyInstaller",
155
+ "--noconfirm",
156
+ "--clean",
157
+ str(spec_file),
158
+ ]
159
+
160
+ context.progress.update(
161
+ context.task_id, description="Compiling...", completed=50
162
+ )
163
+ log(f"Building from Spec: {' '.join(build_cmd)}", style="dim")
164
+
165
+ ret_code = run_command_with_output(build_cmd, style="dim")
166
+
167
+ if ret_code == 0:
168
+ # Cleanup
169
+ has_splash = bool(context.settings.get("splash_image"))
170
+ cleanup_dist(Path("dist") / context.out_name, preserve_tk=has_splash)
171
+
172
+ return ret_code
173
+
174
+ except Exception as e:
175
+ log(f"PyInstaller build failed: {e}", style="error")
176
+ return 1
@@ -0,0 +1,273 @@
1
+ import os
2
+ import sys
3
+ import shutil
4
+ import subprocess
5
+ import platform
6
+ import re
7
+ from pathlib import Path
8
+ from .pipeline import BuildModule, BuildContext
9
+ from ..console import log
10
+ from ..commands.helpers import get_python_executable
11
+
12
+
13
+ class RustEngine(BuildModule):
14
+ """
15
+ The 'God Mode' Build Engine.
16
+ Replaces PyInstaller with a native Rust Bootloader + Cython Compiled Entry Point.
17
+ """
18
+
19
+ def __init__(self):
20
+ super().__init__()
21
+ self.compiled_pyd = None
22
+
23
+ def build(self, context: BuildContext):
24
+ """
25
+ Main entry point for the Rust Engine build process.
26
+ """
27
+ log("Initialize Rust Engine (God Mode)...", style="cyan")
28
+
29
+ # 1. Compile the Entry Point (VEP) to Native Code
30
+ self._compile_entry_point(context)
31
+
32
+ # 2. Deploy Rust Bootloader
33
+ self._deploy_bootloader(context)
34
+
35
+ # 3. Assemble Dependencies (The Pure Python Libs)
36
+ self._assemble_libs(context)
37
+
38
+ # 4. Process Assets (Copy Context Data)
39
+ self._process_assets(context)
40
+
41
+ return 0 # Success
42
+
43
+ def _process_assets(self, context: BuildContext):
44
+ """
45
+ Copies assets defined in context.add_data (src;dest_dir structure).
46
+ """
47
+ log("Processing assets...", style="dim")
48
+ for item in context.add_data:
49
+ # Format is usually "src_path;dest_dir" (Windows) or "src_path:dest_dir" (Unix)
50
+ # PyInstaller uses os.pathsep
51
+ parts = item.split(os.pathsep)
52
+ if len(parts) != 2:
53
+ continue
54
+
55
+ src, dest_rel = parts
56
+ src_path = Path(src)
57
+ dest_path = context.dist_dir / dest_rel
58
+
59
+ if not src_path.exists():
60
+ continue
61
+
62
+ dest_path.parent.mkdir(parents=True, exist_ok=True)
63
+
64
+ if src_path.is_dir():
65
+ # Copy tree
66
+ if dest_path.exists():
67
+ shutil.rmtree(dest_path)
68
+ shutil.copytree(src_path, dest_path)
69
+ else:
70
+ # Copy file
71
+ shutil.copy2(src_path, dest_path)
72
+
73
+ def _compile_entry_point(self, context: BuildContext):
74
+ """
75
+ Compiles the context.script to app.pyd using the shared compiler.
76
+ """
77
+ from .compilers import compile_script
78
+
79
+ build_dir = context.build_dir / "rust_build"
80
+ build_dir.mkdir(parents=True, exist_ok=True)
81
+
82
+ log(f"Compiling entry point: {context.script.name} -> app.pyd", style="dim")
83
+
84
+ output_pyd = compile_script(context.script, build_dir)
85
+
86
+ if output_pyd and output_pyd.exists():
87
+ log(f"Native compilation successful: {output_pyd.name}", style="success")
88
+ self.compiled_pyd = output_pyd
89
+ else:
90
+ raise RuntimeError("Native compilation failed.")
91
+
92
+ def _deploy_bootloader(self, context: BuildContext):
93
+ """
94
+ Copies the pre-compiled Rust Bootloader to dist.
95
+ """
96
+ log("Deploying Rust Bootloader...", style="info")
97
+
98
+ # Bootloader binary name
99
+ ext = ".exe" if sys.platform == "win32" else ""
100
+ loader_name = f"pytron_rust_bootloader{ext}"
101
+
102
+ # Source path
103
+ loader_src = (
104
+ context.package_dir
105
+ / "pytron"
106
+ / "pack"
107
+ / "secure_loader"
108
+ / "bin"
109
+ / loader_name
110
+ )
111
+
112
+ if not loader_src.exists():
113
+ raise RuntimeError(f"Rust Bootloader not found at {loader_src}")
114
+
115
+ # Dest path (Renamed to output name)
116
+ dest_exe = context.dist_dir / f"{context.out_name}{ext}"
117
+
118
+ shutil.copy2(loader_src, dest_exe)
119
+ log(f"Bootloader deployed: {dest_exe}", style="success")
120
+
121
+ # Also deploy the app.pyd next to it
122
+ if self.compiled_pyd:
123
+ shutil.copy2(self.compiled_pyd, context.dist_dir / self.compiled_pyd.name)
124
+
125
+ def _assemble_libs(self, context: BuildContext):
126
+ """
127
+ Copies required python libraries modules to dist folder using Crystal Manifest.
128
+ """
129
+ log("Assembling dependencies from Crystal Manifest...", style="cyan")
130
+
131
+ manifest_path = context.script.parent / "requirements.lock.json"
132
+
133
+ # Fallback if VEP was used, the manifest might be named after VEP or original?
134
+ # Crystal creates manifest at script.parent / "requirements.lock.json"
135
+
136
+ if not manifest_path.exists():
137
+ log(
138
+ "Warning: Requirements Lock not found. Skipping dependency assembly.",
139
+ style="warning",
140
+ )
141
+ return
142
+
143
+ import json
144
+
145
+ try:
146
+ data = json.loads(manifest_path.read_text())
147
+ except Exception:
148
+ data = {}
149
+
150
+ # Support both new "modules" style and old list style if any
151
+ # But Crystal now emits {modules:[], files:[]}
152
+ files = data.get("files", [])
153
+
154
+ # Resolve paths for classification
155
+ files = [Path(f).resolve() for f in files]
156
+
157
+ # 1. Identify Environment Locations
158
+ from ..commands.helpers import get_python_executable, get_venv_site_packages
159
+
160
+ python_exe = get_python_executable()
161
+ site_packages = get_venv_site_packages(python_exe).resolve()
162
+
163
+ # Project Root
164
+ project_root = context.script_dir.resolve()
165
+
166
+ # Destination for libraries
167
+ lib_dir = context.dist_dir / "libs"
168
+ lib_dir.mkdir(parents=True, exist_ok=True)
169
+
170
+ count = 0
171
+ copied_roots = set()
172
+
173
+ for f in files:
174
+ if not f.exists() or f.is_dir():
175
+ continue
176
+
177
+ # A. Site Packages (Third Party)
178
+ if site_packages in f.parents:
179
+ rel = f.relative_to(site_packages)
180
+ dest = lib_dir / rel
181
+
182
+ # Handling __pycache__: Skip
183
+ if "__pycache__" in dest.parts:
184
+ continue
185
+
186
+ dest.parent.mkdir(parents=True, exist_ok=True)
187
+ shutil.copy2(f, dest)
188
+ count += 1
189
+ copied_roots.add(rel.parts[0])
190
+ continue
191
+
192
+ # B. Project Code (User Scripts)
193
+ if project_root in f.parents:
194
+ # Don't copy the VEP script (it's compiled to app.pyd)
195
+ if f == context.script.resolve():
196
+ continue
197
+ # Don't copy Crystal runner artifacts
198
+ if f.name in [
199
+ "crystal_runner.py",
200
+ "crystal_manifest.json",
201
+ "_virtual_root.py",
202
+ ]:
203
+ continue
204
+
205
+ rel = f.relative_to(project_root)
206
+ dest = lib_dir / rel # We treat user code as library to keep root clean
207
+
208
+ if "__pycache__" in dest.parts:
209
+ continue
210
+
211
+ dest.parent.mkdir(parents=True, exist_ok=True)
212
+ shutil.copy2(f, dest)
213
+ count += 1
214
+ continue
215
+
216
+ # C. Standard Library
217
+ # We ignore files in base_prefix (e.g. C:\Python39\Lib\...) because we will rely on pythonXX.zip
218
+
219
+ log(f"Assembled {count} dependency files into dist/libs", style="success")
220
+ log(f"Roots captured: {', '.join(list(copied_roots)[:10])}", style="dim")
221
+
222
+ # 4. Deploy Runtime
223
+ self._deploy_python_runtime(context, python_exe)
224
+
225
+ def _deploy_python_runtime(self, context: BuildContext, python_exe: str):
226
+ """
227
+ Deploys python DLLs and Standard Library (minimal).
228
+ """
229
+ log("Deploying Python Runtime...", style="dim")
230
+
231
+ # Find Python DLLs
232
+ # usually next to python executable or in system
233
+ py_root = Path(python_exe).parent
234
+
235
+ # Copy DLLs (python3.dll, python311.dll, etc)
236
+ for f in py_root.glob("python*.dll"):
237
+ shutil.copy2(f, context.dist_dir / f.name)
238
+
239
+ # Copy Standard Lib Zip if exists
240
+ # Many embedded distributions have python3x.zip
241
+ found_zip = False
242
+ for f in py_root.glob("python*.zip"):
243
+ shutil.copy2(f, context.dist_dir / f.name)
244
+ found_zip = True
245
+
246
+ if not found_zip:
247
+ log(
248
+ "Warning: pythonXX.zip not found. Bundling 'Lib' folder may be required for StdLib.",
249
+ style="warning",
250
+ )
251
+ # In a full venv, we might need to copy Lib excluding site-packages
252
+ # For this "Pure" implementation, strictly we'd unzip or copy.
253
+ # To keep it safe, let's copy the Lib folder to dist/Lib if zip is missing
254
+ try:
255
+ sys_lib = py_root / "Lib"
256
+ if sys_lib.exists():
257
+ dest_lib = context.dist_dir / "Lib"
258
+ log(f"Copying Standard Library from {sys_lib}...", style="dim")
259
+ # Copy everything EXCEPT site-packages and test
260
+ shutil.copytree(
261
+ sys_lib,
262
+ dest_lib,
263
+ ignore=shutil.ignore_patterns(
264
+ "site-packages", "test", "__pycache__"
265
+ ),
266
+ )
267
+ except Exception as e:
268
+ log(f"Failed to copy StdLib: {e}", style="error")
269
+
270
+ # --- Helpers (Migrated from secure.py) ---
271
+
272
+ # --- Helpers ---
273
+ # Compilation logic moved to pytron.pack.compilers