kopia lustrzana https://github.com/micropython/micropython-lib
os: Add chdir(), rename().
rodzic
4e3154ba21
commit
27da05f2ac
|
@ -1,5 +1,5 @@
|
||||||
srctype = micropython-lib
|
srctype = micropython-lib
|
||||||
type = package
|
type = package
|
||||||
version = 0.1.3
|
version = 0.1.4
|
||||||
author = Paul Sokolovsky
|
author = Paul Sokolovsky
|
||||||
depends = libc
|
depends = libc
|
||||||
|
|
|
@ -13,7 +13,9 @@ except:
|
||||||
libc = _libc.get()
|
libc = _libc.get()
|
||||||
|
|
||||||
errno_ = libc.var("i", "errno")
|
errno_ = libc.var("i", "errno")
|
||||||
|
chdir_ = libc.func("i", "chdir", "s")
|
||||||
mkdir_ = libc.func("i", "mkdir", "si")
|
mkdir_ = libc.func("i", "mkdir", "si")
|
||||||
|
rename_ = libc.func("i", "rename", "ss")
|
||||||
unlink_ = libc.func("i", "unlink", "s")
|
unlink_ = libc.func("i", "unlink", "s")
|
||||||
rmdir_ = libc.func("i", "rmdir", "s")
|
rmdir_ = libc.func("i", "rmdir", "s")
|
||||||
getwd_ = libc.func("s", "getwd", "s")
|
getwd_ = libc.func("s", "getwd", "s")
|
||||||
|
@ -60,6 +62,10 @@ def mkdir(name, mode=0o777):
|
||||||
e = mkdir_(name, mode)
|
e = mkdir_(name, mode)
|
||||||
check_error(e)
|
check_error(e)
|
||||||
|
|
||||||
|
def rename(old, new):
|
||||||
|
e = rename_(old, new)
|
||||||
|
check_error(e)
|
||||||
|
|
||||||
def unlink(name):
|
def unlink(name):
|
||||||
e = unlink_(name)
|
e = unlink_(name)
|
||||||
check_error(e)
|
check_error(e)
|
||||||
|
@ -145,6 +151,10 @@ def close(fd):
|
||||||
def access(path, mode):
|
def access(path, mode):
|
||||||
return access_(path, mode) == 0
|
return access_(path, mode) == 0
|
||||||
|
|
||||||
|
def chdir(dir):
|
||||||
|
r = chdir_(dir)
|
||||||
|
check_error(r)
|
||||||
|
|
||||||
def fork():
|
def fork():
|
||||||
r = fork_()
|
r = fork_()
|
||||||
check_error(r)
|
check_error(r)
|
||||||
|
|
|
@ -6,7 +6,7 @@ from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
setup(name='micropython-os',
|
setup(name='micropython-os',
|
||||||
version='0.1.3',
|
version='0.1.4',
|
||||||
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',
|
||||||
|
|
Ładowanie…
Reference in New Issue