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.
- pytron/__init__.py +112 -0
- pytron/application.py +562 -0
- pytron/apputils/__init__.py +0 -0
- pytron/apputils/chrome_ipc.py +203 -0
- pytron/apputils/codegen.py +261 -0
- pytron/apputils/config.py +303 -0
- pytron/apputils/deadmansswitch.py +47 -0
- pytron/apputils/extras.py +76 -0
- pytron/apputils/native.py +148 -0
- pytron/apputils/shell.py +73 -0
- pytron/apputils/windows.py +286 -0
- pytron/cli.py +384 -0
- pytron/commands/__init__.py +0 -0
- pytron/commands/android.py +28 -0
- pytron/commands/build.py +26 -0
- pytron/commands/doctor.py +221 -0
- pytron/commands/engine.py +23 -0
- pytron/commands/frontend.py +60 -0
- pytron/commands/harvest.py +112 -0
- pytron/commands/helpers.py +239 -0
- pytron/commands/info.py +50 -0
- pytron/commands/init.py +521 -0
- pytron/commands/install.py +294 -0
- pytron/commands/login.py +130 -0
- pytron/commands/package.py +228 -0
- pytron/commands/plugin.py +442 -0
- pytron/commands/run.py +312 -0
- pytron/commands/scan.py +210 -0
- pytron/commands/show.py +23 -0
- pytron/commands/uninstall.py +150 -0
- pytron/commands/utils.py +42 -0
- pytron/commands/workflow.py +95 -0
- pytron/console.py +133 -0
- pytron/core.py +18 -0
- pytron/dependencies/WebView2Loader.dll +0 -0
- pytron/dependencies/__init__.py +1 -0
- pytron/dependencies/pytron_native.so +0 -0
- pytron/engines/chrome/adapter.py +445 -0
- pytron/engines/chrome/engine.py +576 -0
- pytron/engines/chrome/forge.py +147 -0
- pytron/engines/chrome/shell/package.json +8 -0
- pytron/engines/chrome/shell/preload.js +12 -0
- pytron/engines/chrome/shell/shell.js +534 -0
- pytron/exceptions.py +36 -0
- pytron/inspector.py +201 -0
- pytron/inspector_ui.py +512 -0
- pytron/installer/Installation.nsi +236 -0
- pytron/installer/header.bmp +0 -0
- pytron/installer/pytron.ico +0 -0
- pytron/installer/sidebar.bmp +0 -0
- pytron/llms.md +98 -0
- pytron/manifests/README.md +29 -0
- pytron/manifests/windows-utf8.manifest +44 -0
- pytron/menu.py +128 -0
- pytron/nsis-setup.exe +0 -0
- pytron/pack/__init__.py +0 -0
- pytron/pack/assets.py +131 -0
- pytron/pack/compilers.py +289 -0
- pytron/pack/crystal.py +297 -0
- pytron/pack/graph.py +377 -0
- pytron/pack/inference.py +157 -0
- pytron/pack/installers.py +402 -0
- pytron/pack/introspect.py +357 -0
- pytron/pack/metadata.py +213 -0
- pytron/pack/modules.py +618 -0
- pytron/pack/nuitka.py +108 -0
- pytron/pack/pipeline.py +107 -0
- pytron/pack/pyinstaller.py +176 -0
- pytron/pack/rust_engine.py +273 -0
- pytron/pack/secure.py +309 -0
- pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
- pytron/pack/secure_loader/icon.ico +0 -0
- pytron/pack/utils.py +110 -0
- pytron/pack/virtual_root.py +124 -0
- pytron/platforms/__init__.py +0 -0
- pytron/platforms/android/__init__.py +3 -0
- pytron/platforms/android/android.py +103 -0
- pytron/platforms/android/builder.py +736 -0
- pytron/platforms/android/ops/build.py +79 -0
- pytron/platforms/android/ops/init.py +63 -0
- pytron/platforms/android/ops/run.py +79 -0
- pytron/platforms/android/ops/sync.py +770 -0
- pytron/platforms/android/ops/utils.py +8 -0
- pytron/platforms/android/shell/README.md +30 -0
- pytron/platforms/android/shell/app/build.gradle +64 -0
- pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
- pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
- pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
- pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
- pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- pytron/platforms/android/shell/build.gradle +11 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
- pytron/platforms/android/shell/gradle.properties +2 -0
- pytron/platforms/android/shell/gradlew.bat +85 -0
- pytron/platforms/android/shell/settings.gradle +16 -0
- pytron/platforms/darwin.py +82 -0
- pytron/platforms/darwin_ops/libs.py +31 -0
- pytron/platforms/darwin_ops/system.py +182 -0
- pytron/platforms/darwin_ops/utils.py +85 -0
- pytron/platforms/darwin_ops/webview.py +5 -0
- pytron/platforms/darwin_ops/window.py +102 -0
- pytron/platforms/interface.py +152 -0
- pytron/platforms/linux.py +82 -0
- pytron/platforms/linux_ops/libs.py +49 -0
- pytron/platforms/linux_ops/system.py +316 -0
- pytron/platforms/linux_ops/utils.py +19 -0
- pytron/platforms/linux_ops/webview.py +5 -0
- pytron/platforms/linux_ops/window.py +115 -0
- pytron/platforms/windows.py +136 -0
- pytron/platforms/windows_ops/__init__.py +0 -0
- pytron/platforms/windows_ops/constants.py +126 -0
- pytron/platforms/windows_ops/system.py +518 -0
- pytron/platforms/windows_ops/utils.py +3 -0
- pytron/platforms/windows_ops/webview.py +5 -0
- pytron/platforms/windows_ops/window.py +361 -0
- pytron/plugin.py +467 -0
- pytron/rcedit-x64.exe +0 -0
- pytron/router.py +146 -0
- pytron/serializer.py +240 -0
- pytron/shortcuts.py +279 -0
- pytron/state.py +76 -0
- pytron/tray.py +399 -0
- pytron/updater.py +181 -0
- pytron/utf8_hook.py +112 -0
- pytron/utils.py +44 -0
- pytron/webview.py +722 -0
- pytron_kit-0.3.12.dist-info/METADATA +131 -0
- pytron_kit-0.3.12.dist-info/RECORD +419 -0
- pytron_kit-0.3.12.dist-info/WHEEL +5 -0
- pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
- pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
- pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
pytron/pack/modules.py
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
import shutil
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from .pipeline import BuildModule, BuildContext
|
|
7
|
+
from ..console import log, console
|
|
8
|
+
from .assets import get_smart_assets
|
|
9
|
+
from .metadata import MetadataEditor
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AssetModule(BuildModule):
|
|
13
|
+
def prepare(self, context: BuildContext):
|
|
14
|
+
log("Gathering project assets...", style="dim")
|
|
15
|
+
|
|
16
|
+
# 1. settings.json
|
|
17
|
+
settings_path = context.script_dir / "settings.json"
|
|
18
|
+
if settings_path.exists():
|
|
19
|
+
# Force debug=False and requested engine for production
|
|
20
|
+
clean_settings = context.settings.copy()
|
|
21
|
+
if clean_settings.get("debug") is True:
|
|
22
|
+
clean_settings["debug"] = False
|
|
23
|
+
|
|
24
|
+
# If the user packaged for a specific engine, force it in the config
|
|
25
|
+
if context.engine:
|
|
26
|
+
clean_settings["engine"] = context.engine
|
|
27
|
+
log(
|
|
28
|
+
f"Enforcing engine: {context.engine} in production bundle",
|
|
29
|
+
style="dim",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
temp_settings_dir = context.build_dir / "pytron_assets"
|
|
33
|
+
temp_settings_dir.mkdir(parents=True, exist_ok=True)
|
|
34
|
+
temp_settings_path = temp_settings_dir / "settings.json"
|
|
35
|
+
temp_settings_path.write_text(json.dumps(clean_settings, indent=4))
|
|
36
|
+
|
|
37
|
+
context.add_data.append(f"{temp_settings_path}{os.pathsep}.")
|
|
38
|
+
|
|
39
|
+
# 2. Frontend Dist
|
|
40
|
+
possible_dists = [
|
|
41
|
+
context.script_dir / "frontend" / "dist",
|
|
42
|
+
context.script_dir / "frontend" / "build",
|
|
43
|
+
]
|
|
44
|
+
frontend_dist = None
|
|
45
|
+
for d in possible_dists:
|
|
46
|
+
if d.exists() and d.is_dir():
|
|
47
|
+
frontend_dist = d
|
|
48
|
+
break
|
|
49
|
+
|
|
50
|
+
if frontend_dist:
|
|
51
|
+
rel_path = frontend_dist.relative_to(context.script_dir)
|
|
52
|
+
context.add_data.append(f"{frontend_dist}{os.pathsep}{rel_path}")
|
|
53
|
+
|
|
54
|
+
# 3. Smart Assets
|
|
55
|
+
# (This is a simplified version of what was in package.py)
|
|
56
|
+
if getattr(context, "smart_assets", False):
|
|
57
|
+
try:
|
|
58
|
+
smart = get_smart_assets(
|
|
59
|
+
context.script_dir,
|
|
60
|
+
frontend_dist=frontend_dist,
|
|
61
|
+
include_patterns=context.settings.get("include_patterns"),
|
|
62
|
+
exclude_patterns=context.settings.get("exclude_patterns"),
|
|
63
|
+
)
|
|
64
|
+
if smart:
|
|
65
|
+
context.add_data.extend(smart)
|
|
66
|
+
except Exception as e:
|
|
67
|
+
log(f"Warning: Smart assets failed: {e}", style="warning")
|
|
68
|
+
|
|
69
|
+
# 4. Mandatory Resources Folder
|
|
70
|
+
resources_path = context.script_dir / "resources"
|
|
71
|
+
if resources_path.exists() and resources_path.is_dir():
|
|
72
|
+
log(f"Bundling mandatory resources: {resources_path.name}", style="dim")
|
|
73
|
+
context.add_data.append(f"{resources_path}{os.pathsep}resources")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class EngineModule(BuildModule):
|
|
77
|
+
def prepare(self, context: BuildContext):
|
|
78
|
+
if context.engine != "chrome":
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
log(f"Configuring {context.engine} engine...", style="dim")
|
|
82
|
+
|
|
83
|
+
# Global engine path
|
|
84
|
+
global_engine_path = Path.home() / ".pytron" / "engines" / "chrome"
|
|
85
|
+
if global_engine_path.exists():
|
|
86
|
+
log(f"Auto-bundling Chrome Engine binaries", style="dim")
|
|
87
|
+
# Bundle into pytron/dependencies/chrome
|
|
88
|
+
dest_dep = os.path.join("pytron", "dependencies", "chrome")
|
|
89
|
+
context.add_data.append(f"{global_engine_path}{os.pathsep}{dest_dep}")
|
|
90
|
+
|
|
91
|
+
# Bundle shell source
|
|
92
|
+
shell_src = context.package_dir / "pytron" / "engines" / "chrome" / "shell"
|
|
93
|
+
if shell_src.exists():
|
|
94
|
+
shell_dest = os.path.join("pytron", "engines", "chrome", "shell")
|
|
95
|
+
context.add_data.append(f"{shell_src}{os.pathsep}{shell_dest}")
|
|
96
|
+
else:
|
|
97
|
+
log(
|
|
98
|
+
"Error: Chrome engine not found. Run 'pytron engine install chrome'",
|
|
99
|
+
style="error",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def post_build(self, context: BuildContext):
|
|
103
|
+
if context.engine != "chrome" or sys.platform != "win32":
|
|
104
|
+
return
|
|
105
|
+
|
|
106
|
+
# Refactored Chrome Engine renaming/patching
|
|
107
|
+
engine_exe = context.dist_dir / "pytron" / "engines" / "chrome" / "electron.exe"
|
|
108
|
+
target_name = f"{context.out_name}.exe"
|
|
109
|
+
renamed_exe = engine_exe.parent / target_name
|
|
110
|
+
|
|
111
|
+
if engine_exe.exists():
|
|
112
|
+
log(f"Patching engine binary: {target_name}", style="dim")
|
|
113
|
+
if renamed_exe.exists():
|
|
114
|
+
os.remove(renamed_exe)
|
|
115
|
+
os.rename(engine_exe, renamed_exe)
|
|
116
|
+
|
|
117
|
+
# Apply metadata to the renamed electron binary
|
|
118
|
+
editor = MetadataEditor(package_dir=context.package_dir)
|
|
119
|
+
editor.update(renamed_exe, context.app_icon, context.settings)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class MetadataModule(BuildModule):
|
|
123
|
+
def post_build(self, context: BuildContext):
|
|
124
|
+
log("Applying application metadata...", style="dim")
|
|
125
|
+
main_exe_name = (
|
|
126
|
+
f"{context.out_name}.exe" if sys.platform == "win32" else context.out_name
|
|
127
|
+
)
|
|
128
|
+
main_exe = context.dist_dir / main_exe_name
|
|
129
|
+
|
|
130
|
+
if main_exe.exists():
|
|
131
|
+
editor = MetadataEditor(package_dir=context.package_dir)
|
|
132
|
+
editor.update(
|
|
133
|
+
main_exe, context.app_icon, context.settings, dist_dir=context.dist_dir
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class InstallerModule(BuildModule):
|
|
138
|
+
def post_build(self, context: BuildContext):
|
|
139
|
+
if not getattr(context, "build_installer", False):
|
|
140
|
+
return
|
|
141
|
+
|
|
142
|
+
log("Building NSIS installer...", style="info")
|
|
143
|
+
context.progress.update(
|
|
144
|
+
context.task_id, description="Building Installer...", completed=90
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
from .installers import build_installer
|
|
148
|
+
|
|
149
|
+
ret_code = build_installer(
|
|
150
|
+
context.out_name, context.script_dir, context.app_icon
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
if ret_code != 0:
|
|
154
|
+
log("Installer build failed.", style="error")
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class PluginModule(BuildModule):
|
|
158
|
+
def prepare(self, context: BuildContext):
|
|
159
|
+
from ..plugin import discover_plugins
|
|
160
|
+
|
|
161
|
+
plugins_dir_name = "plugins"
|
|
162
|
+
plugins_path = context.script_dir / plugins_dir_name
|
|
163
|
+
|
|
164
|
+
# Respect custom plugins_dir from settings
|
|
165
|
+
custom_plugins_dir = context.settings.get("plugins_dir")
|
|
166
|
+
if custom_plugins_dir:
|
|
167
|
+
# Resolve relative to script dir
|
|
168
|
+
plugins_path = context.script_dir / custom_plugins_dir
|
|
169
|
+
plugins_dir_name = Path(custom_plugins_dir).name
|
|
170
|
+
|
|
171
|
+
if not plugins_path.exists():
|
|
172
|
+
return
|
|
173
|
+
|
|
174
|
+
# Automatically bundle the plugins directory
|
|
175
|
+
log(f"Bundling plugins directory: {plugins_path.name}", style="dim")
|
|
176
|
+
# Always bundle into 'plugins' at root of dist so App can find them easily
|
|
177
|
+
context.add_data.append(f"{plugins_path}{os.pathsep}plugins")
|
|
178
|
+
|
|
179
|
+
log("Evaluating plugins for packaging hooks...", style="dim")
|
|
180
|
+
plugin_objs = discover_plugins(str(plugins_path))
|
|
181
|
+
|
|
182
|
+
# Robust mock app for hook context
|
|
183
|
+
class MockObject:
|
|
184
|
+
def __call__(self, *args, **kwargs):
|
|
185
|
+
return self
|
|
186
|
+
|
|
187
|
+
def __iter__(self):
|
|
188
|
+
return iter([])
|
|
189
|
+
|
|
190
|
+
def __bool__(self):
|
|
191
|
+
return False
|
|
192
|
+
|
|
193
|
+
def __getattr__(self, name):
|
|
194
|
+
return self
|
|
195
|
+
|
|
196
|
+
def __getitem__(self, key):
|
|
197
|
+
return self
|
|
198
|
+
|
|
199
|
+
def __len__(self):
|
|
200
|
+
return 0
|
|
201
|
+
|
|
202
|
+
def to_dict(self):
|
|
203
|
+
return {}
|
|
204
|
+
|
|
205
|
+
class PackageAppMock:
|
|
206
|
+
def __init__(self, settings_data, folder):
|
|
207
|
+
self.config = settings_data
|
|
208
|
+
self.app_root = folder
|
|
209
|
+
self.storage_path = str(folder / "build" / "storage")
|
|
210
|
+
self.logger = log
|
|
211
|
+
self.state = MockObject()
|
|
212
|
+
|
|
213
|
+
def __getattr__(self, name):
|
|
214
|
+
return MockObject()
|
|
215
|
+
|
|
216
|
+
def expose(self, *args, **kwargs):
|
|
217
|
+
pass
|
|
218
|
+
|
|
219
|
+
def broadcast(self, *args, **kwargs):
|
|
220
|
+
pass
|
|
221
|
+
|
|
222
|
+
def publish(self, *args, **kwargs):
|
|
223
|
+
pass
|
|
224
|
+
|
|
225
|
+
def on_exit(self, func):
|
|
226
|
+
return func
|
|
227
|
+
|
|
228
|
+
mock_app = PackageAppMock(context.settings, context.script_dir)
|
|
229
|
+
|
|
230
|
+
# Build context for plugins to modify
|
|
231
|
+
package_context = {
|
|
232
|
+
"add_data": context.add_data,
|
|
233
|
+
"hidden_imports": context.hidden_imports,
|
|
234
|
+
"binaries": context.binaries,
|
|
235
|
+
"extra_args": context.extra_args,
|
|
236
|
+
"script": context.script,
|
|
237
|
+
"out_name": context.out_name,
|
|
238
|
+
"settings": context.settings,
|
|
239
|
+
"package_dir": context.package_dir,
|
|
240
|
+
"app_icon": context.app_icon,
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
for p in plugin_objs:
|
|
244
|
+
try:
|
|
245
|
+
# 1. Load Plugin for Hooks
|
|
246
|
+
p.load(mock_app)
|
|
247
|
+
p.invoke_package_hook(package_context)
|
|
248
|
+
|
|
249
|
+
# 2. Auto-Harvest Dependencies (Crucial for Frozen Apps)
|
|
250
|
+
# Since plugin code is loaded dynamically, PyInstaller won't see its imports.
|
|
251
|
+
# We must explicitly tell it to bundle the declared dependencies.
|
|
252
|
+
deps = p.python_dependencies
|
|
253
|
+
if deps:
|
|
254
|
+
log(
|
|
255
|
+
f" + Auto-injecting dependencies for {p.name}: {deps}",
|
|
256
|
+
style="dim",
|
|
257
|
+
)
|
|
258
|
+
package_context["hidden_imports"].extend(deps)
|
|
259
|
+
|
|
260
|
+
except Exception as e:
|
|
261
|
+
log(
|
|
262
|
+
f"Warning: Build analysis for plugin '{p.name}' failed: {e}",
|
|
263
|
+
style="warning",
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
# Sync back modified values
|
|
267
|
+
context.out_name = package_context["out_name"]
|
|
268
|
+
context.app_icon = package_context["app_icon"]
|
|
269
|
+
context.settings = package_context["settings"]
|
|
270
|
+
log(f"Build context updated by plugins", style="dim")
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class HookModule(BuildModule):
|
|
274
|
+
def prepare(self, context: BuildContext):
|
|
275
|
+
# Enable if:
|
|
276
|
+
# 1. --collect-all or --force-hooks CLI flag
|
|
277
|
+
# 2. "force_hooks": true in settings.json
|
|
278
|
+
should_run = (
|
|
279
|
+
getattr(context, "collect_all", False)
|
|
280
|
+
or getattr(context, "force_hooks", False)
|
|
281
|
+
or context.settings.get("force_hooks", False)
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
if not should_run:
|
|
285
|
+
return
|
|
286
|
+
|
|
287
|
+
from .pipeline import log
|
|
288
|
+
from ..commands.harvest import generate_nuclear_hooks
|
|
289
|
+
from ..commands.helpers import get_python_executable, get_venv_site_packages
|
|
290
|
+
|
|
291
|
+
log("Generating nuclear build hooks...", style="info")
|
|
292
|
+
temp_hooks_dir = context.build_dir / "nuclear_hooks"
|
|
293
|
+
temp_hooks_dir.mkdir(parents=True, exist_ok=True)
|
|
294
|
+
|
|
295
|
+
python_exe = get_python_executable()
|
|
296
|
+
site_packages = get_venv_site_packages(python_exe)
|
|
297
|
+
|
|
298
|
+
collect_mode = getattr(context, "collect_all", False)
|
|
299
|
+
|
|
300
|
+
# Check for requirements.json to seed the whitelist
|
|
301
|
+
whitelist = None
|
|
302
|
+
req_file = context.script_dir / "requirements.json"
|
|
303
|
+
|
|
304
|
+
# If the user explicitly requested force_hooks without a list,
|
|
305
|
+
# or if they have collecting all mode on, we might default to everything (blacklist only).
|
|
306
|
+
# BUT, if requirements.json exists, we should probably use it to be smarter.
|
|
307
|
+
|
|
308
|
+
# NOTE: The user asked to use requirements.json specifically to "hard do hidden imports".
|
|
309
|
+
# So we prioritize that if it exists.
|
|
310
|
+
|
|
311
|
+
if req_file.exists():
|
|
312
|
+
# Check for Crystal Mode (Dynamic Audit)
|
|
313
|
+
crystal_active = context.settings.get("crystal_mode", False)
|
|
314
|
+
|
|
315
|
+
# --- VIRTUAL ENTRY POINT (VEP) GENERATION ---
|
|
316
|
+
# If enabled, we generate a synthetic root based on app.expose
|
|
317
|
+
use_vep = context.settings.get(
|
|
318
|
+
"virtual_entry_point", True
|
|
319
|
+
) # Default to True for Crystal users
|
|
320
|
+
|
|
321
|
+
if crystal_active and use_vep:
|
|
322
|
+
try:
|
|
323
|
+
from .virtual_root import VirtualRootGenerator
|
|
324
|
+
|
|
325
|
+
vep_gen = VirtualRootGenerator(context.script_dir)
|
|
326
|
+
vep_gen.scan()
|
|
327
|
+
|
|
328
|
+
# Generate VEP file
|
|
329
|
+
vep_path = context.script_dir / "_virtual_root.py"
|
|
330
|
+
vep_gen.generate(vep_path)
|
|
331
|
+
|
|
332
|
+
# CRITICAL: Switch the context script to the VEP!
|
|
333
|
+
# This means audit AND build will focus on this file.
|
|
334
|
+
log(
|
|
335
|
+
f"Switched build target to Virtual Entry Point: {vep_path.name}",
|
|
336
|
+
style="warning",
|
|
337
|
+
)
|
|
338
|
+
context.script = vep_path
|
|
339
|
+
|
|
340
|
+
except Exception as e:
|
|
341
|
+
log(f"VEP Generation Failed: {e}", style="warning")
|
|
342
|
+
|
|
343
|
+
if crystal_active:
|
|
344
|
+
try:
|
|
345
|
+
# UX: Warn the user that we are about to execute their code
|
|
346
|
+
from rich.prompt import Confirm
|
|
347
|
+
|
|
348
|
+
log(
|
|
349
|
+
"[bold yellow]Crystal Mode Activated[/bold yellow]",
|
|
350
|
+
style="none",
|
|
351
|
+
)
|
|
352
|
+
console.print(
|
|
353
|
+
"Pytron needs to [bold red]EXECUTE[/bold red] your application to map the true dependency graph."
|
|
354
|
+
)
|
|
355
|
+
console.print(
|
|
356
|
+
"This ensures 100% accuracy but requires trust in the code you are packaging."
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
if Confirm.ask("Proceed with execution audit?", default=True):
|
|
360
|
+
from .crystal import AppAuditor
|
|
361
|
+
|
|
362
|
+
auditor = AppAuditor(context.script)
|
|
363
|
+
manifest = auditor.run_audit()
|
|
364
|
+
else:
|
|
365
|
+
log(
|
|
366
|
+
"Audit skipped by user. Dependency detection may be incomplete.",
|
|
367
|
+
style="warning",
|
|
368
|
+
)
|
|
369
|
+
manifest = None
|
|
370
|
+
|
|
371
|
+
if manifest:
|
|
372
|
+
live_modules = manifest.get("modules", [])
|
|
373
|
+
live_files = manifest.get("files", [])
|
|
374
|
+
|
|
375
|
+
log(
|
|
376
|
+
f"Crystal Manifest Loaded: {len(live_modules)} modules confirmed alive.",
|
|
377
|
+
style="info",
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
# Feed the Truth to PyInstaller
|
|
381
|
+
# 1. Hidden Imports: Anything audit saw that isn't statically obvious
|
|
382
|
+
# We just dump everything into hidden imports to be safe?
|
|
383
|
+
# Or checking "top level" vs "submodule".
|
|
384
|
+
# Safest is to ensure top-level packages are collected.
|
|
385
|
+
|
|
386
|
+
# Also check for known tough guys in the live list
|
|
387
|
+
audit_flags = []
|
|
388
|
+
for mod in live_modules:
|
|
389
|
+
# If we see skimage.feature._texture, we ensure 'skimage' is collected
|
|
390
|
+
root = mod.split(".")[0]
|
|
391
|
+
# Simple heuristic: if we see a module loaded, we can hint PyInstaller
|
|
392
|
+
# context.hidden_imports.append(mod)
|
|
393
|
+
# However, adding 5000 hidden imports might be slow.
|
|
394
|
+
pass
|
|
395
|
+
|
|
396
|
+
# For now, let's keep the Intelligent Introspection (Smart Harvest) running
|
|
397
|
+
# as it's cleaner for flags, but let's use the Audit to VALIDATE or AUGMENT it.
|
|
398
|
+
|
|
399
|
+
# Specifically for the user's issue:
|
|
400
|
+
# If 'skimage' was seen in audit, we force collect it.
|
|
401
|
+
seen_roots = {m.split(".")[0] for m in live_modules}
|
|
402
|
+
for root in seen_roots:
|
|
403
|
+
# If it matches a complex package, force collect
|
|
404
|
+
if root in [
|
|
405
|
+
"skimage",
|
|
406
|
+
"pandas",
|
|
407
|
+
"numpy",
|
|
408
|
+
"scipy",
|
|
409
|
+
"torch",
|
|
410
|
+
"cv2",
|
|
411
|
+
]:
|
|
412
|
+
flag = f"--collect-all={root}"
|
|
413
|
+
if flag not in context.extra_args:
|
|
414
|
+
context.extra_args.append(flag)
|
|
415
|
+
log(
|
|
416
|
+
f"Crystal Audit: Saw {root} running -> Enforcing {flag}",
|
|
417
|
+
style="success",
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
except Exception as e:
|
|
421
|
+
log(f"Crystal Audit Failed: {e}", style="warning")
|
|
422
|
+
|
|
423
|
+
# Use Intelligent Introspection (AI Oracle)
|
|
424
|
+
try:
|
|
425
|
+
from .graph import GraphBuilder, DependencyOracle
|
|
426
|
+
|
|
427
|
+
log("Spawning Dependency Oracle (ML Brain)...", style="info")
|
|
428
|
+
builder = GraphBuilder(context.script_dir)
|
|
429
|
+
graph = builder.scan_project()
|
|
430
|
+
|
|
431
|
+
oracle = DependencyOracle(graph)
|
|
432
|
+
oracle.predict()
|
|
433
|
+
|
|
434
|
+
smart_flags = []
|
|
435
|
+
|
|
436
|
+
# Convert Graph Predictions to PyInstaller Flags
|
|
437
|
+
for edge in graph.edges:
|
|
438
|
+
if edge.type == "predicted":
|
|
439
|
+
# Handle different prediction types
|
|
440
|
+
if edge.target.endswith(".*"):
|
|
441
|
+
# Wildcard -> Collect Submodules
|
|
442
|
+
pkg = edge.target[:-2]
|
|
443
|
+
flag = f"--collect-submodules={pkg}"
|
|
444
|
+
smart_flags.append(flag)
|
|
445
|
+
elif edge.target == "<resource_data>":
|
|
446
|
+
# Generic Data -> Collect All (Safest for now)
|
|
447
|
+
pkg = edge.source.split(".")[
|
|
448
|
+
0
|
|
449
|
+
] # Assuming source is module name
|
|
450
|
+
flag = f"--collect-all={pkg}"
|
|
451
|
+
smart_flags.append(flag)
|
|
452
|
+
elif edge.target.startswith("collect_"):
|
|
453
|
+
# Oracle explicit instruction "collect_all:pkg" etc
|
|
454
|
+
# But our edge target usually is just the dependency
|
|
455
|
+
pass
|
|
456
|
+
else:
|
|
457
|
+
# Standard hidden import
|
|
458
|
+
flag = f"--hidden-import={edge.target}"
|
|
459
|
+
smart_flags.append(flag)
|
|
460
|
+
|
|
461
|
+
# Deduplicate
|
|
462
|
+
smart_flags = list(set(smart_flags))
|
|
463
|
+
|
|
464
|
+
if smart_flags:
|
|
465
|
+
log(
|
|
466
|
+
f"Oracle: Predicted {len(smart_flags)} missing dependencies.",
|
|
467
|
+
style="success",
|
|
468
|
+
)
|
|
469
|
+
for f in smart_flags:
|
|
470
|
+
log(f" + {f}", style="dim")
|
|
471
|
+
context.extra_args.extend(smart_flags)
|
|
472
|
+
|
|
473
|
+
# We can still pass the whitelist to the nuclear hook generator if we want absolute redundancy,
|
|
474
|
+
# but --collect-all usually supersedes hook generation for specific packages.
|
|
475
|
+
# However, for non-collect-all packages, the hook generator is still useful for standard hidden imports.
|
|
476
|
+
|
|
477
|
+
# Let's rebuild the whitelist for the hook generator (standard safe fallback)
|
|
478
|
+
import json
|
|
479
|
+
|
|
480
|
+
if req_file.exists():
|
|
481
|
+
data = json.loads(req_file.read_text())
|
|
482
|
+
deps = data.get("dependencies", [])
|
|
483
|
+
if deps:
|
|
484
|
+
whitelist = set()
|
|
485
|
+
for d in deps:
|
|
486
|
+
clean = d.split("==")[0].split(">")[0].split("<")[0].strip()
|
|
487
|
+
if "/" not in clean and "\\" not in clean and clean:
|
|
488
|
+
whitelist.add(clean)
|
|
489
|
+
whitelist = list(whitelist)
|
|
490
|
+
except Exception as e:
|
|
491
|
+
log(f"Oracle prediction failed: {e}", style="warning")
|
|
492
|
+
|
|
493
|
+
generate_nuclear_hooks(
|
|
494
|
+
temp_hooks_dir,
|
|
495
|
+
collect_all_mode=collect_mode,
|
|
496
|
+
search_path=site_packages,
|
|
497
|
+
whitelist=whitelist,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
# PyInstaller expects hook paths. We'll pass it via extra_args or a dedicated field.
|
|
501
|
+
# For now, let's add it to extra_args for PyInstaller.
|
|
502
|
+
context.extra_args.append(f"--additional-hooks-dir={temp_hooks_dir}")
|
|
503
|
+
log(f"Added nuclear hooks dir: {temp_hooks_dir}", style="dim")
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
class IconModule(BuildModule):
|
|
507
|
+
"""
|
|
508
|
+
Handles icon resolution and high-quality conversion.
|
|
509
|
+
Ensures that PNGs are converted to multi-size high-res ICO/ICNS.
|
|
510
|
+
"""
|
|
511
|
+
|
|
512
|
+
def prepare(self, context: BuildContext):
|
|
513
|
+
icon_path = context.app_icon
|
|
514
|
+
|
|
515
|
+
# 1. Fallback to settings if not provided in CLI
|
|
516
|
+
if not icon_path:
|
|
517
|
+
config_icon = context.settings.get("icon")
|
|
518
|
+
if config_icon:
|
|
519
|
+
possible = context.script_dir / config_icon
|
|
520
|
+
if possible.exists():
|
|
521
|
+
icon_path = str(possible)
|
|
522
|
+
|
|
523
|
+
# 2. Hard fallback to Pytron default
|
|
524
|
+
if not icon_path:
|
|
525
|
+
pytron_icon = context.package_dir / "pytron" / "installer" / "pytron.ico"
|
|
526
|
+
if pytron_icon.exists():
|
|
527
|
+
icon_path = str(pytron_icon)
|
|
528
|
+
|
|
529
|
+
if not icon_path or not os.path.exists(icon_path):
|
|
530
|
+
log(
|
|
531
|
+
"Warning: No app icon found. Using generic executable icon.",
|
|
532
|
+
style="warning",
|
|
533
|
+
)
|
|
534
|
+
return
|
|
535
|
+
|
|
536
|
+
icon_path = Path(icon_path)
|
|
537
|
+
|
|
538
|
+
# 3. High-Res Conversion & Platform Specifics
|
|
539
|
+
if icon_path.suffix.lower() == ".png":
|
|
540
|
+
try:
|
|
541
|
+
from PIL import Image
|
|
542
|
+
|
|
543
|
+
log(f"Processing high-resolution icon: {icon_path.name}", style="dim")
|
|
544
|
+
img = Image.open(icon_path)
|
|
545
|
+
|
|
546
|
+
# --- Windows (ICO) ---
|
|
547
|
+
if (
|
|
548
|
+
sys.platform == "win32" or True
|
|
549
|
+
): # Generate ICO as a general fallback
|
|
550
|
+
ico_dir = context.build_dir / "icons"
|
|
551
|
+
ico_dir.mkdir(parents=True, exist_ok=True)
|
|
552
|
+
ico_path = ico_dir / f"{context.out_name}.ico"
|
|
553
|
+
|
|
554
|
+
sizes = [256, 128, 64, 48, 32, 16]
|
|
555
|
+
icon_images = []
|
|
556
|
+
resample = getattr(Image, "Resampling", Image).LANCZOS
|
|
557
|
+
for s in sizes:
|
|
558
|
+
if img.width >= s:
|
|
559
|
+
icon_images.append(img.resize((s, s), resample=resample))
|
|
560
|
+
|
|
561
|
+
if icon_images:
|
|
562
|
+
# Save with PNG compression for the 256px layer
|
|
563
|
+
icon_images[0].save(
|
|
564
|
+
ico_path,
|
|
565
|
+
format="ICO",
|
|
566
|
+
append_images=icon_images[1:],
|
|
567
|
+
bitmap_format=(
|
|
568
|
+
"png" if icon_images[0].width >= 256 else "bmp"
|
|
569
|
+
),
|
|
570
|
+
)
|
|
571
|
+
if sys.platform == "win32":
|
|
572
|
+
context.app_icon = str(ico_path.resolve())
|
|
573
|
+
|
|
574
|
+
# --- macOS (ICNS) ---
|
|
575
|
+
if sys.platform == "darwin":
|
|
576
|
+
icns_path = ico_dir / f"{context.out_name}.icns"
|
|
577
|
+
try:
|
|
578
|
+
# Pillow supports ICNS saving
|
|
579
|
+
img.save(icns_path, format="ICNS")
|
|
580
|
+
context.app_icon = str(icns_path.resolve())
|
|
581
|
+
log(f"Generated high-res ICNS for macOS", style="dim")
|
|
582
|
+
except Exception as e:
|
|
583
|
+
log(f"Warning: ICNS conversion failed: {e}", style="warning")
|
|
584
|
+
|
|
585
|
+
# --- Linux (PNG) ---
|
|
586
|
+
if sys.platform == "linux":
|
|
587
|
+
# Just ensure we use the PNG directly
|
|
588
|
+
context.app_icon = str(icon_path.resolve())
|
|
589
|
+
|
|
590
|
+
except ImportError:
|
|
591
|
+
log(
|
|
592
|
+
"Warning: Pillow not installed. Icons may be low resolution.",
|
|
593
|
+
style="warning",
|
|
594
|
+
)
|
|
595
|
+
log(
|
|
596
|
+
"Install Pillow for high-res support: pip install Pillow",
|
|
597
|
+
style="warning",
|
|
598
|
+
)
|
|
599
|
+
context.app_icon = str(icon_path.resolve())
|
|
600
|
+
except Exception as e:
|
|
601
|
+
log(f"Warning: Icon processing failed: {e}", style="warning")
|
|
602
|
+
context.app_icon = str(icon_path.resolve())
|
|
603
|
+
else:
|
|
604
|
+
# Already an ICO, ICNS, etc.
|
|
605
|
+
context.app_icon = str(icon_path.resolve())
|
|
606
|
+
|
|
607
|
+
# 4. Auto-include icon in bundle is dangerous because PyInstaller usually handles it.
|
|
608
|
+
# If we explicitly add it as data to '.' (root), and PyInstaller *also* puts it there or
|
|
609
|
+
# tries to use it as the exe icon, it causes the "File already exists" crash.
|
|
610
|
+
# PyInstaller automatically embeds the icon into the EXE metadata via --icon.
|
|
611
|
+
# If the user needs to load it at runtime (e.g., tray icon), they should use a different name
|
|
612
|
+
# or rely on the embedded resource.
|
|
613
|
+
# For now, let's DISABLE this implicit copy or rename it to avoid collision.
|
|
614
|
+
|
|
615
|
+
if context.app_icon and os.path.exists(context.app_icon):
|
|
616
|
+
# We rename it in the bundle to avoid collision with the directory or other files
|
|
617
|
+
# context.add_data.append(f"{context.app_icon}{os.pathsep}resources/app_icon.ico")
|
|
618
|
+
pass
|