Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: more-rposix
Changeset: r74422:12a878a11f79
Date: 2014-11-09 20:54 +0100
http://bitbucket.org/pypy/pypy/changeset/12a878a11f79/

Log:    Move os.ttyname()

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -826,7 +826,16 @@
     if not is_valid_fd(fd):
         return False
     return c_isatty(fd) != 0
-    
+
+c_ttyname = external('ttyname', [lltype.Signed], rffi.CCHARP, releasegil=False)
+
+@replace_os_function('ttyname')
+def ttyname(fd):
+    l_name = os_ttyname(fd)
+    if not l_name:
+        raise OSError(get_errno(), "ttyname raised")
+    return rffi.charp2str(l_name)
+
 c_strerror = external('strerror', [rffi.INT], rffi.CCHARP,
                       releasegil=False)
 
diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -102,8 +102,6 @@
 else:
     includes += ['sys/utime.h', 'sys/types.h']
 
-_CYGWIN = sys.platform == 'cygwin'
-
 class CConfig:
     """
     Definitions for platform integration.
@@ -119,19 +117,6 @@
     _compilation_info_ = ExternalCompilationInfo(
         includes=includes
     )
-    if not _WIN32:
-        CLOCK_T = platform.SimpleType('clock_t', rffi.INT)
-
-        TMS = platform.Struct(
-            'struct tms', [('tms_utime', rffi.INT),
-                           ('tms_stime', rffi.INT),
-                           ('tms_cutime', rffi.INT),
-                           ('tms_cstime', rffi.INT)])
-
-
-    SEEK_SET = platform.DefinedConstantInteger('SEEK_SET')
-    SEEK_CUR = platform.DefinedConstantInteger('SEEK_CUR')
-    SEEK_END = platform.DefinedConstantInteger('SEEK_END')
 
 
 class RegisterOs(BaseLazyRegistering):
@@ -168,21 +153,6 @@
             return ll_os_stat.register_statvfs_variant('statvfs', traits)
 
 
-    # ------------------------------- os.W* ---------------------------------
-
-    @registering_if(os, 'ttyname')
-    def register_os_ttyname(self):
-        os_ttyname = self.llexternal('ttyname', [lltype.Signed], rffi.CCHARP, 
releasegil=False)
-
-        def ttyname_llimpl(fd):
-            l_name = os_ttyname(fd)
-            if not l_name:
-                raise OSError(rposix.get_errno(), "ttyname raised")
-            return rffi.charp2str(l_name)
-
-        return extdef([int], str, "ll_os.ttyname",
-                      llimpl=ttyname_llimpl)
-
 # ____________________________________________________________
 # Support for os.environ
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to