]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Be consistent in platform checks: use os.name == 'nt' everywhere, replacing
authorBen Darnell <bdarnell@beaker.local>
Thu, 25 Mar 2010 23:00:09 +0000 (16:00 -0700)
committerBen Darnell <bdarnell@beaker.local>
Thu, 25 Mar 2010 23:00:09 +0000 (16:00 -0700)
uses of os.name == 'posix' and sys.platform.startswith('win')

tornado/httpserver.py
tornado/ioloop.py

index be350785efc731880542e7192759653ccceda417..a7ec57eec4b7afbb8e119789aa3a16dd2a7d372a 100644 (file)
 
 import cgi
 import errno
-try:
-    import fcntl
-except ImportError:
-    import sys
-    if sys.platform.startswith("win"):
-        import win32_support as fcntl
-    else:
-        raise
 import functools
 import ioloop
 import iostream
@@ -35,6 +27,14 @@ import socket
 import time
 import urlparse
 
+try:
+    import fcntl
+except ImportError:
+    if os.name == 'nt':
+        import win32_support as fcntl
+    else:
+        raise
+
 try:
     import ssl # Python 2.6+
 except ImportError:
index 572b48c20e5af95456eba031ff68e83cdbdb3635..b42dfff9f8b8a23db367cbe14aa53d7d8f40c8d8 100644 (file)
 import bisect
 import errno
 import os
+import logging
+import select
+import time
+
 try:
     import fcntl
 except ImportError:
-    if os.name != 'posix':
+    if os.name == 'nt':
         import win32_support
         import win32_support as fcntl
     else:
         raise
-import logging
-import select
-import time
-
 
 _log = logging.getLogger("tornado.ioloop")
 
@@ -101,7 +101,7 @@ class IOLoop(object):
 
         # Create a pipe that we send bogus data to when we want to wake
         # the I/O loop when it is idle
-        if os.name == 'posix':
+        if os.name != 'nt':
             r, w = os.pipe()
             self._set_nonblocking(r)
             self._set_nonblocking(w)