[PATCH] Don't use select on files under windows



On Tue, Apr 14, 2009 at 10:03 PM, Vincent Legoll
<vincent legoll gmail com> wrote:
> I tried to run meld on windows and managed to get it to work,
> we still need to patch the code (patches coming) but it's only
> to fix small glitches.

First

select.select() does not work on files under windows,
use a dummy function instead.

-- 
Vincent Legoll
Index: misc.py
===================================================================
--- misc.py	(revision 1347)
+++ misc.py	(working copy)
@@ -17,10 +17,10 @@
 """Module of commonly used helper classes and functions
 """
 
+import sys
 import copy
 import os
 from gettext import gettext as _
-import select
 import popen2
 import errno
 import gobject
@@ -29,6 +29,15 @@
 import re
 import signal
 
+# select.select() work on files only on unix
+if sys.platform != 'win32':
+    import select as _select
+    select = _select.select
+else:
+    def select(self, rlist, wlist, xlist, timeout=None):
+        # TODO: maybe we should yield a bit...
+        return rlist, wlist, xlist
+
 whitespace_re = re.compile(r"\s")
 
 def shelljoin( command ):
@@ -199,7 +208,7 @@
                 os.chdir( savepwd )
             bits = []
             while len(bits) == 0 or bits[-1] != "":
-                state = select.select([childout, childerr], [], [childout, childerr], yield_interval)
+                state = select([childout, childerr], [], [childout, childerr], yield_interval)
                 if len(state[0]) == 0:
                     if len(state[2]) == 0:
                         yield None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]