Gentoo Archives: gentoo-portage-dev

From: m h <sesquile@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Refactoring of emerge code
Date: Sat, 29 Apr 2006 06:57:20
Message-Id: e36b84ee0604282356v778003ban28734c23216dbfc5@mail.gmail.com
1 Folks-
2
3 I'm submitting a patch of a refactoring of the emerge code in
4 2.1_pre9-r5. This patch adds no features per se. But I believe it
5 makes the code much more readable. This only addresses the
6 /usr/lib/portage/bin/emerge file.
7
8 It does the following:
9
10 * attempts to remove all global variables (with the exception of the
11 spinner animation)
12 * breaks up the heinous 900 lines of code at the bottom of the file into:
13 * a __main__ section that calls out to
14 * do_SOMETHING where something is (depclean, search, info, config, etc)
15 * removes any code that was dangling at the leftmost side of my editor
16 and puts it under the __main__ section
17 * removes an olddbapi variable that isn't used
18
19 I've tested it with the sync, remove, search, update and it appears to
20 work. Any feedback is welcome.
21
22 I hope that this gets in for a few reasons. I'm helping out with
23 doing some work on the PREFIX branch, having the code unstructured
24 makes it really hard to follow (hopefully it can get into trunk so I
25 don't need to patch prefix, everytime it's updated). One of my
26 coworkers just started adding some functionality to emerge (he'll send
27 his patches in soon), but this is really his first week using python,
28 and I don't want this to leave a bad taste in his mouth.... ;)
29
30 -matt

Attachments

File name MIME type
emerge_refactor.diff application/octet-stream

Replies

Subject Author
[gentoo-portage-dev] Re: Refactoring of emerge code m h <sesquile@×××××.com>