1 |
commit: 5f6ea1857ce3c6ff79b2d4c103f8377efb0e30d1 |
2 |
Author: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 12 19:14:41 2011 +0000 |
4 |
Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Jul 13 16:04:11 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=5f6ea185 |
7 |
|
8 |
scripts/gen_archlist.py: don't insert useless newlines when CHECK_DEPS |
9 |
|
10 |
* If blocks of cpv-kw lists have just one item in them, don't separate them with |
11 |
newline. This avoids tons of useless space in the output. |
12 |
* This code is surprisingly fragile... |
13 |
|
14 |
--- |
15 |
scripts/gen_archlist.py | 11 ++++++++++- |
16 |
1 files changed, 10 insertions(+), 1 deletions(-) |
17 |
|
18 |
diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py |
19 |
index e53f9cc..ffef7eb 100755 |
20 |
--- a/scripts/gen_archlist.py |
21 |
+++ b/scripts/gen_archlist.py |
22 |
@@ -390,6 +390,7 @@ def prettify(cpv_kws): |
23 |
max_len = 0 |
24 |
kws_all = [] |
25 |
pretty_list = [] |
26 |
+ cpv_block_size = 0 |
27 |
|
28 |
for each in cpv_kws: |
29 |
# Ignore comments/whitespace carried over from original list |
30 |
@@ -405,10 +406,18 @@ def prettify(cpv_kws): |
31 |
kws_all.sort() |
32 |
|
33 |
for each in cpv_kws: |
34 |
- # Ignore comments/whitespace carried over from original list |
35 |
+ # Handle comments/whitespace carried over from original list |
36 |
if type(each) is not list: |
37 |
+ # If the prev cpv block has just one line, don't print an extra \n |
38 |
+ # XXX: This code relies on blocks of dep-cpvs being separated by \n |
39 |
+ if CHECK_DEPS and cpv_block_size is 1: |
40 |
+ cpv_block_size = 0 |
41 |
+ continue |
42 |
pretty_list.append([each, []]) |
43 |
+ cpv_block_size = 0 |
44 |
continue |
45 |
+ # The size of the current cpv list block |
46 |
+ cpv_block_size += 1 |
47 |
# Pad the cpvs with space |
48 |
each[0] += n_sep(max_len - len(each[0])) |
49 |
for i in range(0, len(kws_all)): |