Author: Amaury Forgeot d'Arc <[email protected]>
Branch: missing-os-functions
Changeset: r62194:287249e7d15c
Date: 2013-03-07 01:03 +0100
http://bitbucket.org/pypy/pypy/changeset/287249e7d15c/

Log:    Use configure() for posix constants, instead of the host Python.

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -132,9 +132,9 @@
             EX_OK EX_USAGE EX_DATAERR EX_NOINPUT EX_NOUSER EX_NOHOST
             EX_UNAVAILABLE EX_SOFTWARE EX_OSERR EX_OSFILE EX_CANTCREAT
             EX_IOERR EX_TEMPFAIL EX_PROTOCOL EX_NOPERM EX_CONFIG EX_NOTFOUND
-            '''.split():
-        if hasattr(posix, constant):
-            value = getattr(posix, constant)
+            '''.split():  # XXX find a way to avoid duplicating the full list
+        value = getattr(rposix, constant)
+        if value is not None:
             interpleveldefs[constant] = "space.wrap(%s)" % value
 
     # XXX don't use the os module here
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -85,7 +85,8 @@
     separate_module_sources = []
     export_symbols = []
     includes=['errno.h', 'stdio.h', 'stdlib.h', 'unistd.h', 'sys/stat.h',
-              'signal.h', 'pty.h', 'sys/utsname.h', 'sys/wait.h']
+              'fcntl.h', 'signal.h', 'pty.h', 'sys/utsname.h', 'sys/wait.h',
+              'sysexits.h', 'limits.h']
 rposix_eci = ExternalCompilationInfo(
     includes=includes,
     separate_module_sources=separate_module_sources,
@@ -110,6 +111,20 @@
     symbol = 'HAVE_' + name.upper()
     setattr(CConfig, symbol, rffi_platform.Has(name))
 
+for name in '''
+        F_OK R_OK W_OK X_OK NGROUPS_MAX TMP_MAX
+        WNOHANG WCONTINUED WUNTRACED
+        O_RDONLY O_WRONLY O_RDWR O_NDELAY O_NONBLOCK O_APPEND
+        O_DSYNC O_RSYNC O_SYNC O_NOCTTY O_CREAT O_EXCL O_TRUNC
+        O_BINARY O_TEXT O_LARGEFILE O_SHLOCK O_EXLOCK
+        O_NOINHERIT O_TEMPORARY O_RANDOM O_SEQUENTIAL
+        O_ASYNC O_DIRECT O_DIRECTORY O_NOFOLLOW O_NOATIME 
+        EX_OK EX_USAGE EX_DATAERR EX_NOINPUT EX_NOUSER EX_NOHOST
+        EX_UNAVAILABLE EX_SOFTWARE EX_OSERR EX_OSFILE EX_CANTCREAT
+        EX_IOERR EX_TEMPFAIL EX_PROTOCOL EX_NOPERM EX_CONFIG EX_NOTFOUND
+        '''.split():
+    setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name))
+
 globals().update(rffi_platform.configure(CConfig))
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to