From 3de140698c3084d17efea3ef6d285602e7073cb5 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 11 Jul 2014 02:20:04 +0300 Subject: [PATCH] os: Don't use legacy getwd() libc function, not available in all libc's. For example, not available in uclibc. --- os/metadata.txt | 2 +- os/os/__init__.py | 4 ++-- os/setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/os/metadata.txt b/os/metadata.txt index 22926aa3..9b8e09af 100644 --- a/os/metadata.txt +++ b/os/metadata.txt @@ -1,5 +1,5 @@ srctype = micropython-lib type = package -version = 0.1.6 +version = 0.1.7 author = Paul Sokolovsky depends = libc, errno, stat diff --git a/os/os/__init__.py b/os/os/__init__.py index a0b34b68..a4b11a3f 100644 --- a/os/os/__init__.py +++ b/os/os/__init__.py @@ -18,7 +18,7 @@ mkdir_ = libc.func("i", "mkdir", "si") rename_ = libc.func("i", "rename", "ss") unlink_ = libc.func("i", "unlink", "s") rmdir_ = libc.func("i", "rmdir", "s") -getwd_ = libc.func("s", "getwd", "s") +getcwd_ = libc.func("s", "getcwd", "si") opendir_ = libc.func("P", "opendir", "s") readdir_ = libc.func("P", "readdir", "P") read_ = libc.func("i", "read", "ipi") @@ -56,7 +56,7 @@ def raise_error(): def getcwd(): buf = bytearray(512) - return getwd_(buf) + return getcwd_(buf, 512) def mkdir(name, mode=0o777): e = mkdir_(name, mode) diff --git a/os/setup.py b/os/setup.py index 504bf4c9..a9692958 100644 --- a/os/setup.py +++ b/os/setup.py @@ -6,7 +6,7 @@ from setuptools import setup setup(name='micropython-os', - version='0.1.6', + version='0.1.7', 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',