Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 1/3] Remove support code for Python < 3.2
Date: Fri, 17 Jul 2020 04:48:48
Message-Id: 20200717044817.403211-1-mgorny@gentoo.org
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 lib/portage/tests/process/test_poll.py | 9 +++------
4 .../tests/util/futures/asyncio/test_pipe_closed.py | 7 ++-----
5 lib/portage/util/configparser.py | 13 +++----------
6 3 files changed, 8 insertions(+), 21 deletions(-)
7
8 diff --git a/lib/portage/tests/process/test_poll.py b/lib/portage/tests/process/test_poll.py
9 index f505b5049..3ea176c0d 100644
10 --- a/lib/portage/tests/process/test_poll.py
11 +++ b/lib/portage/tests/process/test_poll.py
12 @@ -1,4 +1,4 @@
13 -# Copyright 1998-2019 Gentoo Authors
14 +# Copyright 1998-2020 Gentoo Authors
15 # Distributed under the terms of the GNU General Public License v2
16
17 import functools
18 @@ -34,11 +34,8 @@ class PipeReaderTestCase(TestCase):
19
20 def test_domain_socket(self):
21 def make_pipes():
22 - if sys.version_info >= (3, 2):
23 - read_end, write_end = socket.socketpair()
24 - return (read_end.detach(), write_end.detach()), None
25 - else:
26 - self.skipTest('socket detach not supported')
27 + read_end, write_end = socket.socketpair()
28 + return (read_end.detach(), write_end.detach()), None
29 self._do_test(make_pipes)
30
31 def test_named_pipe(self):
32 diff --git a/lib/portage/tests/util/futures/asyncio/test_pipe_closed.py b/lib/portage/tests/util/futures/asyncio/test_pipe_closed.py
33 index 507385c04..b8e5556d0 100644
34 --- a/lib/portage/tests/util/futures/asyncio/test_pipe_closed.py
35 +++ b/lib/portage/tests/util/futures/asyncio/test_pipe_closed.py
36 @@ -1,4 +1,4 @@
37 -# Copyright 2018 Gentoo Foundation
38 +# Copyright 2018-2020 Gentoo Authors
39 # Distributed under the terms of the GNU General Public License v2
40
41 import errno
42 @@ -32,10 +32,7 @@ class _PipeClosedTestCase(object):
43 self._do_test(read_end, write_end)
44
45 def test_domain_socket(self):
46 - if sys.version_info >= (3, 2):
47 - read_end, write_end = socket.socketpair()
48 - else:
49 - self.skipTest('socket detach not supported')
50 + read_end, write_end = socket.socketpair()
51 self._do_test(read_end.detach(), write_end.detach())
52
53 def test_named_pipe(self):
54 diff --git a/lib/portage/util/configparser.py b/lib/portage/util/configparser.py
55 index f3452231f..9bd9f9722 100644
56 --- a/lib/portage/util/configparser.py
57 +++ b/lib/portage/util/configparser.py
58 @@ -11,16 +11,9 @@ __all__ = ['ConfigParserError', 'NoOptionError', 'ParsingError',
59 import io
60 import sys
61
62 -try:
63 - from configparser import (Error as ConfigParserError,
64 - NoOptionError, ParsingError, RawConfigParser)
65 - if sys.hexversion >= 0x3020000:
66 - from configparser import ConfigParser as SafeConfigParser
67 - else:
68 - from configparser import SafeConfigParser
69 -except ImportError:
70 - from ConfigParser import (Error as ConfigParserError,
71 - NoOptionError, ParsingError, RawConfigParser, SafeConfigParser)
72 +from configparser import (Error as ConfigParserError,
73 + NoOptionError, ParsingError, RawConfigParser)
74 +from configparser import ConfigParser as SafeConfigParser
75
76 from portage import _encodings
77 from portage import _unicode_encode
78 --
79 2.27.0

Replies