[pypy-commit] pypy missing-os-functions: Configure wait macros individually

amauryfa noreply at buildbot.pypy.org
Fri Mar 8 08:24:14 CET 2013


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: missing-os-functions
Changeset: r62220:dc601bc3b3c5
Date: 2013-03-08 08:22 +0100
http://bitbucket.org/pypy/pypy/changeset/dc601bc3b3c5/

Log:	Configure wait macros individually

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
@@ -142,8 +142,8 @@
         interpleveldefs['pathconf_names'] = 'space.wrap(os.pathconf_names)'
 
     # Macros for process exit statuses: WIFEXITED &co
-    if rposix.HAVE_WAIT:
-        for name in rposix.wait_macros:
+    for name in rposix.wait_macros:
+        if getattr(rposix, 'HAVE_' + name):
             interpleveldefs[name] = 'interp_posix.' + name
 
     def __init__(self, space, w_name):
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -125,6 +125,13 @@
         '''.split():
     setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name))
 
+wait_macros_returning_int = ['WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']
+wait_macros_returning_bool = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+                              'WIFSIGNALED', 'WIFEXITED']
+wait_macros = wait_macros_returning_int + wait_macros_returning_bool
+for name in wait_macros:
+    setattr(CConfig, 'HAVE_' + name, rffi_platform.Defined(name))
+
 globals().update(rffi_platform.configure(CConfig))
 
 
@@ -174,14 +181,9 @@
 c_fchmod = external('fchmod', [rffi.INT, rffi.MODE_T], rffi.INT)
 c_fchown = external('fchown', [rffi.INT, rffi.INT, rffi.INT], rffi.INT)
 
-if HAVE_WAIT:
-    wait_macros_returning_int = ['WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']
-    wait_macros_returning_bool = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
-                                 'WIFSIGNALED', 'WIFEXITED']
-    wait_macros = wait_macros_returning_int + wait_macros_returning_bool
-    for name in wait_macros:
-        globals()[name] = external(name, [lltype.Signed], lltype.Signed,
-                                   macro=True)
+for name in wait_macros:
+    globals()[name] = external(name, [lltype.Signed], lltype.Signed,
+                               macro=True)
 
 
 #___________________________________________________________________


More information about the pypy-commit mailing list