Gentoo Archives: gentoo-portage-dev

From: Alexander Berntsen <alexander@××××××.net>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] prepstrip: rewrite in python
Date: Thu, 17 Oct 2013 09:47:38
Message-Id: 525FB245.9090402@plaimi.net
In Reply to: [gentoo-portage-dev] [PATCH] prepstrip: rewrite in python by Mike Frysinger
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 Great idea! ANd, wow, unit tests, weee. :-) Here are a few comments,
5 mostly on style:
6
7 (I'm not sure how you usually do code reviews/comments here, so please
8 pardon my ignorance on the matter.)
9
10 pym/portage/bin/prepstrip.py:
11 -You import sys, shlex, _copyxattr and xattr but never use them
12 -On line 86, I would change the indentation to be
13 IMPLICIT_FEATURES = frozenset((
14 'binchecks',
15 'strip',
16 ))
17 -I would align the following lines the same way:
18 93
19 134
20 193
21 198
22 238
23 388
24 443
25 478
26 506
27 652
28 654
29 -On line 98, you have too many newlines before the method
30 -On line 175 you catch an exception "as e" but never use the 'e'
31 -The following lines are > 79 chars:
32 219
33 484
34 492
35 591
36 633
37 634
38 -The inline comment on line 486 should have two spaces
39 -In Prepstrip(), why do you
40 if Features.installedsources is None:
41 warn
42 warn
43 else if Features.installedsources:
44 stuff
45 ...
46 instead of
47 if Features.installedsources is None:
48 warn
49 warn
50 return
51 stuff
52 ...
53 - Also, instead of
54 for path, reason in stripped:
55 if not reason:
56 print(...)
57 else:
58 print(...)
59 why not use a ternary?
60
61 pym/portage/tests/test_prepstrip.py
62 -You import sys but never use it
63 -Align indentation:
64 65
65 73
66 179
67 - >79 chars:
68 110
69 156
70 169
71 -In the docstring for testMissing, "garbage" is usually the preferred
72 term, not "crap"
73
74 pym/portage/util/prallel.py:
75 -Indentation is a bit WTF -- Python indentation should be a multiple
76 of four, and this is kind of serious since this is not a "warn" but an
77 actual *error* for Python linters, making it really hard to find more
78 serious errors when every line is "error! E111 Indentation is not a
79 multiple of four"
80 -On line 141 you do results = [], but never use results
81 -Line 268 you catch an exception as ex but never use ex
82 -Background.Wait(): almost the whole thing is in a Try, which is a
83 bit ehh, and if you don't want to rewrite that than maybe at least
84 either remove the finally or put the return inside the finally
85 - >79 chars:
86 325
87 334
88 443
89 557
90
91 Oh, and you use camelCase for functions and methods. In python we use
92 underscores. I don't know if there's some convention outside of emerge
93 (which is the part of Portage I'm most familiar with) to not use
94 underscore. If not, I would prefer it if we were consistent and used
95 underscores everywhere.
96 - --
97 Alexander
98 alexander@××××××.net
99 http://plaimi.net/~alexander
100 -----BEGIN PGP SIGNATURE-----
101 Version: GnuPG v2.0.20 (GNU/Linux)
102 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
103
104 iF4EAREIAAYFAlJfskUACgkQRtClrXBQc7XfiQD/VUhtH8Nc1RmNmLYmDzXBHSGS
105 0S8SMrEka+1cp+BHkHkA/3zOrsoAWra4Ynux2WCOpNYvLsDo0AghGEz8X7oYNEtn
106 =7rF9
107 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] prepstrip: rewrite in python Mike Frysinger <vapier@g.o>