Skip to content
This repository was archived by the owner on Apr 25, 2021. It is now read-only.

Commit 2fb37b0

Browse files
committed
Update opos for spawn python shell
1 parent 3267839 commit 2fb37b0

File tree

6 files changed

+4
-153
lines changed

6 files changed

+4
-153
lines changed

src/main/resources/assets/openpython/opos/bin/python.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,11 @@
11
import sys
22

3-
import micropython
4-
import uos
53
from ucode import MICROPY_GIT_TAG, MICROPY_BUILD_DATE, MICROPY_HW_BOARD_NAME, MICROPY_HW_MCU_NAME
64
from ucode import repl_input, repl_compile, repl_call
75

8-
import computer
9-
10-
11-
class Command:
12-
def __init__(self, func):
13-
self.func = func
14-
15-
def __call__(self, *args, **kwargs):
16-
return self.func(*args, **kwargs)
17-
18-
def __repr__(self):
19-
result = self.func()
20-
if result is None:
21-
# monitor.heightPos -= 1
22-
return ""
23-
else:
24-
return result
25-
26-
27-
def _listdir(path="/"):
28-
print([path for path, *_ in uos.ilistdir(path)])
29-
30-
31-
def _cls():
32-
pass
33-
# monitor.widthPos = 1
34-
# monitor.heightPos = 1
35-
# gpu.fill(1, 1, monitor.widthSize, monitor.heightSize, " ")
36-
37-
38-
def mem_info():
39-
import gc
40-
gc.collect()
41-
micropython.mem_info()
42-
43-
44-
def _show(name=None):
45-
if name is None:
46-
help("modules")
47-
return
48-
49-
module = __import__(name)
50-
help(module)
51-
52-
53-
commands = dict(
54-
listdir=Command(_listdir),
55-
cls=Command(_cls),
56-
mem=Command(mem_info),
57-
help=Command(help),
58-
show=Command(_show),
59-
reboot=Command(computer.reboot),
60-
)
61-
626

637
def main():
648
context = {"__name__": "<shell>"}
65-
context.update(commands)
669

6710
print("MicroPython",
6811
MICROPY_GIT_TAG,

src/main/resources/assets/openpython/opos/bin/shell.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/main/resources/assets/openpython/opos/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def init():
5959
execfile("/boot/" + filename, context)
6060

6161
from shell import spawn
62-
spawn("/bin/shell.py")
62+
spawn("/bin/python.py")
6363

6464

6565
if __name__ == "__main__":

src/main/resources/assets/openpython/opos/lib/event.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ def ignore(name, callback):
4949
return True
5050

5151

52-
def timer(interval, callback, times):
53-
# event.register(false, callback, interval, times)
54-
handler = {
55-
"key": key,
56-
}
57-
58-
5952
def register(name):
6053
def wrapper(callback):
6154
listen(name, callback)

src/main/resources/assets/openpython/opos/lib/os.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from uos import *
22

3-
import ocpath as path
3+
# import ocpath as path
44
from ocpath import curdir, pardir, sep, extsep, altsep, pathsep, linesep, defpath, devnull
55

66
__all__ = [
77
# uos.*
88
"chdir", "getcwd", "ilistdir", "listdir", "mkdir", "remove", "rmdir", "rename", "stat", "statvfs", "sync",
99
"urandom", "dupterm", "mount", "umount",
1010
# ocpath
11-
"path",
11+
# "path",
1212
# ocpath.*
1313
"curdir", "pardir", "sep", "extsep", "altsep", "pathsep", "linesep", "defpath", "devnull",
1414
# os

src/main/resources/assets/openpython/opos/lib/shell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55

66
sys.modules["usys"] = sys
7+
# sys.modules["sys"] = sys
78

89

910
def spawn(path):

0 commit comments

Comments
 (0)