1 |
commit: 1aa33a8638610686ee2ca13d7f8c26604f2dd7ec |
2 |
Author: Manuel Rüger <manuel <AT> rueg <DOT> eu> |
3 |
AuthorDate: Mon Feb 3 08:08:46 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 3 09:05:04 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1aa33a86 |
7 |
|
8 |
Drop compat code for ancient python versions |
9 |
|
10 |
Closes: https://github.com/gentoo/portage/pull/503 |
11 |
Signed-off-by: Manuel Rüger <manuel <AT> rueg.eu> |
12 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
13 |
|
14 |
lib/portage/_emirrordist/FetchTask.py | 9 --------- |
15 |
lib/portage/data.py | 10 ---------- |
16 |
lib/portage/dbapi/vartree.py | 7 ------- |
17 |
lib/portage/dispatch_conf.py | 9 --------- |
18 |
lib/portage/util/__init__.py | 8 -------- |
19 |
lib/portage/util/_desktop_entry.py | 8 -------- |
20 |
lib/portage/xml/metadata.py | 22 +++++++--------------- |
21 |
repoman/lib/repoman/_subprocess.py | 18 ------------------ |
22 |
repoman/lib/repoman/gpg.py | 9 --------- |
23 |
9 files changed, 7 insertions(+), 93 deletions(-) |
24 |
|
25 |
diff --git a/lib/portage/_emirrordist/FetchTask.py b/lib/portage/_emirrordist/FetchTask.py |
26 |
index 0441fc677..322de79ba 100644 |
27 |
--- a/lib/portage/_emirrordist/FetchTask.py |
28 |
+++ b/lib/portage/_emirrordist/FetchTask.py |
29 |
@@ -444,15 +444,6 @@ class FetchTask(CompositeTask): |
30 |
args = [portage.util.varexpand(x, mydict=variables) |
31 |
for x in args] |
32 |
|
33 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
34 |
- not os.path.isabs(args[0]): |
35 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
36 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
37 |
- fullname = portage.process.find_binary(args[0]) |
38 |
- if fullname is None: |
39 |
- raise portage.exception.CommandNotFound(args[0]) |
40 |
- args[0] = fullname |
41 |
- |
42 |
args = [_unicode_encode(x, |
43 |
encoding=_encodings['fs'], errors='strict') for x in args] |
44 |
|
45 |
|
46 |
diff --git a/lib/portage/data.py b/lib/portage/data.py |
47 |
index 28d6eb79d..f9d67fc3d 100644 |
48 |
--- a/lib/portage/data.py |
49 |
+++ b/lib/portage/data.py |
50 |
@@ -195,16 +195,6 @@ def _get_global(k): |
51 |
# SIGPIPE problems with nss_ldap. |
52 |
cmd = ["id", "-G", _portage_username] |
53 |
|
54 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000: |
55 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
56 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
57 |
- fullname = portage.process.find_binary(cmd[0]) |
58 |
- if fullname is None: |
59 |
- globals()[k] = v |
60 |
- _initialized_globals.add(k) |
61 |
- return v |
62 |
- cmd[0] = fullname |
63 |
- |
64 |
encoding = portage._encodings['content'] |
65 |
cmd = [portage._unicode_encode(x, |
66 |
encoding=encoding, errors='strict') for x in cmd] |
67 |
|
68 |
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
69 |
index 050366528..3687b471b 100644 |
70 |
--- a/lib/portage/dbapi/vartree.py |
71 |
+++ b/lib/portage/dbapi/vartree.py |
72 |
@@ -661,13 +661,6 @@ class vardbapi(dbapi): |
73 |
def _aux_cache_init(self): |
74 |
aux_cache = None |
75 |
open_kwargs = {} |
76 |
- if sys.hexversion >= 0x3000000 and sys.hexversion < 0x3020000: |
77 |
- # Buffered io triggers extreme performance issues in |
78 |
- # Unpickler.load() (problem observed with python-3.0.1). |
79 |
- # Unfortunately, performance is still poor relative to |
80 |
- # python-2.x, but buffering makes it much worse (problem |
81 |
- # appears to be solved in Python >=3.2 at least). |
82 |
- open_kwargs["buffering"] = 0 |
83 |
try: |
84 |
with open(_unicode_encode(self._aux_cache_filename, |
85 |
encoding=_encodings['fs'], errors='strict'), |
86 |
|
87 |
diff --git a/lib/portage/dispatch_conf.py b/lib/portage/dispatch_conf.py |
88 |
index eaea59393..2fab19f1a 100644 |
89 |
--- a/lib/portage/dispatch_conf.py |
90 |
+++ b/lib/portage/dispatch_conf.py |
91 |
@@ -41,15 +41,6 @@ def diffstatusoutput(cmd, file1, file2): |
92 |
# raise a UnicodeDecodeError which makes the output inaccessible. |
93 |
args = shlex_split(cmd % (file1, file2)) |
94 |
|
95 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
96 |
- not os.path.isabs(args[0]): |
97 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
98 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
99 |
- fullname = portage.process.find_binary(args[0]) |
100 |
- if fullname is None: |
101 |
- raise portage.exception.CommandNotFound(args[0]) |
102 |
- args[0] = fullname |
103 |
- |
104 |
args = [portage._unicode_encode(x, errors='strict') for x in args] |
105 |
proc = subprocess.Popen(args, |
106 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
107 |
|
108 |
diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py |
109 |
index d63d5f156..154431a53 100644 |
110 |
--- a/lib/portage/util/__init__.py |
111 |
+++ b/lib/portage/util/__init__.py |
112 |
@@ -1802,14 +1802,6 @@ def find_updated_config_files(target_root, config_protect): |
113 |
mycommand += " ! -name '.*~' ! -iname '.*.bak' -print0" |
114 |
cmd = shlex_split(mycommand) |
115 |
|
116 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000: |
117 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
118 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
119 |
- fullname = portage.process.find_binary(cmd[0]) |
120 |
- if fullname is None: |
121 |
- raise portage.exception.CommandNotFound(cmd[0]) |
122 |
- cmd[0] = fullname |
123 |
- |
124 |
cmd = [_unicode_encode(arg, encoding=encoding, errors='strict') |
125 |
for arg in cmd] |
126 |
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
127 |
|
128 |
diff --git a/lib/portage/util/_desktop_entry.py b/lib/portage/util/_desktop_entry.py |
129 |
index 45949215a..ee6572588 100644 |
130 |
--- a/lib/portage/util/_desktop_entry.py |
131 |
+++ b/lib/portage/util/_desktop_entry.py |
132 |
@@ -42,14 +42,6 @@ _ShowIn_exemptions = ( |
133 |
def validate_desktop_entry(path): |
134 |
args = ["desktop-file-validate", path] |
135 |
|
136 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000: |
137 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
138 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
139 |
- fullname = portage.process.find_binary(args[0]) |
140 |
- if fullname is None: |
141 |
- raise portage.exception.CommandNotFound(args[0]) |
142 |
- args[0] = fullname |
143 |
- |
144 |
args = [_unicode_encode(x, errors='strict') for x in args] |
145 |
proc = subprocess.Popen(args, |
146 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
147 |
|
148 |
diff --git a/lib/portage/xml/metadata.py b/lib/portage/xml/metadata.py |
149 |
index e479f2dd2..64246c828 100644 |
150 |
--- a/lib/portage/xml/metadata.py |
151 |
+++ b/lib/portage/xml/metadata.py |
152 |
@@ -34,22 +34,14 @@ __all__ = ('MetaDataXML', 'parse_metadata_use') |
153 |
|
154 |
import sys |
155 |
|
156 |
-if sys.hexversion < 0x2070000 or \ |
157 |
- (sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000): |
158 |
- # Our _MetadataTreeBuilder usage is incompatible with |
159 |
- # cElementTree in Python 2.6, 3.0, and 3.1: |
160 |
- # File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 644, in findall |
161 |
- # assert self._root is not None |
162 |
+try: |
163 |
+ import xml.etree.cElementTree as etree |
164 |
+except (SystemExit, KeyboardInterrupt): |
165 |
+ raise |
166 |
+except (ImportError, SystemError, RuntimeError, Exception): |
167 |
+ # broken or missing xml support |
168 |
+ # https://bugs.python.org/issue14988 |
169 |
import xml.etree.ElementTree as etree |
170 |
-else: |
171 |
- try: |
172 |
- import xml.etree.cElementTree as etree |
173 |
- except (SystemExit, KeyboardInterrupt): |
174 |
- raise |
175 |
- except (ImportError, SystemError, RuntimeError, Exception): |
176 |
- # broken or missing xml support |
177 |
- # https://bugs.python.org/issue14988 |
178 |
- import xml.etree.ElementTree as etree |
179 |
|
180 |
try: |
181 |
from xml.parsers.expat import ExpatError |
182 |
|
183 |
diff --git a/repoman/lib/repoman/_subprocess.py b/repoman/lib/repoman/_subprocess.py |
184 |
index b6c19bda3..2ca434010 100644 |
185 |
--- a/repoman/lib/repoman/_subprocess.py |
186 |
+++ b/repoman/lib/repoman/_subprocess.py |
187 |
@@ -20,15 +20,6 @@ def repoman_getstatusoutput(cmd): |
188 |
""" |
189 |
args = portage.util.shlex_split(cmd) |
190 |
|
191 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
192 |
- not os.path.isabs(args[0]): |
193 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
194 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
195 |
- fullname = find_binary(args[0]) |
196 |
- if fullname is None: |
197 |
- raise portage.exception.CommandNotFound(args[0]) |
198 |
- args[0] = fullname |
199 |
- |
200 |
encoding = _encodings['fs'] |
201 |
args = [ |
202 |
_unicode_encode(x, encoding=encoding, errors='strict') for x in args] |
203 |
@@ -53,15 +44,6 @@ class repoman_popen(portage.proxy.objectproxy.ObjectProxy): |
204 |
def __init__(self, cmd): |
205 |
args = portage.util.shlex_split(cmd) |
206 |
|
207 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
208 |
- not os.path.isabs(args[0]): |
209 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
210 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
211 |
- fullname = find_binary(args[0]) |
212 |
- if fullname is None: |
213 |
- raise portage.exception.CommandNotFound(args[0]) |
214 |
- args[0] = fullname |
215 |
- |
216 |
encoding = _encodings['fs'] |
217 |
args = [ |
218 |
_unicode_encode(x, encoding=encoding, errors='strict') |
219 |
|
220 |
diff --git a/repoman/lib/repoman/gpg.py b/repoman/lib/repoman/gpg.py |
221 |
index a3c12b3c9..7dac46f41 100644 |
222 |
--- a/repoman/lib/repoman/gpg.py |
223 |
+++ b/repoman/lib/repoman/gpg.py |
224 |
@@ -50,15 +50,6 @@ def gpgsign(filename, repoman_settings, options): |
225 |
# Encode unicode manually for bug #310789. |
226 |
gpgcmd = portage.util.shlex_split(gpgcmd) |
227 |
|
228 |
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ |
229 |
- not os.path.isabs(gpgcmd[0]): |
230 |
- # Python 3.1 _execvp throws TypeError for non-absolute executable |
231 |
- # path passed as bytes (see https://bugs.python.org/issue8513). |
232 |
- fullname = find_binary(gpgcmd[0]) |
233 |
- if fullname is None: |
234 |
- raise portage.exception.CommandNotFound(gpgcmd[0]) |
235 |
- gpgcmd[0] = fullname |
236 |
- |
237 |
gpgcmd = [ |
238 |
_unicode_encode(arg, encoding=_encodings['fs'], errors='strict') |
239 |
for arg in gpgcmd] |