posix: ignore more blocking errors and EINTR in write just as in read

- catch all the errno's that BlockingIOError would cover
- catch EINTR

fixes #227
diff --git a/serial/serialposix.py b/serial/serialposix.py
index a465e3e..278ce47 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -561,12 +561,20 @@
                 tx_len -= n
             except SerialException:
                 raise
-            except OSError as v:
-                if v.errno != errno.EAGAIN:
-                    raise SerialException('write failed: {}'.format(v))
-                # still calculate and check timeout
-                if timeout.expired():
-                    raise writeTimeoutError
+            except OSError as e:
+                # this is for Python 3.x where select.error is a subclass of
+                # OSError ignore BlockingIOErrors and EINTR. other errors are shown
+                # https://www.python.org/dev/peps/pep-0475.
+                if e.errno not in (errno.EAGAIN, errno.EALREADY, errno.EWOULDBLOCK, errno.EINPROGRESS, errno.EINTR):
+                    raise SerialException('write failed: {}'.format(e))
+            except select.error as e:
+                # this is for Python 2.x
+                # ignore BlockingIOErrors and EINTR. all errors are shown
+                # see also http://www.python.org/dev/peps/pep-3151/#select
+                if e[0] not in (errno.EAGAIN, errno.EALREADY, errno.EWOULDBLOCK, errno.EINPROGRESS, errno.EINTR)):
+                    raise SerialException('write failed: {}'.format(e))
+            if timeout.expired():
+                raise writeTimeoutError
         return length - len(d)
 
     def flush(self):