Skip to content
Snippets Groups Projects
Verified Commit 688deab9 authored by dos's avatar dos
Browse files

py,st3m: Improve mangling of app paths in the simulator

parent cb00086b
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from st3m.input import InputState ...@@ -8,6 +8,7 @@ from st3m.input import InputState
import st3m.wifi import st3m.wifi
from st3m.goose import Optional, List, Dict from st3m.goose import Optional, List, Dict
from st3m.logging import Log from st3m.logging import Log
from st3m.utils import is_simulator
from st3m import settings from st3m import settings
from ctx import Context from ctx import Context
from st3m.ui import led_patterns from st3m.ui import led_patterns
...@@ -179,11 +180,13 @@ class BundleMetadata: ...@@ -179,11 +180,13 @@ class BundleMetadata:
containing_path = os.path.dirname(self.path) containing_path = os.path.dirname(self.path)
package_name = os.path.basename(self.path) package_name = os.path.basename(self.path)
if sys.path[1].endswith("python_payload"): if is_simulator():
# We are in the simulator. Hack around to get this to work. # We are in the simulator. Hack around to get this to work.
prefix = "/flash/sys" prefix = "/flash/sys"
assert containing_path.startswith(prefix) if containing_path.startswith(prefix):
containing_path = containing_path.replace(prefix, sys.path[1]) containing_path = containing_path.replace(prefix, sys.path[1])
else:
containing_path = containing_path.replace("/flash", "/tmp/flow3r-sim")
new_sys_path = old_sys_path + [containing_path] new_sys_path = old_sys_path + [containing_path]
self._sys_path_set(new_sys_path) self._sys_path_set(new_sys_path)
......
import math import math
import os import os
import sys_kernel
try: try:
import inspect import inspect
...@@ -146,4 +147,8 @@ def sd_card_plugged() -> bool: ...@@ -146,4 +147,8 @@ def sd_card_plugged() -> bool:
return False return False
def is_simulator() -> bool:
return sys_kernel.hardware_version() == "simulator"
tau = math.pi * 2 tau = math.pi * 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment