Commit Graph

22 Commits

Author SHA1 Message Date
Paul Sokolovsky ec314c951d unix/modos: getenv(): Handle non-existing envvar correctly. 2015-11-14 17:12:04 +02:00
Paul Sokolovsky 908f5159cf unix/modos: Add Windows workaround for mkdir(). 2015-11-14 02:35:38 +02:00
Paul Sokolovsky 27dafa5ed5 unix/modos: Add mkdir().
Dependency of upip.
2015-11-13 22:26:51 +02:00
Paul Sokolovsky d8557834c0 unix/modos: Add getenv().
Dependency of upip.
2015-11-13 21:30:06 +02:00
Paul Sokolovsky 39a380b621 unix/modos: Android Bionic lacks statvfs(), has BSD statfs(). 2015-10-19 21:43:20 +03:00
Paul Sokolovsky 2ca7b05552 unix/modos: Checking config macros requires mpconfig.h. 2015-10-18 03:05:47 +03:00
Paul Sokolovsky f8e9ef5cd0 unix/modos: Guard sys/statvfs.h include with MICROPY_PY_OS_STATVFS check.
E.g. Windows lacks this header.
2015-10-18 02:54:20 +03:00
Paul Sokolovsky c3000b6f69 unix/modos: Add statvfs() function.
Another function (like stat) which is problematic to deal with on ABI level
(FFI), as struct statvfs layout may differ unpredictably between OSes and
even different versions of a same OS. So, implement it in C, returning a
10-element tuple of f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files,
f_ffree, f_favail, f_flag, f_namemax. This is exactly the order described
in Python3 docs, https://docs.python.org/3/library/os.html#os.statvfs
(but note that os.statvfs() should make these values available as
attributes).
2015-10-18 01:21:23 +03:00
Damien George 6d7e47087f unix: Prefix includes with py/; remove need for -I../py. 2015-01-01 20:40:19 +00:00
Paul Sokolovsky 9c658b6afc unix, windows: Add _os.system() call.
system() is the basic function to support automation of tasks, so have it
available builtin, for example, for bootstrapping rest of micropython
environment.
2014-12-23 12:56:24 +00:00
Nikita Nazarenko d51107927d unix: add unlink function to os module 2014-12-10 21:49:24 +00:00
Damien George 3b603f29ec Use MP_DEFINE_CONST_DICT macro to define module dicts.
This is just a clean-up of the code.  Generated code is exactly the
same.
2014-11-29 14:39:27 +00:00
Damien George d182b98a37 py: Change all uint to mp_uint_t in obj.h.
Part of code cleanup, working towards resolving issue #50.
2014-08-30 14:19:41 +01:00
Damien George bb4c6f35c6 py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.
Addresses issue #724.
2014-07-31 10:49:14 +01:00
Damien George 40f3c02682 Rename machine_(u)int_t to mp_(u)int_t.
See discussion in issue #50.
2014-07-03 13:25:24 +01:00
stijn 5478ed18ea unix: Fix mpconfig.h not being included before misc.h
This fixes count_lead_ones in misc.h not compiling due to unknown types
2014-06-28 20:49:39 +02:00
Emmanuel Blot f6932d6506 Prefix ARRAY_SIZE with micropython prefix MP_ 2014-06-19 18:54:34 +02:00
Marcus von Appen 585a3394df - Cast the struct stat sb.st_ino field to machine_int_t explicitly to avoid a
cast error in MP_OBJ_NEW_SMALL_INT(). This is necessary for FreeBSD, where
  st_ino is of different size
- If MP_CLOCKS_PER_SEC is defined on the target host, simply define CLOCK_DIV
  as a fraction, regardless of the value of MP_CLOCKS_PER_SEC.
  FreeBSD uses a non-POSIX compliant value of 128 for CLOCKS_PER_SEC
2014-06-07 09:50:18 +02:00
Paul Sokolovsky 0405b2210d modos: stat(): Accept bytes argument. 2014-05-26 02:02:47 +03:00
Damien George efaef6eea3 unix: Fix casting issue, int to small int object. 2014-05-21 20:53:56 +01:00
Paul Sokolovsky 767e45c290 modos: Clean 64-bit issues. 2014-05-15 18:38:54 +03:00
Paul Sokolovsky 0c124c3123 unix: Add "_os" module with stat().
stat() is bad function to use using FFI, because its ABI is largely private.
To start with, Glibc .so doesn't even have "stat" symbol. Then, layout of
struct stat is too implementation-dependent. So, introduce _os to deal
with stat() and other similar cases.
2014-05-14 22:08:45 +03:00