kopia lustrzana https://github.com/micropython/micropython-lib
os: Add system().
rodzic
d32312e2d8
commit
4e3154ba21
|
@ -1,5 +1,5 @@
|
||||||
srctype = micropython-lib
|
srctype = micropython-lib
|
||||||
type = package
|
type = package
|
||||||
version = 0.1.2
|
version = 0.1.3
|
||||||
author = Paul Sokolovsky
|
author = Paul Sokolovsky
|
||||||
depends = libc
|
depends = libc
|
||||||
|
|
|
@ -28,6 +28,7 @@ pipe_ = libc.func("i", "pipe", "p")
|
||||||
_exit_ = libc.func("v", "_exit", "i")
|
_exit_ = libc.func("v", "_exit", "i")
|
||||||
getpid_ = libc.func("i", "getpid", "")
|
getpid_ = libc.func("i", "getpid", "")
|
||||||
waitpid_ = libc.func("i", "waitpid", "ipi")
|
waitpid_ = libc.func("i", "waitpid", "ipi")
|
||||||
|
system_ = libc.func("i", "system", "s")
|
||||||
|
|
||||||
R_OK = const(4)
|
R_OK = const(4)
|
||||||
W_OK = const(2)
|
W_OK = const(2)
|
||||||
|
@ -167,6 +168,10 @@ def waitpid(pid, opts):
|
||||||
check_error(r)
|
check_error(r)
|
||||||
return (r, a[0])
|
return (r, a[0])
|
||||||
|
|
||||||
|
def system(command):
|
||||||
|
r = system_(command)
|
||||||
|
check_error(r)
|
||||||
|
return r
|
||||||
|
|
||||||
def fsencode(s):
|
def fsencode(s):
|
||||||
if type(s) is bytes:
|
if type(s) is bytes:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
setup(name='micropython-os',
|
setup(name='micropython-os',
|
||||||
version='0.1.2',
|
version='0.1.3',
|
||||||
description='os module for MicroPython',
|
description='os module for MicroPython',
|
||||||
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
|
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
|
||||||
url='https://github.com/micropython/micropython/issues/405',
|
url='https://github.com/micropython/micropython/issues/405',
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
print("Executing ls -l:")
|
||||||
|
os.system("ls -l")
|
Ładowanie…
Reference in New Issue