kopia lustrzana https://github.com/micropython/micropython-lib
os: Make listdir() accept bytes arg and have corresponding semantics.
rodzic
dc6a6d096f
commit
5b4e7d9ec8
|
@ -1,4 +1,4 @@
|
||||||
srctype = micropython-lib
|
srctype = micropython-lib
|
||||||
type = package
|
type = package
|
||||||
version = 0.0.8
|
version = 0.0.9
|
||||||
author = Paul Sokolovsky
|
author = Paul Sokolovsky
|
||||||
|
|
|
@ -93,10 +93,13 @@ def ilistdir_ex(path="."):
|
||||||
yield dirent
|
yield dirent
|
||||||
|
|
||||||
def listdir(path="."):
|
def listdir(path="."):
|
||||||
|
is_bytes = type(path) is bytes
|
||||||
res = []
|
res = []
|
||||||
for dirent in ilistdir_ex(path):
|
for dirent in ilistdir_ex(path):
|
||||||
fname = str(dirent[4].split('\0', 1)[0], "ascii")
|
fname = str(dirent[4].split('\0', 1)[0], "ascii")
|
||||||
if fname != "." and fname != "..":
|
if fname != "." and fname != "..":
|
||||||
|
if is_bytes:
|
||||||
|
fname = fsencode(fname)
|
||||||
res.append(fname)
|
res.append(fname)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
setup(name='micropython-os',
|
setup(name='micropython-os',
|
||||||
version='0.0.8',
|
version='0.0.9',
|
||||||
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