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/secure.py
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import shutil
|
|
4
|
+
import traceback
|
|
5
|
+
import subprocess
|
|
6
|
+
import re
|
|
7
|
+
import sysconfig
|
|
8
|
+
import platform
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from ..console import log, run_command_with_output, console, Rule
|
|
11
|
+
from .installers import build_installer
|
|
12
|
+
from ..commands.helpers import get_python_executable, get_venv_site_packages
|
|
13
|
+
from ..commands.harvest import generate_nuclear_hooks
|
|
14
|
+
|
|
15
|
+
from .metadata import MetadataEditor
|
|
16
|
+
from .pipeline import BuildModule, BuildContext
|
|
17
|
+
from .utils import cleanup_dist
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from .compilers import compile_script as cython_compile
|
|
21
|
+
|
|
22
|
+
# Legacy compatibility if needed or removed entirely
|
|
23
|
+
# def cython_compile(script_path: Path, build_dir: Path): ...
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SecurityModule(BuildModule):
|
|
27
|
+
def __init__(self):
|
|
28
|
+
self.original_script = None
|
|
29
|
+
self.build_dir = Path("build") / "secure_build"
|
|
30
|
+
self.compiled_pyd = None
|
|
31
|
+
|
|
32
|
+
def prepare(self, context: BuildContext):
|
|
33
|
+
log(
|
|
34
|
+
"Shield: Initializing Secure Packaging (Binary Compilation)...",
|
|
35
|
+
style="info",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# 1. CYTHON COMPILATION
|
|
39
|
+
if self.build_dir.exists():
|
|
40
|
+
shutil.rmtree(self.build_dir)
|
|
41
|
+
self.build_dir.mkdir(parents=True, exist_ok=True)
|
|
42
|
+
|
|
43
|
+
self.compiled_pyd = cython_compile(context.script, self.build_dir)
|
|
44
|
+
if not self.compiled_pyd:
|
|
45
|
+
raise RuntimeError("Shield Error: Cython compilation failed.")
|
|
46
|
+
|
|
47
|
+
# 3. GENERATE BOOTSTRAP SCRIPT
|
|
48
|
+
bootstrap_path = self.build_dir / "bootstrap_env.py"
|
|
49
|
+
bootstrap_content = """
|
|
50
|
+
import sys, os, json, logging, threading, asyncio, textwrap, re, socket, ssl, ctypes, hashlib, time, base64, mimetypes
|
|
51
|
+
from collections import deque
|
|
52
|
+
import pytron
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
import app # This imports the compiled app.pyd/so
|
|
56
|
+
except Exception as e:
|
|
57
|
+
print(f"Boot Error: Failed to load compiled app: {e}")
|
|
58
|
+
sys.exit(1)
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
pass
|
|
62
|
+
"""
|
|
63
|
+
bootstrap_path.write_text(bootstrap_content)
|
|
64
|
+
|
|
65
|
+
# 2. CONFIGURE SHIELDED ANALYSIS
|
|
66
|
+
self.original_script = context.script
|
|
67
|
+
context.script = bootstrap_path
|
|
68
|
+
|
|
69
|
+
# Store original for PyInstaller module to pick up (Dual Analysis)
|
|
70
|
+
context.original_script = self.original_script
|
|
71
|
+
|
|
72
|
+
# Add the compiled binary to the build context binaries
|
|
73
|
+
# CRITICAL: We EXCLUDE the original script from being bundled as source
|
|
74
|
+
if self.original_script.stem not in context.excludes:
|
|
75
|
+
context.excludes.append(self.original_script.stem)
|
|
76
|
+
|
|
77
|
+
# Add to pathex so PyInstaller finds the .pyd during analysis of bootstrap
|
|
78
|
+
if str(self.build_dir.resolve()) not in context.pathex:
|
|
79
|
+
context.pathex.append(str(self.build_dir.resolve()))
|
|
80
|
+
|
|
81
|
+
context.binaries.append(f"{self.compiled_pyd.resolve()}{os.pathsep}.")
|
|
82
|
+
|
|
83
|
+
# 4. FORCE NO-ARCHIVE (Required for our custom fusion process)
|
|
84
|
+
if "--debug" not in context.extra_args:
|
|
85
|
+
context.extra_args.extend(["--debug", "noarchive"])
|
|
86
|
+
|
|
87
|
+
def compact_library(self, dist_path: Path, bundle_path: Path):
|
|
88
|
+
"""Fuses all loose .pyc files into a single safeguarded app.bundle,
|
|
89
|
+
preserving the physical integrity of 'Special' packages (Native/Resource-heavy).
|
|
90
|
+
"""
|
|
91
|
+
import zipfile
|
|
92
|
+
|
|
93
|
+
internal_dir = dist_path / "_internal"
|
|
94
|
+
|
|
95
|
+
if not internal_dir.exists():
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
log(
|
|
99
|
+
f"Fusing Python library into {bundle_path.name} (Surgical Preservation)...",
|
|
100
|
+
style="cyan",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# 1. DISCOVERY: Identify 'Special' packages that MUST stay loose
|
|
104
|
+
preserving_packages = set()
|
|
105
|
+
special_exts = (
|
|
106
|
+
".pyd",
|
|
107
|
+
".so",
|
|
108
|
+
".dll",
|
|
109
|
+
".lib",
|
|
110
|
+
".pem",
|
|
111
|
+
".onnx",
|
|
112
|
+
".prototxt",
|
|
113
|
+
".bin",
|
|
114
|
+
".pb",
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
for root, _, files in os.walk(internal_dir):
|
|
118
|
+
if any(f.endswith(special_exts) for f in files):
|
|
119
|
+
# Identify the top-level package name in _internal
|
|
120
|
+
rel_parts = Path(root).relative_to(internal_dir).parts
|
|
121
|
+
if rel_parts:
|
|
122
|
+
preserving_packages.add(rel_parts[0])
|
|
123
|
+
|
|
124
|
+
log(
|
|
125
|
+
f" + Preserving physical package domains: {', '.join(preserving_packages)}",
|
|
126
|
+
style="dim",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
to_remove = []
|
|
130
|
+
# USE ZIP_STORED for zero-latency imports
|
|
131
|
+
with zipfile.ZipFile(bundle_path, "w", zipfile.ZIP_STORED) as bundle:
|
|
132
|
+
# 2. Merge standard base_library
|
|
133
|
+
base_zip = internal_dir / "base_library.zip"
|
|
134
|
+
if base_zip.exists():
|
|
135
|
+
with zipfile.ZipFile(base_zip, "r") as bzip:
|
|
136
|
+
for name in bzip.namelist():
|
|
137
|
+
bundle.writestr(name, bzip.read(name))
|
|
138
|
+
to_remove.append(base_zip)
|
|
139
|
+
|
|
140
|
+
# 3. Process the rest of _internal
|
|
141
|
+
for root, _, files in os.walk(internal_dir):
|
|
142
|
+
rel_parts = Path(root).relative_to(internal_dir).parts
|
|
143
|
+
|
|
144
|
+
# If this is inside a preserved package, skip fusion entirely
|
|
145
|
+
if rel_parts and rel_parts[0] in preserving_packages:
|
|
146
|
+
continue
|
|
147
|
+
|
|
148
|
+
for f in files:
|
|
149
|
+
# Capture code only for fused packages to keep them clean
|
|
150
|
+
if f.endswith((".pyc", ".py")):
|
|
151
|
+
full_path = Path(root) / f
|
|
152
|
+
rel_path = full_path.relative_to(internal_dir)
|
|
153
|
+
bundle.write(full_path, rel_path)
|
|
154
|
+
to_remove.append(full_path)
|
|
155
|
+
|
|
156
|
+
# 4. Cleanup fused source files
|
|
157
|
+
for p in to_remove:
|
|
158
|
+
try:
|
|
159
|
+
os.remove(p)
|
|
160
|
+
except Exception:
|
|
161
|
+
pass
|
|
162
|
+
|
|
163
|
+
# 5. PRUNING: Recursive remove empty directory skeletons
|
|
164
|
+
for root, dirs, _ in os.walk(internal_dir, topdown=False):
|
|
165
|
+
for d in dirs:
|
|
166
|
+
dir_path = Path(root) / d
|
|
167
|
+
try:
|
|
168
|
+
if not any(dir_path.iterdir()):
|
|
169
|
+
os.rmdir(dir_path)
|
|
170
|
+
except Exception:
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
log(
|
|
174
|
+
f" + Shielded {len(to_remove)} modules into bundle. Logic is safeguarded.",
|
|
175
|
+
style="dim",
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
def build_wrapper(self, context: BuildContext, build_func):
|
|
179
|
+
# We need to change the output name for the "base" build
|
|
180
|
+
# so it doesn't collide with the final loader
|
|
181
|
+
original_out_name = context.out_name
|
|
182
|
+
context.out_name = f"{original_out_name}_base"
|
|
183
|
+
|
|
184
|
+
# Run the actual build
|
|
185
|
+
ret_code = build_func(context)
|
|
186
|
+
|
|
187
|
+
# Restore name
|
|
188
|
+
context.out_name = original_out_name
|
|
189
|
+
|
|
190
|
+
if ret_code != 0:
|
|
191
|
+
return ret_code
|
|
192
|
+
|
|
193
|
+
# 4. ASSEMBLE SECURE DISTRIBUTION
|
|
194
|
+
log("Hardening Distribution...", style="cyan")
|
|
195
|
+
|
|
196
|
+
base_dist = Path("dist") / f"{original_out_name}_base"
|
|
197
|
+
final_dist = Path("dist") / original_out_name
|
|
198
|
+
|
|
199
|
+
if final_dist.exists():
|
|
200
|
+
try:
|
|
201
|
+
shutil.rmtree(final_dist)
|
|
202
|
+
except Exception:
|
|
203
|
+
log(
|
|
204
|
+
f"Warning: Could not clear {final_dist}. Some files may be locked.",
|
|
205
|
+
style="warning",
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
final_dist.mkdir(parents=True, exist_ok=True)
|
|
209
|
+
|
|
210
|
+
log("Assembling secure distribution...", style="dim")
|
|
211
|
+
for item in base_dist.iterdir():
|
|
212
|
+
target = final_dist / item.name
|
|
213
|
+
try:
|
|
214
|
+
if item.is_dir():
|
|
215
|
+
if target.exists():
|
|
216
|
+
shutil.rmtree(target)
|
|
217
|
+
shutil.copytree(item, target)
|
|
218
|
+
else:
|
|
219
|
+
shutil.copy2(item, target)
|
|
220
|
+
except Exception as e:
|
|
221
|
+
log(f"Warning: Could not copy {item.name}: {e}", style="warning")
|
|
222
|
+
|
|
223
|
+
# 5. FUSE AND CLOAK LIBRARY (Optional via --bundled)
|
|
224
|
+
if getattr(context, "bundled", False):
|
|
225
|
+
# Place the bundle inside _internal for a cleaner root
|
|
226
|
+
bundle_path = final_dist / "_internal" / "app.bundle"
|
|
227
|
+
self.compact_library(final_dist, bundle_path)
|
|
228
|
+
else:
|
|
229
|
+
log(
|
|
230
|
+
"Skipping aggressive library bundling for stability (Safe Mode).",
|
|
231
|
+
style="dim",
|
|
232
|
+
)
|
|
233
|
+
log("Use --bundled to group Python modules into app.bundle.", style="dim")
|
|
234
|
+
|
|
235
|
+
# 7. DEPLOY RUST LOADER
|
|
236
|
+
log("Hardening Loader...", style="info")
|
|
237
|
+
ext_exe = ".exe" if sys.platform == "win32" else ""
|
|
238
|
+
loader_name = f"pytron_rust_bootloader{ext_exe}"
|
|
239
|
+
precompiled_bin = (
|
|
240
|
+
context.package_dir
|
|
241
|
+
/ "pytron"
|
|
242
|
+
/ "pack"
|
|
243
|
+
/ "secure_loader"
|
|
244
|
+
/ "bin"
|
|
245
|
+
/ loader_name
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
final_loader = final_dist / f"{original_out_name}{ext_exe}"
|
|
249
|
+
shutil.copy(precompiled_bin, final_loader)
|
|
250
|
+
|
|
251
|
+
# Cleanup dummy base exe if it exists
|
|
252
|
+
base_exe = final_dist / f"{original_out_name}_base{ext_exe}"
|
|
253
|
+
if base_exe.exists():
|
|
254
|
+
try:
|
|
255
|
+
os.remove(base_exe)
|
|
256
|
+
except Exception:
|
|
257
|
+
pass
|
|
258
|
+
|
|
259
|
+
# 8. FINAL OPTIMIZATION
|
|
260
|
+
cleanup_dist(final_dist)
|
|
261
|
+
|
|
262
|
+
# Try to remove the temp base dist if possible
|
|
263
|
+
try:
|
|
264
|
+
shutil.rmtree(base_dist, ignore_errors=True)
|
|
265
|
+
except Exception:
|
|
266
|
+
pass
|
|
267
|
+
|
|
268
|
+
return 0
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def get_native_engine_libs():
|
|
272
|
+
from .utils import get_native_engine_binaries
|
|
273
|
+
|
|
274
|
+
return get_native_engine_binaries()
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
from .utils import cleanup_dist as prune_junk_folders
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def apply_metadata_to_binary(
|
|
281
|
+
binary_path, icon_path, settings, dist_dir, package_dir=None
|
|
282
|
+
):
|
|
283
|
+
editor = MetadataEditor(package_dir=package_dir)
|
|
284
|
+
return editor.update(binary_path, icon_path, settings, dist_dir)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def run_secure_build(
|
|
288
|
+
args,
|
|
289
|
+
script,
|
|
290
|
+
out_name,
|
|
291
|
+
settings,
|
|
292
|
+
app_icon,
|
|
293
|
+
package_dir,
|
|
294
|
+
add_data,
|
|
295
|
+
progress,
|
|
296
|
+
task,
|
|
297
|
+
package_context=None,
|
|
298
|
+
):
|
|
299
|
+
"""
|
|
300
|
+
Legacy entry point for secure build.
|
|
301
|
+
"""
|
|
302
|
+
# This function is now mostly a wrapper for the SecurityModule pipeline logic
|
|
303
|
+
# but kept for backward compatibility if called directly.
|
|
304
|
+
log(
|
|
305
|
+
"Secure Build started via legacy entry point. Using SecurityModule internally.",
|
|
306
|
+
style="info",
|
|
307
|
+
)
|
|
308
|
+
# For now, we'll let the pipeline handle it as the preferred route.
|
|
309
|
+
return 0
|
|
Binary file
|
|
Binary file
|
pytron/pack/utils.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import shutil
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from ..console import console, log
|
|
6
|
+
import fnmatch
|
|
7
|
+
from ..commands.helpers import get_config
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def cleanup_dist(dist_path: Path, preserve_tk: bool = False):
|
|
11
|
+
"""
|
|
12
|
+
Removes unnecessary files (node_modules, node.exe, etc) from the build output
|
|
13
|
+
to optimize the package size.
|
|
14
|
+
"""
|
|
15
|
+
target_path = dist_path
|
|
16
|
+
# On macOS, if we built a bundle, the output is .app
|
|
17
|
+
if sys.platform == "darwin":
|
|
18
|
+
app_path = dist_path.parent / f"{dist_path.name}.app"
|
|
19
|
+
if app_path.exists():
|
|
20
|
+
target_path = app_path
|
|
21
|
+
|
|
22
|
+
if not target_path.exists():
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
# Items to remove (exact names)
|
|
26
|
+
remove_names = {
|
|
27
|
+
"node_modules",
|
|
28
|
+
"node.exe",
|
|
29
|
+
"npm.cmd",
|
|
30
|
+
"npx.cmd",
|
|
31
|
+
".git",
|
|
32
|
+
".gitignore",
|
|
33
|
+
".vscode",
|
|
34
|
+
".idea",
|
|
35
|
+
"package.json",
|
|
36
|
+
"package-lock.json",
|
|
37
|
+
"yarn.lock",
|
|
38
|
+
"pnpm-lock.yaml",
|
|
39
|
+
"__pycache__",
|
|
40
|
+
".env",
|
|
41
|
+
"venv",
|
|
42
|
+
".venv",
|
|
43
|
+
"python.exe",
|
|
44
|
+
"pythonw.exe",
|
|
45
|
+
"lib2to3",
|
|
46
|
+
"idle_test",
|
|
47
|
+
"test",
|
|
48
|
+
"tests",
|
|
49
|
+
"unit_test",
|
|
50
|
+
"include",
|
|
51
|
+
"msvcrt.dll",
|
|
52
|
+
"LICENSE",
|
|
53
|
+
"README.md",
|
|
54
|
+
"CHANGELOG.md",
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if not preserve_tk:
|
|
58
|
+
remove_names.update({"tcl86t.dll", "tk86t.dll", "tcl", "tk", "tcl8.6", "tk8.6"})
|
|
59
|
+
|
|
60
|
+
log(f"Aggressively optimizing: {target_path}")
|
|
61
|
+
|
|
62
|
+
for root, dirs, files in os.walk(target_path, topdown=True):
|
|
63
|
+
# 1. PRUNE DIRECTORIES
|
|
64
|
+
dirs_to_remove = []
|
|
65
|
+
for d in dirs:
|
|
66
|
+
# Remove exact matches OR metadata patterns
|
|
67
|
+
if d in remove_names or d.endswith((".dist-info", ".egg-info")):
|
|
68
|
+
dirs_to_remove.append(d)
|
|
69
|
+
|
|
70
|
+
for d in dirs_to_remove:
|
|
71
|
+
full_path = Path(root) / d
|
|
72
|
+
try:
|
|
73
|
+
shutil.rmtree(full_path)
|
|
74
|
+
console.print(f" - Pruned: {d}", style="dim")
|
|
75
|
+
dirs.remove(d)
|
|
76
|
+
except Exception:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
# 2. PRUNE FILES
|
|
80
|
+
for f in files:
|
|
81
|
+
# We remove common clutter names and development artifacts like .pdb and .pyi
|
|
82
|
+
# We DON'T remove all .txt files globally because they are often legitimate assets (e.g. certificates, data).
|
|
83
|
+
should_remove = f in remove_names or f.endswith((".pdb", ".pyi"))
|
|
84
|
+
|
|
85
|
+
if should_remove:
|
|
86
|
+
# SAFETY: Protect critical entry points in embedded engines
|
|
87
|
+
if (
|
|
88
|
+
f == "package.json"
|
|
89
|
+
and "pytron/engines/chrome/shell" in root.replace("\\", "/")
|
|
90
|
+
):
|
|
91
|
+
continue
|
|
92
|
+
|
|
93
|
+
full_path = Path(root) / f
|
|
94
|
+
try:
|
|
95
|
+
os.remove(full_path)
|
|
96
|
+
except Exception:
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def get_native_engine_binaries() -> list[str]:
|
|
101
|
+
"""Returns the names of the native engine binary artifacts."""
|
|
102
|
+
binaries = []
|
|
103
|
+
if sys.platform == "win32":
|
|
104
|
+
binaries.append("pytron_native.pyd")
|
|
105
|
+
binaries.append("WebView2Loader.dll")
|
|
106
|
+
elif sys.platform == "darwin":
|
|
107
|
+
binaries.append("pytron_native.so")
|
|
108
|
+
else:
|
|
109
|
+
binaries.append("pytron_native.so")
|
|
110
|
+
return binaries
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import List, Set
|
|
6
|
+
from ..console import log
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class VirtualRootGenerator:
|
|
10
|
+
"""
|
|
11
|
+
Scans the codebase for 'app.expose' and generates a
|
|
12
|
+
Virtual Entry Point (VEP) that acts as the minimal root for the dependency graph.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, source_dir: Path):
|
|
16
|
+
self.source_dir = source_dir
|
|
17
|
+
self.exposed_functions = [] # List of (module_name, function_name)
|
|
18
|
+
|
|
19
|
+
def scan(self):
|
|
20
|
+
"""
|
|
21
|
+
Recursively scans .py files for app.expose usages.
|
|
22
|
+
"""
|
|
23
|
+
log("Scanning for exposed API endpoints...", style="cyan")
|
|
24
|
+
|
|
25
|
+
# We need to map file paths to module names relative to source_dir
|
|
26
|
+
for root, _, files in os.walk(self.source_dir):
|
|
27
|
+
for file in files:
|
|
28
|
+
if file.endswith(".py"):
|
|
29
|
+
full_path = Path(root) / file
|
|
30
|
+
self._scan_file(full_path)
|
|
31
|
+
|
|
32
|
+
log(f"Found {len(self.exposed_functions)} exposed endpoints.", style="info")
|
|
33
|
+
|
|
34
|
+
def _scan_file(self, file_path: Path):
|
|
35
|
+
try:
|
|
36
|
+
content = file_path.read_text(encoding="utf-8", errors="ignore")
|
|
37
|
+
|
|
38
|
+
# Simple Text/Regex Heuristic (Robust against AST failures)
|
|
39
|
+
# Pattern 1: @app.expose or @expose
|
|
40
|
+
# Pattern 2: app.expose(func_name)
|
|
41
|
+
|
|
42
|
+
# 1. Decorator Scan
|
|
43
|
+
# This is hard because we need the function name AFTER the decorator.
|
|
44
|
+
# So we use AST because it's safer for structure.
|
|
45
|
+
tree = ast.parse(content)
|
|
46
|
+
|
|
47
|
+
# Calculate module name
|
|
48
|
+
rel_path = file_path.relative_to(self.source_dir)
|
|
49
|
+
module_parts = list(rel_path.parts)
|
|
50
|
+
module_parts[-1] = module_parts[-1].replace(".py", "")
|
|
51
|
+
if module_parts[-1] == "__init__":
|
|
52
|
+
module_parts.pop()
|
|
53
|
+
module_name = ".".join(module_parts)
|
|
54
|
+
|
|
55
|
+
for node in ast.walk(tree):
|
|
56
|
+
# Check for Decorators
|
|
57
|
+
if isinstance(node, ast.FunctionDef):
|
|
58
|
+
is_exposed = False
|
|
59
|
+
for dec in node.decorator_list:
|
|
60
|
+
# Check @app.expose
|
|
61
|
+
if isinstance(dec, ast.Attribute) and dec.attr == "expose":
|
|
62
|
+
is_exposed = True
|
|
63
|
+
# Check @expose direct import
|
|
64
|
+
elif isinstance(dec, ast.Name) and dec.id == "expose":
|
|
65
|
+
is_exposed = True
|
|
66
|
+
|
|
67
|
+
if is_exposed:
|
|
68
|
+
self.exposed_functions.append((module_name, node.name))
|
|
69
|
+
|
|
70
|
+
# Check for manual calls: app.expose(my_func)
|
|
71
|
+
elif isinstance(node, ast.Call):
|
|
72
|
+
if (
|
|
73
|
+
isinstance(node.func, ast.Attribute)
|
|
74
|
+
and node.func.attr == "expose"
|
|
75
|
+
):
|
|
76
|
+
# Look at arguments
|
|
77
|
+
if node.args:
|
|
78
|
+
arg = node.args[0]
|
|
79
|
+
if isinstance(arg, ast.Name):
|
|
80
|
+
# app.expose(my_func)
|
|
81
|
+
self.exposed_functions.append((module_name, arg.id))
|
|
82
|
+
|
|
83
|
+
except Exception as e:
|
|
84
|
+
# log(f"Warning: Failed to parse {file_path.name}: {e}", style="dim")
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
def generate(self, output_path: Path) -> Path:
|
|
88
|
+
"""
|
|
89
|
+
Generates the _virtual_root.py file.
|
|
90
|
+
"""
|
|
91
|
+
lines = [
|
|
92
|
+
"# VIRTUAL ENTRY POINT generated by Pytron Crystal",
|
|
93
|
+
"# This file imports all exposed functions to force-load their dependencies.",
|
|
94
|
+
"",
|
|
95
|
+
"import sys",
|
|
96
|
+
"import pytron",
|
|
97
|
+
"",
|
|
98
|
+
"# --- EXPOSED ENDPOINTS ---",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
# Sort for determinism
|
|
102
|
+
self.exposed_functions.sort()
|
|
103
|
+
|
|
104
|
+
used_modules = set()
|
|
105
|
+
|
|
106
|
+
for mod, func in self.exposed_functions:
|
|
107
|
+
lines.append(f"from {mod} import {func}")
|
|
108
|
+
used_modules.add(mod)
|
|
109
|
+
|
|
110
|
+
lines.append("")
|
|
111
|
+
lines.append(f"# Total Exposed Functions: {len(self.exposed_functions)}")
|
|
112
|
+
lines.append("")
|
|
113
|
+
|
|
114
|
+
# Add a main block that mimics the app startup
|
|
115
|
+
lines.append("if __name__ == '__main__':")
|
|
116
|
+
lines.append(" print('[VEP] Virtual Entry Point Loaded.')")
|
|
117
|
+
lines.append(" # This script does nothing but import variables.")
|
|
118
|
+
lines.append(
|
|
119
|
+
" # The act of importing is what triggers the dependency loading."
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
output_path.write_text("\n".join(lines), encoding="utf-8")
|
|
123
|
+
log(f"Generated Virtual Entry Point: {output_path.name}", style="success")
|
|
124
|
+
return output_path
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
from ..interface import PlatformInterface
|
|
4
|
+
|
|
5
|
+
# _pytron_android is expected to be a built-in module provided by the C++ JNI layer.
|
|
6
|
+
try:
|
|
7
|
+
import _pytron_android
|
|
8
|
+
except ImportError:
|
|
9
|
+
_pytron_android = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AndroidImplementation(PlatformInterface):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
self.logger = logging.getLogger("Pytron.Android")
|
|
15
|
+
if not _pytron_android:
|
|
16
|
+
self.logger.warning(
|
|
17
|
+
"_pytron_android module not found. This platform implementation requires running inside the Android shell."
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def _send(self, method, **kwargs):
|
|
21
|
+
"""
|
|
22
|
+
Send a message to the Java/Kotlin layer via the JNI bridge.
|
|
23
|
+
"""
|
|
24
|
+
if _pytron_android:
|
|
25
|
+
payload = json.dumps({"method": method, "args": kwargs})
|
|
26
|
+
# This function is defined in the C++ JNI Bridge
|
|
27
|
+
return _pytron_android.send_to_android(payload)
|
|
28
|
+
else:
|
|
29
|
+
self.logger.debug(f"[Android Mock] Call: {method} Args: {kwargs}")
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
def minimize(self, w):
|
|
33
|
+
self._send("minimize")
|
|
34
|
+
|
|
35
|
+
def set_bounds(self, w, x, y, width, height):
|
|
36
|
+
# On Android, windows are usually full screen activities, but we can support resizing if in multi-window mode or PiP
|
|
37
|
+
self._send("set_bounds", x=x, y=y, width=width, height=height)
|
|
38
|
+
|
|
39
|
+
def close(self, w):
|
|
40
|
+
self._send("close")
|
|
41
|
+
|
|
42
|
+
def toggle_maximize(self, w):
|
|
43
|
+
self._send("toggle_maximize")
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
def make_frameless(self, w):
|
|
47
|
+
self._send("make_frameless")
|
|
48
|
+
|
|
49
|
+
def start_drag(self, w):
|
|
50
|
+
self._send("start_drag")
|
|
51
|
+
|
|
52
|
+
def message_box(self, w, title, message, style=0):
|
|
53
|
+
# Assuming the JNI call 'send_to_android' can return values if we implement it to wait.
|
|
54
|
+
# We will assume it returns a serialized JSON string or primitive for blocking calls.
|
|
55
|
+
ret = self._send("message_box", title=title, message=message, style=style)
|
|
56
|
+
return int(ret) if ret is not None else 6
|
|
57
|
+
|
|
58
|
+
def notification(self, w, title, message, icon=None):
|
|
59
|
+
self._send("notification", title=title, message=message, icon=icon)
|
|
60
|
+
|
|
61
|
+
def hide(self, w):
|
|
62
|
+
self._send("hide")
|
|
63
|
+
|
|
64
|
+
def show(self, w):
|
|
65
|
+
self._send("show")
|
|
66
|
+
|
|
67
|
+
def set_window_icon(self, w, icon_path):
|
|
68
|
+
self._send("set_window_icon", path=icon_path)
|
|
69
|
+
|
|
70
|
+
def set_app_id(self, app_id):
|
|
71
|
+
self._send("set_app_id", app_id=app_id)
|
|
72
|
+
|
|
73
|
+
# Dialogs
|
|
74
|
+
def open_file_dialog(self, w, title, default_path=None, file_types=None):
|
|
75
|
+
res = self._send(
|
|
76
|
+
"open_file_dialog",
|
|
77
|
+
title=title,
|
|
78
|
+
default_path=default_path,
|
|
79
|
+
file_types=file_types,
|
|
80
|
+
)
|
|
81
|
+
if res:
|
|
82
|
+
return json.loads(res)
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
def save_file_dialog(
|
|
86
|
+
self, w, title, default_path=None, default_name=None, file_types=None
|
|
87
|
+
):
|
|
88
|
+
res = self._send(
|
|
89
|
+
"save_file_dialog",
|
|
90
|
+
title=title,
|
|
91
|
+
default_path=default_path,
|
|
92
|
+
default_name=default_name,
|
|
93
|
+
file_types=file_types,
|
|
94
|
+
)
|
|
95
|
+
if res:
|
|
96
|
+
return json.loads(res)
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
def open_folder_dialog(self, w, title, default_path=None):
|
|
100
|
+
res = self._send("open_folder_dialog", title=title, default_path=default_path)
|
|
101
|
+
if res:
|
|
102
|
+
return json.loads(res)
|
|
103
|
+
return None
|