1 |
On Fri, 2020-08-07 at 12:28 -0400, Aaron Bauman wrote: |
2 |
> * Python implies such things. Let's drop 'em and be consistent. |
3 |
> |
4 |
> Signed-off-by: Aaron Bauman <bman@g.o> |
5 |
> --- |
6 |
> "\\" | 20 ++++++++++++++++++++ |
7 |
> lib/_emerge/EbuildPhase.py | 6 +++--- |
8 |
> lib/_emerge/resolver/output.py | 5 ----- |
9 |
> lib/portage/elog/mod_custom.py | 1 - |
10 |
> lib/portage/elog/mod_echo.py | 4 ++-- |
11 |
> lib/portage/elog/mod_mail.py | 2 -- |
12 |
> lib/portage/glsa.py | 3 --- |
13 |
> lib/portage/mail.py | 1 - |
14 |
> lib/portage/sync/controller.py | 3 +-- |
15 |
> lib/portage/util/whirlpool.py | 2 -- |
16 |
> pylintrc | 1 + |
17 |
> 11 files changed, 27 insertions(+), 21 deletions(-) |
18 |
> create mode 100644 "\\" |
19 |
> |
20 |
> diff --git "a/\\" "b/\\" |
21 |
> new file mode 100644 |
22 |
> index 000000000..aaf1d3b1b |
23 |
> --- /dev/null |
24 |
> +++ "b/\\" |
25 |
|
26 |
That's an interesting file to add. |
27 |
|
28 |
> @@ -0,0 +1,20 @@ |
29 |
> +# elog/mod_custom.py - elog dispatch module |
30 |
> +# Copyright 2006-2020 Gentoo Authors |
31 |
> +# Distributed under the terms of the GNU General Public License v2 |
32 |
> + |
33 |
> +import portage.elog.mod_save |
34 |
> +import portage.exception |
35 |
> +import portage.process |
36 |
> + |
37 |
> +def process(mysettings, key, logentries, fulltext): |
38 |
> + elogfilename = portage.elog.mod_save.process(mysettings, key, logentries, fulltext) |
39 |
> + |
40 |
> + if not mysettings.get("PORTAGE_ELOG_COMMAND"): |
41 |
> + raise portage.exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined") |
42 |
> + else: |
43 |
> + mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"] |
44 |
> + mylogcmd = mylogcmd.replace("${LOGFILE}", elogfilename) |
45 |
> + mylogcmd = mylogcmd.replace("${PACKAGE}", key) |
46 |
> + retval = portage.process.spawn_bash(mylogcmd) |
47 |
> + if retval != 0: |
48 |
> + raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval) |
49 |
> diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py |
50 |
> index e6256d0aa..ceffeccee 100644 |
51 |
> --- a/lib/_emerge/EbuildPhase.py |
52 |
> +++ b/lib/_emerge/EbuildPhase.py |
53 |
> @@ -9,11 +9,12 @@ import tempfile |
54 |
> |
55 |
> from _emerge.AsynchronousLock import AsynchronousLock |
56 |
> from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor |
57 |
> -from _emerge.MiscFunctionsProcess import MiscFunctionsProcess |
58 |
> -from _emerge.EbuildProcess import EbuildProcess |
59 |
> from _emerge.CompositeTask import CompositeTask |
60 |
> +from _emerge.EbuildProcess import EbuildProcess |
61 |
> +from _emerge.MiscFunctionsProcess import MiscFunctionsProcess |
62 |
> from _emerge.PackagePhase import PackagePhase |
63 |
> from _emerge.TaskSequence import TaskSequence |
64 |
> + |
65 |
> from portage.package.ebuild._ipc.QueryCommand import QueryCommand |
66 |
> from portage.util._dyn_libs.soname_deps_qa import ( |
67 |
> _get_all_provides, |
68 |
> @@ -396,7 +397,6 @@ class EbuildPhase(CompositeTask): |
69 |
> fd_pipes=self.fd_pipes, phase=phase, scheduler=self.scheduler, |
70 |
> settings=self.settings) |
71 |
> self._start_task(clean_phase, self._fail_clean_exit) |
72 |
> - return |
73 |
> |
74 |
> def _fail_clean_exit(self, clean_phase): |
75 |
> self._final_exit(clean_phase) |
76 |
> diff --git a/lib/_emerge/resolver/output.py b/lib/_emerge/resolver/output.py |
77 |
> index 1dcb47020..b6c77ecad 100644 |
78 |
> --- a/lib/_emerge/resolver/output.py |
79 |
> +++ b/lib/_emerge/resolver/output.py |
80 |
> @@ -243,7 +243,6 @@ class Display: |
81 |
> cur_use_map[key], old_iuse_map[key], |
82 |
> old_use_map[key], is_new, feature_flags, |
83 |
> reinst_flags_map.get(key)) |
84 |
> - return |
85 |
> |
86 |
> |
87 |
> @staticmethod |
88 |
> @@ -539,7 +538,6 @@ class Display: |
89 |
> if show_repos and repoadd: |
90 |
> myprint += " " + teal("[%s]" % repoadd) |
91 |
> writemsg_stdout("%s\n" % (myprint,), noiselevel=-1) |
92 |
> - return |
93 |
> |
94 |
> |
95 |
> def print_blockers(self): |
96 |
> @@ -548,7 +546,6 @@ class Display: |
97 |
> """ |
98 |
> for pkg in self.blockers: |
99 |
> writemsg_stdout("%s\n" % (pkg,), noiselevel=-1) |
100 |
> - return |
101 |
> |
102 |
> |
103 |
> def print_verbose(self, show_repos): |
104 |
> @@ -562,7 +559,6 @@ class Display: |
105 |
> # that RepoDisplay.__unicode__() is called in python2. |
106 |
> writemsg_stdout("%s" % (self.conf.repo_display,), |
107 |
> noiselevel=-1) |
108 |
> - return |
109 |
> |
110 |
> |
111 |
> def print_changelog(self): |
112 |
> @@ -687,7 +683,6 @@ class Display: |
113 |
> if ebuild_path_cl is not None: |
114 |
> self.changelogs.extend(_calc_changelog( |
115 |
> ebuild_path_cl, pkg_info.previous_pkg, pkg.cpv)) |
116 |
> - return |
117 |
> |
118 |
> |
119 |
> def check_system_world(self, pkg): |
120 |
> diff --git a/lib/portage/elog/mod_custom.py b/lib/portage/elog/mod_custom.py |
121 |
> index 7cfafeccc..aaf1d3b1b 100644 |
122 |
> --- a/lib/portage/elog/mod_custom.py |
123 |
> +++ b/lib/portage/elog/mod_custom.py |
124 |
> @@ -18,4 +18,3 @@ def process(mysettings, key, logentries, fulltext): |
125 |
> retval = portage.process.spawn_bash(mylogcmd) |
126 |
> if retval != 0: |
127 |
> raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval) |
128 |
> - return |
129 |
> diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py |
130 |
> index 80f2b11ac..a026847b7 100644 |
131 |
> --- a/lib/portage/elog/mod_echo.py |
132 |
> +++ b/lib/portage/elog/mod_echo.py |
133 |
> @@ -3,9 +3,10 @@ |
134 |
> # Distributed under the terms of the GNU General Public License v2 |
135 |
> |
136 |
> import sys |
137 |
> -from portage.output import EOutput, colorize |
138 |
> + |
139 |
> from portage.const import EBUILD_PHASES |
140 |
> from portage.localization import _ |
141 |
> +from portage.output import EOutput, colorize |
142 |
> |
143 |
> |
144 |
> _items = [] |
145 |
> @@ -61,4 +62,3 @@ def _finalize(): |
146 |
> for line in msgcontent: |
147 |
> fmap[msgtype](line.strip("\n")) |
148 |
> _items = [] |
149 |
> - return |
150 |
> diff --git a/lib/portage/elog/mod_mail.py b/lib/portage/elog/mod_mail.py |
151 |
> index 38eaa277f..f737a80ce 100644 |
152 |
> --- a/lib/portage/elog/mod_mail.py |
153 |
> +++ b/lib/portage/elog/mod_mail.py |
154 |
> @@ -41,5 +41,3 @@ def process(mysettings, key, logentries, fulltext): |
155 |
> portage.mail.send_mail(mysettings, mymessage) |
156 |
> except PortageException as e: |
157 |
> writemsg("%s\n" % str(e), noiselevel=-1) |
158 |
> - |
159 |
> - return |
160 |
> diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py |
161 |
> index 9260e7e09..1870d9338 100644 |
162 |
> --- a/lib/portage/glsa.py |
163 |
> +++ b/lib/portage/glsa.py |
164 |
> @@ -492,7 +492,6 @@ class Glsa: |
165 |
> finally: |
166 |
> f.close() |
167 |
> |
168 |
> - return None |
169 |
> |
170 |
> def parse(self, myfile): |
171 |
> """ |
172 |
> @@ -583,7 +582,6 @@ class Glsa: |
173 |
> self.packages[name].append(tmp) |
174 |
> # TODO: services aren't really used yet |
175 |
> self.services = self.affected.getElementsByTagName("service") |
176 |
> - return None |
177 |
> |
178 |
> def dump(self, outstream=sys.stdout, encoding="utf-8"): |
179 |
> """ |
180 |
> @@ -684,7 +682,6 @@ class Glsa: |
181 |
> mode='a+', encoding=_encodings['content'], errors='strict') |
182 |
> checkfile.write(_unicode_decode(self.nr + "\n")) |
183 |
> checkfile.close() |
184 |
> - return None |
185 |
> |
186 |
> def getMergeList(self, least_change=True): |
187 |
> """ |
188 |
> diff --git a/lib/portage/mail.py b/lib/portage/mail.py |
189 |
> index 6503b4cc9..f4fccd8c2 100644 |
190 |
> --- a/lib/portage/mail.py |
191 |
> +++ b/lib/portage/mail.py |
192 |
> @@ -136,4 +136,3 @@ def send_mail(mysettings, message): |
193 |
> raise portage.exception.PortageException(_("!!! An error occurred while trying to send logmail:\n")+str(e)) |
194 |
> except socket.error as e: |
195 |
> raise portage.exception.PortageException(_("!!! A network error occurred while trying to send logmail:\n%s\nSure you configured PORTAGE_ELOG_MAILURI correctly?") % str(e)) |
196 |
> - return |
197 |
> diff --git a/lib/portage/sync/controller.py b/lib/portage/sync/controller.py |
198 |
> index cb68e2c37..24ebf4ff8 100644 |
199 |
> --- a/lib/portage/sync/controller.py |
200 |
> +++ b/lib/portage/sync/controller.py |
201 |
> @@ -174,7 +174,7 @@ class SyncManager: |
202 |
> |
203 |
> |
204 |
> def do_callback(self, result): |
205 |
> - #print("result:", result, "callback()", self.callback) |
206 |
> + # print("result:", result, "callback()", self.callback) |
207 |
> exitcode, updatecache_flg = result |
208 |
> self.exitcode = exitcode |
209 |
> self.updatecache_flg = updatecache_flg |
210 |
> @@ -184,7 +184,6 @@ class SyncManager: |
211 |
> writemsg_level(msg + "\n") |
212 |
> if self.callback: |
213 |
> self.callback(exitcode, updatecache_flg) |
214 |
> - return |
215 |
> |
216 |
> |
217 |
> def perform_post_sync_hook(self, reponame, dosyncuri='', repolocation=''): |
218 |
> diff --git a/lib/portage/util/whirlpool.py b/lib/portage/util/whirlpool.py |
219 |
> index 1071d5155..857abf3ac 100644 |
220 |
> --- a/lib/portage/util/whirlpool.py |
221 |
> +++ b/lib/portage/util/whirlpool.py |
222 |
> @@ -634,7 +634,6 @@ class WhirlpoolStruct: |
223 |
> |
224 |
> def WhirlpoolInit(ctx): |
225 |
> ctx = WhirlpoolStruct() |
226 |
> - return |
227 |
> |
228 |
> def WhirlpoolAdd(source, sourceBits, ctx): |
229 |
> if not isinstance(source, bytes): |
230 |
> @@ -777,7 +776,6 @@ def processBuffer(ctx): |
231 |
> # apply the Miyaguchi-Preneel compression function |
232 |
> for i in range(8): |
233 |
> ctx.hash[i] ^= state[i] ^ block[i] |
234 |
> - return |
235 |
> |
236 |
> # |
237 |
> # Tests. |
238 |
> diff --git a/pylintrc b/pylintrc |
239 |
> index f2aadf14f..ce5dec11b 100644 |
240 |
> --- a/pylintrc |
241 |
> +++ b/pylintrc |
242 |
> @@ -33,6 +33,7 @@ enable= |
243 |
> unused-import, |
244 |
> useless-import-alias, |
245 |
> useless-object-inheritance, |
246 |
> + useless-return, |
247 |
> wildcard-import |
248 |
> |
249 |
> # A comma-separated list of package or module names from where C extensions may |
250 |
|
251 |
-- |
252 |
Best regards, |
253 |
Michał Górny |