File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from .apputils .codegen import CodegenMixin
1111from .apputils .native import NativeMixin
1212from .apputils .config import ConfigMixin
13- from .apputils .windows import WindowMixin
13+ from .apputils .window_mixin import WindowMixin
1414from .apputils .extras import ExtrasMixin
1515from .apputils .shell import Shell
1616from .inspector import Inspector
File renamed without changes.
Original file line number Diff line number Diff line change @@ -17,6 +17,16 @@ def cmd_engine(args):
1717 except Exception as e :
1818 log (f"Engine Forge Failed: { e } " , style = "error" )
1919 return 1
20+ elif args .name == "native" :
21+ log (f"Building Native Iron Engine from source..." , style = "info" )
22+ try :
23+ from ..engines .native .build import build as build_native
24+
25+ build_native ()
26+ log ("Native Engine Build Successful!" , style = "success" )
27+ except Exception as e :
28+ log (f"Native Engine Build Failed: { e } " , style = "error" )
29+ return 1
2030 else :
2131 log (f"Unsupported engine: { args .name } " , style = "error" )
2232 return 1
Original file line number Diff line number Diff line change 1212import base64
1313from collections import deque
1414
15- # Import Native Engine
16- try :
17- from . dependencies import pytron_native
18- except ImportError :
19- # Fallback to check if it's in path
20- sys . path . append ( os . path . join ( os . path . dirname ( __file__ ), "dependencies" ))
15+ # Import Native Engine via Canonical Resolver
16+ from . utils import resolve_native_module
17+
18+ pytron_native = resolve_native_module ()
19+ if not pytron_native :
20+ # Final legacy fallback for simple environments
2121 try :
22- import pytron_native
22+ from . dependencies import pytron_native
2323 except ImportError :
24- print ("[CRITICAL] Could not load pytron_native engine." )
25- pytron_native = None
24+ pass
2625
2726import urllib .parse
2827from .serializer import pytron_serialize
3736class Webview :
3837 def __init__ (self , config ):
3938 if not pytron_native :
39+ ext = ".pyd" if sys .platform == "win32" else ".so"
4040 raise NativeEngineError (
41- "Pytron Native Engine binary (pytron_native.pyd/so ) is missing or could not be loaded. "
42- "Ensure it is present in 'pytron/dependencies' or your environment . "
43- "You may need to run 'pytron engine install native' or check for architecture mismatches ."
41+ f "Pytron Native Engine binary (pytron_native{ ext } ) is missing or could not be loaded. "
42+ "Ensure it is present in 'pytron/dependencies' or your path . "
43+ "Try running 'pytron engine install native' to build it for your current system ."
4444 )
4545
4646 self .config = config
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def test_on_exit_sync(self):
1111 app .on_exit (mock_func )
1212
1313 # Simulate app exit
14- from pytron .apputils .windows import WindowMixin
14+ from pytron .apputils .window_mixin import WindowMixin
1515
1616 # The exit logic usually runs through _on_exit_cleanup which we should verify
1717 # or simulate the callback execution.
Original file line number Diff line number Diff line change 22import sys
33import pytest
44from unittest .mock import MagicMock , patch
5- from pytron .apputils .windows import WindowMixin
5+ from pytron .apputils .window_mixin import WindowMixin
66
77
88# Mock App class that uses the mixin
@@ -28,7 +28,7 @@ def app():
2828
2929@pytest .fixture
3030def mock_webview ():
31- with patch ("pytron.apputils.windows .Webview" ) as mock :
31+ with patch ("pytron.apputils.window_mixin .Webview" ) as mock :
3232 # Setup the mock instance returned by the constructor
3333 instance = mock .return_value
3434 instance .config = {}
You can’t perform that action at this time.
0 commit comments