Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Alexander Berntsen <alexander@××××××.net>
Subject: Re: [gentoo-portage-dev] [PATCH] prepstrip: rewrite in python
Date: Mon, 21 Oct 2013 03:27:21
Message-Id: 201310202327.20415.vapier@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] prepstrip: rewrite in python by Alexander Berntsen
1 On Thursday 17 October 2013 05:47:49 Alexander Berntsen wrote:
2 > pym/portage/bin/prepstrip.py:
3 > -You import sys, shlex, _copyxattr and xattr but never use them
4
5 i've run a linter on the files now
6
7 > -On line 86, I would change the indentation to be
8
9 i think existing style is correct. it's certainly more
10 readable/maintainable/mutable.
11
12 > -On line 98, you have too many newlines before the method
13
14 fixed
15
16 > -On line 175 you catch an exception "as e" but never use the 'e'
17
18 fixed
19
20 > -The following lines are > 79 chars:
21
22 i've run a linter on the files now
23
24 > -The inline comment on line 486 should have two spaces
25
26 fixed
27
28 > -In Prepstrip(), why do you
29
30 i like the existing style better rather than returning early. makes
31 adding/removing sections cleaner (which i've done during development).
32
33 > - Also, instead of
34 > for path, reason in stripped:
35 > if not reason:
36 > print(...)
37 > else:
38 > print(...)
39 > why not use a ternary?
40
41 inlining formats/tuples with a ternary doesn't seem like it'd really be
42 cleaner.
43 print((' %-*s # %s' % (align, path, reason)) if reason
44 else (' %s' % path), file=out)
45 that's pretty busy and not easy to track.
46
47 > pym/portage/util/prallel.py:
48
49 as the top of the file documents, this is imported from an external tree. i'm
50 not making changes here in general. for python3 compat, i'm merging those to
51 the upstream copy.
52
53 stylewise, it's as expected
54
55 > -Background.Wait(): almost the whole thing is in a Try, which is a
56 > bit ehh, and if you don't want to rewrite that than maybe at least
57 > either remove the finally or put the return inside the finally
58
59 it is a bit hairy, but it's making a hairy system work. it's making sure
60 output is captured in parallel and replied sanely rather than interleaving it
61 all. similar to handling of exceptions.
62
63 > Oh, and you use camelCase for functions and methods. In python we use
64 > underscores. I don't know if there's some convention outside of emerge
65 > (which is the part of Portage I'm most familiar with) to not use
66 > underscore. If not, I would prefer it if we were consistent and used
67 > underscores everywhere.
68
69 i'll fix the new code
70 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature