pytron-kit 0.3.12__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.pyd +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.exe +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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#ifndef Py_WARNINGS_H
|
|
2
|
+
#define Py_WARNINGS_H
|
|
3
|
+
#ifdef __cplusplus
|
|
4
|
+
extern "C" {
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
PyAPI_FUNC(int) PyErr_WarnEx(
|
|
8
|
+
PyObject *category,
|
|
9
|
+
const char *message, /* UTF-8 encoded string */
|
|
10
|
+
Py_ssize_t stack_level);
|
|
11
|
+
|
|
12
|
+
PyAPI_FUNC(int) PyErr_WarnFormat(
|
|
13
|
+
PyObject *category,
|
|
14
|
+
Py_ssize_t stack_level,
|
|
15
|
+
const char *format, /* ASCII-encoded string */
|
|
16
|
+
...);
|
|
17
|
+
|
|
18
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
|
|
19
|
+
/* Emit a ResourceWarning warning */
|
|
20
|
+
PyAPI_FUNC(int) PyErr_ResourceWarning(
|
|
21
|
+
PyObject *source,
|
|
22
|
+
Py_ssize_t stack_level,
|
|
23
|
+
const char *format, /* ASCII-encoded string */
|
|
24
|
+
...);
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
PyAPI_FUNC(int) PyErr_WarnExplicit(
|
|
28
|
+
PyObject *category,
|
|
29
|
+
const char *message, /* UTF-8 encoded string */
|
|
30
|
+
const char *filename, /* decoded from the filesystem encoding */
|
|
31
|
+
int lineno,
|
|
32
|
+
const char *module, /* UTF-8 encoded string */
|
|
33
|
+
PyObject *registry);
|
|
34
|
+
|
|
35
|
+
#ifndef Py_LIMITED_API
|
|
36
|
+
# define Py_CPYTHON_WARNINGS_H
|
|
37
|
+
# include "cpython/warnings.h"
|
|
38
|
+
# undef Py_CPYTHON_WARNINGS_H
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#ifdef __cplusplus
|
|
42
|
+
}
|
|
43
|
+
#endif
|
|
44
|
+
#endif /* !Py_WARNINGS_H */
|
|
45
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Weak references objects for Python. */
|
|
2
|
+
|
|
3
|
+
#ifndef Py_WEAKREFOBJECT_H
|
|
4
|
+
#define Py_WEAKREFOBJECT_H
|
|
5
|
+
#ifdef __cplusplus
|
|
6
|
+
extern "C" {
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
typedef struct _PyWeakReference PyWeakReference;
|
|
10
|
+
|
|
11
|
+
PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
|
|
12
|
+
PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
|
|
13
|
+
PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
|
|
14
|
+
|
|
15
|
+
#define PyWeakref_CheckRef(op) PyObject_TypeCheck((op), &_PyWeakref_RefType)
|
|
16
|
+
#define PyWeakref_CheckRefExact(op) \
|
|
17
|
+
Py_IS_TYPE((op), &_PyWeakref_RefType)
|
|
18
|
+
#define PyWeakref_CheckProxy(op) \
|
|
19
|
+
(Py_IS_TYPE((op), &_PyWeakref_ProxyType) \
|
|
20
|
+
|| Py_IS_TYPE((op), &_PyWeakref_CallableProxyType))
|
|
21
|
+
|
|
22
|
+
#define PyWeakref_Check(op) \
|
|
23
|
+
(PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,
|
|
27
|
+
PyObject *callback);
|
|
28
|
+
PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,
|
|
29
|
+
PyObject *callback);
|
|
30
|
+
Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
|
|
31
|
+
|
|
32
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000
|
|
33
|
+
PyAPI_FUNC(int) PyWeakref_GetRef(PyObject *ref, PyObject **pobj);
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
#ifndef Py_LIMITED_API
|
|
38
|
+
# define Py_CPYTHON_WEAKREFOBJECT_H
|
|
39
|
+
# include "cpython/weakrefobject.h"
|
|
40
|
+
# undef Py_CPYTHON_WEAKREFOBJECT_H
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifdef __cplusplus
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
46
|
+
#endif /* !Py_WEAKREFOBJECT_H */
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#include <jni.h>
|
|
2
|
+
#include <string>
|
|
3
|
+
#include <android/log.h>
|
|
4
|
+
#include <Python.h>
|
|
5
|
+
#include <dlfcn.h>
|
|
6
|
+
#include <vector>
|
|
7
|
+
#include <unistd.h>
|
|
8
|
+
#include <fcntl.h> // <--- REQUIRED for open/dup2
|
|
9
|
+
|
|
10
|
+
#define LOG_TAG "PytronNative"
|
|
11
|
+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
|
12
|
+
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
13
|
+
|
|
14
|
+
static JavaVM* gJavaVM = nullptr;
|
|
15
|
+
static jobject gMainActivity = nullptr;
|
|
16
|
+
|
|
17
|
+
// Helper to send message to Java
|
|
18
|
+
static PyObject* py_send_to_android(PyObject* self, PyObject* args) {
|
|
19
|
+
const char* message;
|
|
20
|
+
if (!PyArg_ParseTuple(args, "s", &message)) {
|
|
21
|
+
return NULL;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
JNIEnv* env;
|
|
25
|
+
bool needsDetach = false;
|
|
26
|
+
int envStat = gJavaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
|
|
27
|
+
if (envStat == JNI_EDETACHED) {
|
|
28
|
+
gJavaVM->AttachCurrentThread(&env, NULL);
|
|
29
|
+
needsDetach = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (gMainActivity && env) {
|
|
33
|
+
jclass cls = env->GetObjectClass(gMainActivity);
|
|
34
|
+
jmethodID mid = env->GetMethodID(cls, "onMessageFromPython", "(Ljava/lang/String;)Ljava/lang/String;");
|
|
35
|
+
if (mid) {
|
|
36
|
+
jstring jStr = env->NewStringUTF(message);
|
|
37
|
+
jobject result = env->CallObjectMethod(gMainActivity, mid, jStr);
|
|
38
|
+
env->DeleteLocalRef(jStr);
|
|
39
|
+
if (env->ExceptionCheck()) {
|
|
40
|
+
env->ExceptionDescribe();
|
|
41
|
+
env->ExceptionClear();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (needsDetach) gJavaVM->DetachCurrentThread();
|
|
46
|
+
Py_RETURN_NONE;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static PyMethodDef AndroidMethods[] = {
|
|
50
|
+
{"send_to_android", py_send_to_android, METH_VARARGS, "Send message to Android layer"},
|
|
51
|
+
{NULL, NULL, 0, NULL}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
static struct PyModuleDef androidmodule = {
|
|
55
|
+
PyModuleDef_HEAD_INIT, "_pytron_android", NULL, -1, AndroidMethods
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
PyMODINIT_FUNC PyInit__pytron_android(void) {
|
|
59
|
+
return PyModule_Create(&androidmodule);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
extern "C" JNIEXPORT void JNICALL
|
|
63
|
+
Java_com_pytron_shell_MainActivity_startPython(JNIEnv* env, jobject thiz, jstring homePath) {
|
|
64
|
+
if (gMainActivity) env->DeleteGlobalRef(gMainActivity);
|
|
65
|
+
gMainActivity = env->NewGlobalRef(thiz);
|
|
66
|
+
|
|
67
|
+
const char* path = env->GetStringUTFChars(homePath, 0);
|
|
68
|
+
LOGI("Starting Python configuration with home: %s", path);
|
|
69
|
+
|
|
70
|
+
// ==========================================================
|
|
71
|
+
// 1. FIX FILE DESCRIPTORS (THE CRITICAL FIX)
|
|
72
|
+
// Python crashes if fd 0, 1, 2 are closed/invalid. We point them to /dev/null.
|
|
73
|
+
// ==========================================================
|
|
74
|
+
int fd = open("/dev/null", O_RDWR);
|
|
75
|
+
if (fd != -1) {
|
|
76
|
+
dup2(fd, 0); // stdin
|
|
77
|
+
dup2(fd, 1); // stdout
|
|
78
|
+
dup2(fd, 2); // stderr
|
|
79
|
+
if (fd > 2) close(fd);
|
|
80
|
+
}
|
|
81
|
+
// ==========================================================
|
|
82
|
+
|
|
83
|
+
// 2. ENVIRONMENT SETUP
|
|
84
|
+
setenv("PYTHONHOME", path, 1);
|
|
85
|
+
setenv("PYTHONUNBUFFERED", "1", 1); // Disable buffering
|
|
86
|
+
setenv("PYTHON_PLATFORM","android",1);
|
|
87
|
+
std::string base = std::string(path);
|
|
88
|
+
std::string libPath = base + "/Lib";
|
|
89
|
+
std::string sitePath = base + "/site-packages";
|
|
90
|
+
std::string zipPath = base + "/python314.zip";
|
|
91
|
+
|
|
92
|
+
if (access(libPath.c_str(), F_OK) != -1) {
|
|
93
|
+
LOGI("Native: Found Lib folder at %s", libPath.c_str());
|
|
94
|
+
} else {
|
|
95
|
+
LOGI("Native: Lib folder not found, assuming zip or custom structure.");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// DLOPEN
|
|
99
|
+
// Use the specific version name to be safe
|
|
100
|
+
void* handle = dlopen("libpython3.14.so", RTLD_NOW | RTLD_GLOBAL);
|
|
101
|
+
if (!handle) LOGE("Could not dlopen libpython3.14.so: %s", dlerror());
|
|
102
|
+
else LOGI("Successfully loaded libpython3.14.so globally");
|
|
103
|
+
|
|
104
|
+
// --- CONFIGURATION ---
|
|
105
|
+
PyStatus status;
|
|
106
|
+
PyConfig config;
|
|
107
|
+
PyConfig_InitIsolatedConfig(&config);
|
|
108
|
+
|
|
109
|
+
// CRITICAL: Stop Python from trying to initialize C-level streams
|
|
110
|
+
config.configure_c_stdio = 0;
|
|
111
|
+
config.parse_argv = 0;
|
|
112
|
+
// Optional: Stop Python from stealing signal handlers (Good for Android)
|
|
113
|
+
config.install_signal_handlers = 0;
|
|
114
|
+
|
|
115
|
+
wchar_t *wpath = Py_DecodeLocale(path, NULL);
|
|
116
|
+
status = PyConfig_SetString(&config, &config.program_name, wpath);
|
|
117
|
+
status = PyConfig_SetString(&config, &config.home, wpath);
|
|
118
|
+
|
|
119
|
+
// MODULE SEARCH PATHS
|
|
120
|
+
config.module_search_paths_set = 1;
|
|
121
|
+
|
|
122
|
+
wchar_t *wBase = Py_DecodeLocale(base.c_str(), NULL);
|
|
123
|
+
wchar_t *wLib = Py_DecodeLocale(libPath.c_str(), NULL);
|
|
124
|
+
wchar_t *wSite = Py_DecodeLocale(sitePath.c_str(), NULL);
|
|
125
|
+
wchar_t *wZip = Py_DecodeLocale(zipPath.c_str(), NULL);
|
|
126
|
+
|
|
127
|
+
PyWideStringList_Append(&config.module_search_paths, wBase);
|
|
128
|
+
PyWideStringList_Append(&config.module_search_paths, wLib);
|
|
129
|
+
|
|
130
|
+
// Lib-dynload (Critical for .so extensions like _struct)
|
|
131
|
+
std::string dynPath = libPath + "/lib-dynload";
|
|
132
|
+
wchar_t *wDyn = Py_DecodeLocale(dynPath.c_str(), NULL);
|
|
133
|
+
PyWideStringList_Append(&config.module_search_paths, wDyn);
|
|
134
|
+
|
|
135
|
+
PyWideStringList_Append(&config.module_search_paths, wZip);
|
|
136
|
+
PyWideStringList_Append(&config.module_search_paths, wSite);
|
|
137
|
+
|
|
138
|
+
// Register embedded module
|
|
139
|
+
if (PyImport_AppendInittab("_pytron_android", PyInit__pytron_android) == -1) {
|
|
140
|
+
LOGE("Failed to add _pytron_android to builtins");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
LOGI("Calling Py_InitializeFromConfig...");
|
|
144
|
+
status = Py_InitializeFromConfig(&config);
|
|
145
|
+
|
|
146
|
+
if (PyStatus_Exception(status)) {
|
|
147
|
+
LOGE("FATAL: Py_InitializeFromConfig failed.");
|
|
148
|
+
if (status.err_msg) LOGE("Python Config Error: %s", status.err_msg);
|
|
149
|
+
if (PyErr_Occurred()) PyErr_Print();
|
|
150
|
+
} else {
|
|
151
|
+
LOGI("Py_Initialize success!");
|
|
152
|
+
|
|
153
|
+
// Run Main
|
|
154
|
+
// We override sys.stdout/stderr here so print() goes to LogCat
|
|
155
|
+
std::string runCmd =
|
|
156
|
+
"import sys\n"
|
|
157
|
+
"class LogCatOut:\n"
|
|
158
|
+
" def write(self, s):\n"
|
|
159
|
+
" import _pytron_android, json\n"
|
|
160
|
+
" if s.strip(): _pytron_android.send_to_android(json.dumps({'method': 'log', 'args': {'message': s.strip()}}))\n"
|
|
161
|
+
" def flush(self): pass\n"
|
|
162
|
+
"sys.stdout = LogCatOut()\n"
|
|
163
|
+
"sys.stderr = LogCatOut()\n"
|
|
164
|
+
"try:\n"
|
|
165
|
+
" print('Native: sys.path is ' + str(sys.path))\n"
|
|
166
|
+
" import main\n"
|
|
167
|
+
" if hasattr(main, 'main'): main.main()\n"
|
|
168
|
+
"except Exception as e:\n"
|
|
169
|
+
" import traceback\n"
|
|
170
|
+
" traceback.print_exc()\n"
|
|
171
|
+
" err_msg = 'Python Crash: ' + str(e)\n"
|
|
172
|
+
" import _pytron_android\n"
|
|
173
|
+
" import json\n"
|
|
174
|
+
" _pytron_android.send_to_android(json.dumps({'method': 'message_box', 'args': {'title': 'Crash', 'message': err_msg}}))\n";
|
|
175
|
+
|
|
176
|
+
PyRun_SimpleString(runCmd.c_str());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
PyConfig_Clear(&config);
|
|
180
|
+
env->ReleaseStringUTFChars(homePath, path);
|
|
181
|
+
PyMem_Free(wpath);
|
|
182
|
+
PyMem_Free(wBase);
|
|
183
|
+
PyMem_Free(wLib);
|
|
184
|
+
PyMem_Free(wSite);
|
|
185
|
+
PyMem_Free(wZip);
|
|
186
|
+
PyMem_Free(wDyn);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
extern "C" JNIEXPORT void JNICALL
|
|
190
|
+
Java_com_pytron_shell_MainActivity_sendToPython(JNIEnv* env, jobject thiz, jstring message) {
|
|
191
|
+
if (!Py_IsInitialized()) return;
|
|
192
|
+
PyGILState_STATE gstate = PyGILState_Ensure();
|
|
193
|
+
const char* msg = env->GetStringUTFChars(message, 0);
|
|
194
|
+
|
|
195
|
+
// LOGI("Received message for Python: %s", msg);
|
|
196
|
+
|
|
197
|
+
// Call pytron.bindings.dispatch_android_message(msg)
|
|
198
|
+
PyObject* bindings = PyImport_ImportModule("pytron.bindings");
|
|
199
|
+
if (bindings) {
|
|
200
|
+
PyObject* func = PyObject_GetAttrString(bindings, "dispatch_android_message");
|
|
201
|
+
if (func && PyCallable_Check(func)) {
|
|
202
|
+
PyObject* args = PyTuple_Pack(1, PyUnicode_FromString(msg));
|
|
203
|
+
PyObject* result = PyObject_CallObject(func, args);
|
|
204
|
+
Py_XDECREF(result);
|
|
205
|
+
Py_DECREF(args);
|
|
206
|
+
Py_DECREF(func);
|
|
207
|
+
} else {
|
|
208
|
+
if (PyErr_Occurred()) PyErr_Print();
|
|
209
|
+
LOGE("Could not find dispatch_android_message in pytron.bindings");
|
|
210
|
+
}
|
|
211
|
+
Py_DECREF(bindings);
|
|
212
|
+
} else {
|
|
213
|
+
if (PyErr_Occurred()) PyErr_Print();
|
|
214
|
+
LOGE("Could not import pytron.bindings");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
env->ReleaseStringUTFChars(message, msg);
|
|
218
|
+
PyGILState_Release(gstate);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|
222
|
+
gJavaVM = vm;
|
|
223
|
+
return JNI_VERSION_1_6;
|
|
224
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
package com.pytron.shell
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.os.Bundle
|
|
5
|
+
import android.util.Log
|
|
6
|
+
import android.webkit.WebSettings
|
|
7
|
+
import android.webkit.WebView
|
|
8
|
+
import android.webkit.WebViewClient
|
|
9
|
+
import org.json.JSONObject
|
|
10
|
+
import java.io.File
|
|
11
|
+
import java.io.FileInputStream
|
|
12
|
+
import java.io.FileOutputStream
|
|
13
|
+
import java.io.IOException
|
|
14
|
+
import java.util.zip.ZipEntry
|
|
15
|
+
import java.util.zip.ZipInputStream
|
|
16
|
+
|
|
17
|
+
class MainActivity : Activity() {
|
|
18
|
+
|
|
19
|
+
private lateinit var webView: WebView
|
|
20
|
+
|
|
21
|
+
companion object {
|
|
22
|
+
init {
|
|
23
|
+
// Load libffi first if it's separate, then your native lib
|
|
24
|
+
try { System.loadLibrary("ffi") } catch (e: UnsatisfiedLinkError) { Log.w("Pytron", "libffi not found (might be static)") }
|
|
25
|
+
System.loadLibrary("pytron-native")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
30
|
+
super.onCreate(savedInstanceState)
|
|
31
|
+
|
|
32
|
+
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
|
33
|
+
Log.e("Pytron", "FATAL JAVA CRASH: ${throwable.message}", throwable)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
webView = WebView(this)
|
|
37
|
+
val settings = webView.settings
|
|
38
|
+
settings.javaScriptEnabled = true
|
|
39
|
+
settings.domStorageEnabled = true
|
|
40
|
+
settings.allowFileAccess = true
|
|
41
|
+
settings.allowFileAccessFromFileURLs = true
|
|
42
|
+
settings.allowUniversalAccessFromFileURLs = true
|
|
43
|
+
|
|
44
|
+
settings.allowUniversalAccessFromFileURLs = true
|
|
45
|
+
|
|
46
|
+
// Enable Remote Debugging (Inspect via chrome://inspect)
|
|
47
|
+
WebView.setWebContentsDebuggingEnabled(true)
|
|
48
|
+
|
|
49
|
+
// 2. INJECT THE BRIDGE OBJECT
|
|
50
|
+
// This allows JS to call window._pytron_bridge.postMessage("...")
|
|
51
|
+
webView.addJavascriptInterface(AndroidBridgeInterface(), "_pytron_bridge")
|
|
52
|
+
|
|
53
|
+
webView.webViewClient = object : WebViewClient() {
|
|
54
|
+
override fun onPageFinished(view: WebView?, url: String?) {
|
|
55
|
+
super.onPageFinished(view, url)
|
|
56
|
+
Log.d("Pytron", "WebView loaded: $url")
|
|
57
|
+
if (pendingScripts != null) {
|
|
58
|
+
val script = pendingScripts
|
|
59
|
+
// pendingScripts = null // Should we clear it? Usually yes, but depends if redirects happen.
|
|
60
|
+
// For now, let's keep it until next nav call or just execute.
|
|
61
|
+
view?.evaluateJavascript(script!!, null)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setContentView(webView)
|
|
67
|
+
webView.loadUrl("file:///android_asset/www/index.html")
|
|
68
|
+
|
|
69
|
+
// --- ASSET EXTRACTION LOGIC ---
|
|
70
|
+
val pythonHome = File(filesDir, "python")
|
|
71
|
+
|
|
72
|
+
Thread {
|
|
73
|
+
try {
|
|
74
|
+
// 1. Copy Assets (main.py, Lib/, site-packages/)
|
|
75
|
+
Log.i("Pytron", "Checking/Copying python assets...")
|
|
76
|
+
copyAssetFolder("python", pythonHome.absolutePath)
|
|
77
|
+
|
|
78
|
+
Log.i("Pytron", "Starting Python Bridge...")
|
|
79
|
+
startPython(pythonHome.absolutePath)
|
|
80
|
+
|
|
81
|
+
} catch (e: Exception) {
|
|
82
|
+
Log.e("Pytron", "Failed to start Python: ${e.message}", e)
|
|
83
|
+
}
|
|
84
|
+
}.start()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// --- NEW INNER CLASS ---
|
|
88
|
+
inner class AndroidBridgeInterface {
|
|
89
|
+
@android.webkit.JavascriptInterface
|
|
90
|
+
fun postMessage(message: String) {
|
|
91
|
+
// Forward the message from JS to our C++ Native Bridge
|
|
92
|
+
// This eventually calls dispatch_android_message() in Python
|
|
93
|
+
sendToPython(message)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private fun copyAssetFolder(srcName: String, dstPath: String): Boolean {
|
|
98
|
+
try {
|
|
99
|
+
val fileList = assets.list(srcName) ?: return false
|
|
100
|
+
if (fileList.isEmpty()) return true
|
|
101
|
+
|
|
102
|
+
for (filename in fileList) {
|
|
103
|
+
var inPath = if (srcName.isEmpty()) filename else srcName + File.separator + filename
|
|
104
|
+
var outPath = dstPath + File.separator + filename
|
|
105
|
+
|
|
106
|
+
// Check if it's a directory by trying to list its children
|
|
107
|
+
// Note: assets.list returns empty array for both empty dir AND file.
|
|
108
|
+
// We assume if it has an extension it's a file, or try to open it.
|
|
109
|
+
var isDir = false
|
|
110
|
+
val subFiles = assets.list(inPath)
|
|
111
|
+
if (subFiles != null && subFiles.isNotEmpty()) {
|
|
112
|
+
isDir = true
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (isDir) {
|
|
116
|
+
File(outPath).mkdirs()
|
|
117
|
+
copyAssetFolder(inPath, outPath)
|
|
118
|
+
} else {
|
|
119
|
+
// It's a file. Copy it.
|
|
120
|
+
copyAssetFile(inPath, outPath)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return true
|
|
124
|
+
} catch (e: Exception) {
|
|
125
|
+
Log.e("Pytron", "Asset Copy Failed for $srcName", e)
|
|
126
|
+
return false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private fun copyAssetFile(srcPath: String, dstPath: String) {
|
|
131
|
+
try {
|
|
132
|
+
val dstFile = File(dstPath)
|
|
133
|
+
|
|
134
|
+
// OPTIMIZATION: Don't copy if it already exists and has size
|
|
135
|
+
// Note: For development, you might want to remove this check or add versioning
|
|
136
|
+
// so updates get applied.
|
|
137
|
+
// if (dstFile.exists() && dstFile.length() > 0) {
|
|
138
|
+
// // Log.d("Pytron", "Skipping existing file: $dstPath")
|
|
139
|
+
// return
|
|
140
|
+
// }
|
|
141
|
+
|
|
142
|
+
val inputStream = assets.open(srcPath)
|
|
143
|
+
val outStream = FileOutputStream(dstFile)
|
|
144
|
+
val buffer = ByteArray(64 * 1024) // 64KB buffer
|
|
145
|
+
var read: Int
|
|
146
|
+
while (inputStream.read(buffer).also { read = it } != -1) {
|
|
147
|
+
outStream.write(buffer, 0, read)
|
|
148
|
+
}
|
|
149
|
+
inputStream.close()
|
|
150
|
+
outStream.close()
|
|
151
|
+
|
|
152
|
+
if (srcPath.endsWith(".zip")) {
|
|
153
|
+
Log.i("Pytron", "SUCCESS: Copied $srcPath (Size: ${dstFile.length()})")
|
|
154
|
+
}
|
|
155
|
+
} catch (e: IOException) {
|
|
156
|
+
// If it fails to open as a file, it might have been an empty directory caught in the loop
|
|
157
|
+
// Log.w("Pytron", "Could not copy $srcPath (might be empty dir)")
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
external fun startPython(homePath: String)
|
|
162
|
+
external fun sendToPython(message: String)
|
|
163
|
+
|
|
164
|
+
private var pendingScripts: String? = null
|
|
165
|
+
|
|
166
|
+
fun onMessageFromPython(payload: String): String {
|
|
167
|
+
runOnUiThread {
|
|
168
|
+
try {
|
|
169
|
+
// Log.d("Pytron", "Received from Python: $payload")
|
|
170
|
+
val json = JSONObject(payload)
|
|
171
|
+
val method = json.optString("method")
|
|
172
|
+
val args = json.optJSONObject("args")
|
|
173
|
+
|
|
174
|
+
if (method == "log") {
|
|
175
|
+
Log.i("PytronPython", args?.optString("message") ?: "")
|
|
176
|
+
}
|
|
177
|
+
else if (method == "message_box") {
|
|
178
|
+
val title = args?.optString("title")
|
|
179
|
+
val msg = args?.optString("message")
|
|
180
|
+
android.app.AlertDialog.Builder(this)
|
|
181
|
+
.setTitle(title)
|
|
182
|
+
.setMessage(msg)
|
|
183
|
+
.setPositiveButton("OK", null)
|
|
184
|
+
.show()
|
|
185
|
+
}
|
|
186
|
+
else if (method == "navigate") {
|
|
187
|
+
val url = args?.optString("url")
|
|
188
|
+
val scripts = args?.optString("scripts")
|
|
189
|
+
if (scripts != null) {
|
|
190
|
+
pendingScripts = scripts
|
|
191
|
+
}
|
|
192
|
+
if (url != null) {
|
|
193
|
+
webView.loadUrl(url)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (method == "eval") {
|
|
197
|
+
val code = args?.optString("code")
|
|
198
|
+
if (code != null) {
|
|
199
|
+
webView.evaluateJavascript(code, null)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
} catch (e: Exception) {
|
|
203
|
+
Log.e("Pytron", "Error processing message", e)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return "{}"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
3
|
+
plugins {
|
|
4
|
+
id 'com.android.application' version '8.11.2' apply false
|
|
5
|
+
id 'com.android.library' version '8.11.2' apply false
|
|
6
|
+
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
task clean(type: Delete) {
|
|
10
|
+
delete rootProject.buildDir
|
|
11
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
|
|
17
|
+
@if "%DEBUG%"=="" @echo off
|
|
18
|
+
@rem ##########################################################################
|
|
19
|
+
@rem
|
|
20
|
+
@rem Gradle startup script for Windows
|
|
21
|
+
@rem
|
|
22
|
+
@rem ##########################################################################
|
|
23
|
+
|
|
24
|
+
@rem Set local scope for the variables with windows NT shell
|
|
25
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
26
|
+
|
|
27
|
+
set DIRNAME=%~dp0
|
|
28
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
29
|
+
set APP_BASE_NAME=%~n0
|
|
30
|
+
set APP_HOME=%DIRNAME%
|
|
31
|
+
|
|
32
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
33
|
+
set DEFAULT_JVM_OPTS=
|
|
34
|
+
|
|
35
|
+
@rem Find java.exe
|
|
36
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
37
|
+
|
|
38
|
+
set JAVA_EXE=java.exe
|
|
39
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
40
|
+
if "%ERRORLEVEL%"=="0" goto execute
|
|
41
|
+
|
|
42
|
+
echo.
|
|
43
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
44
|
+
echo.
|
|
45
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
46
|
+
echo location of your Java installation.
|
|
47
|
+
|
|
48
|
+
goto fail
|
|
49
|
+
|
|
50
|
+
:findJavaFromJavaHome
|
|
51
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
52
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
53
|
+
|
|
54
|
+
if exist "%JAVA_EXE%" goto execute
|
|
55
|
+
|
|
56
|
+
echo.
|
|
57
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
58
|
+
echo.
|
|
59
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
60
|
+
echo location of your Java installation.
|
|
61
|
+
|
|
62
|
+
goto fail
|
|
63
|
+
|
|
64
|
+
:execute
|
|
65
|
+
@rem Setup the command line
|
|
66
|
+
|
|
67
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
68
|
+
|
|
69
|
+
@rem Execute Gradle
|
|
70
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
71
|
+
|
|
72
|
+
:end
|
|
73
|
+
@rem End local scope for the variables with windows NT shell
|
|
74
|
+
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
75
|
+
|
|
76
|
+
:fail
|
|
77
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
78
|
+
rem the _cmd.exe /c_ return code!
|
|
79
|
+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
80
|
+
exit /b 1
|
|
81
|
+
|
|
82
|
+
:mainEnd
|
|
83
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
84
|
+
|
|
85
|
+
:omega
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pluginManagement {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
gradlePluginPortal()
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
dependencyResolutionManagement {
|
|
9
|
+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
rootProject.name = "PytronShell"
|
|
16
|
+
include ':app'
|