[pypy-svn] r46281 - pypy/branch/pypy-more-rtti-inprogress/rpython/module

arigo at codespeak.net arigo at codespeak.net
Mon Sep 3 17:07:15 CEST 2007


Author: arigo
Date: Mon Sep  3 17:07:15 2007
New Revision: 46281

Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
Log:
Fix os.utime() for Linux.


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/module/ll_os.py	Mon Sep  3 17:07:15 2007
@@ -57,7 +57,6 @@
     SEEK_CUR = platform.DefinedConstantInteger('SEEK_CUR')
     SEEK_END = platform.DefinedConstantInteger('SEEK_END')
 
-    HAVE_UTIMES = platform.Has('utimes')
     UTIMBUF     = platform.Struct('struct '+underscore_on_windows+'utimbuf',
                                   [('actime', rffi.INT),
                                    ('modtime', rffi.INT)])
@@ -145,14 +144,22 @@
         UTIMBUFP = lltype.Ptr(self.UTIMBUF)
         os_utime = self.llexternal('utime', [rffi.CCHARP, UTIMBUFP], rffi.INT)
 
-        if self.HAVE_UTIMES:
+        class CConfig:
+            _includes_ = ['sys/time.h']
+            HAVE_UTIMES = platform.Has('utimes')
+        config = platform.configure(CConfig)
+
+        if config['HAVE_UTIMES']:
             class CConfig:
+                _includes_ = ['sys/time.h']
                 TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.LONG),
                                                              ('tv_usec', rffi.LONG)])
             config = platform.configure(CConfig)
             TIMEVAL = config['TIMEVAL']
             TIMEVAL2P = lltype.Ptr(lltype.FixedSizeArray(TIMEVAL, 2))
-            os_utimes = self.llexternal('utimes', [rffi.CCHARP, TIMEVAL2P], rffi.INT)
+            os_utimes = self.llexternal('utimes', [rffi.CCHARP, TIMEVAL2P],
+                                        rffi.INT,
+                                        includes=['sys/time.h'])
 
             def os_utime_platform(path, actime, modtime):
                 import math



More information about the Pypy-commit mailing list