diff options
| author | Mike Frysinger <vapier@google.com> | 2020-02-03 22:11:19 +0000 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2020-02-03 23:01:07 +0000 |
| commit | 91d9587e45608a5f95cd842426b43452a60abb5e (patch) | |
| tree | dcc96a1322084b40858668581be8f9ce70b7b8e4 | |
| parent | 0bcc2d28d4b6a1dedcc01a7f48bc7bc7056d31ea (diff) | |
| download | git-repo-91d9587e45608a5f95cd842426b43452a60abb5e.tar.gz | |
Revert "Port _FileDescriptorStreamsNonBlocking to use poll()"v1.13.9.1
This reverts commit 1e01a7444536b4865feb94c398b68a936a463ddc.
Not all platforms support select.poll() currently it seems.
At least macOS's Python 2 doesn't (while macOS Python 3 does).
Lets back this out for the existing release series and once we
start repo-2 which is Python 3-only, we can put this back in.
Change-Id: I205206b0fa4fe2d755f4fbc6ec683ad125f27cc2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253072
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
| -rw-r--r-- | platform_utils.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/platform_utils.py b/platform_utils.py index 20c00334..06ef9b18 100644 --- a/platform_utils.py +++ b/platform_utils.py | |||
| @@ -90,11 +90,6 @@ class _FileDescriptorStreamsNonBlocking(FileDescriptorStreams): | |||
| 90 | """ Implementation of FileDescriptorStreams for platforms that support | 90 | """ Implementation of FileDescriptorStreams for platforms that support |
| 91 | non blocking I/O. | 91 | non blocking I/O. |
| 92 | """ | 92 | """ |
| 93 | def __init__(self): | ||
| 94 | super(_FileDescriptorStreamsNonBlocking, self).__init__() | ||
| 95 | self._poll = select.poll() | ||
| 96 | self._fd_to_stream = {} | ||
| 97 | |||
| 98 | class Stream(object): | 93 | class Stream(object): |
| 99 | """ Encapsulates a file descriptor """ | 94 | """ Encapsulates a file descriptor """ |
| 100 | def __init__(self, fd, dest, std_name): | 95 | def __init__(self, fd, dest, std_name): |
| @@ -118,18 +113,11 @@ class _FileDescriptorStreamsNonBlocking(FileDescriptorStreams): | |||
| 118 | self.fd.close() | 113 | self.fd.close() |
| 119 | 114 | ||
| 120 | def _create_stream(self, fd, dest, std_name): | 115 | def _create_stream(self, fd, dest, std_name): |
| 121 | stream = self.Stream(fd, dest, std_name) | 116 | return self.Stream(fd, dest, std_name) |
| 122 | self._fd_to_stream[stream.fileno()] = stream | ||
| 123 | self._poll.register(stream, select.POLLIN) | ||
| 124 | return stream | ||
| 125 | |||
| 126 | def remove(self, stream): | ||
| 127 | self._poll.unregister(stream) | ||
| 128 | del self._fd_to_stream[stream.fileno()] | ||
| 129 | super(_FileDescriptorStreamsNonBlocking, self).remove(stream) | ||
| 130 | 117 | ||
| 131 | def select(self): | 118 | def select(self): |
| 132 | return [self._fd_to_stream[fd] for fd, _ in self._poll.poll()] | 119 | ready_streams, _, _ = select.select(self.streams, [], []) |
| 120 | return ready_streams | ||
| 133 | 121 | ||
| 134 | 122 | ||
| 135 | class _FileDescriptorStreamsThreads(FileDescriptorStreams): | 123 | class _FileDescriptorStreamsThreads(FileDescriptorStreams): |
