os: Make listdir() accept bytes arg and have corresponding semantics.

pull/118/head
Paul Sokolovsky 2014-05-26 01:58:36 +03:00
rodzic dc6a6d096f
commit 5b4e7d9ec8
3 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
srctype = micropython-lib
type = package
version = 0.0.8
version = 0.0.9
author = Paul Sokolovsky

Wyświetl plik

@ -93,10 +93,13 @@ def ilistdir_ex(path="."):
yield dirent
def listdir(path="."):
is_bytes = type(path) is bytes
res = []
for dirent in ilistdir_ex(path):
fname = str(dirent[4].split('\0', 1)[0], "ascii")
if fname != "." and fname != "..":
if is_bytes:
fname = fsencode(fname)
res.append(fname)
return res

Wyświetl plik

@ -6,7 +6,7 @@ from setuptools import setup
setup(name='micropython-os',
version='0.0.8',
version='0.0.9',
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.",
url='https://github.com/micropython/micropython/issues/405',