summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@gentoo.org>2011-07-13 00:44:41 +0530
committerNirbheek Chauhan <nirbheek@gentoo.org>2011-07-13 00:44:43 +0530
commit65233c901564bdc33d220bd5210d6701bc18c61c (patch)
tree0ebd123e62b5ea4afbe4824bad2150122de9c9d2 /scripts
parentnet-print/cups-pk-helper: 0.1.2 → 0.1.3 (diff)
downloadgnome-65233c901564bdc33d220bd5210d6701bc18c61c.tar.gz
gnome-65233c901564bdc33d220bd5210d6701bc18c61c.tar.bz2
gnome-65233c901564bdc33d220bd5210d6701bc18c61c.zip
scripts/gen_archlist.py: don't insert useless newlines when CHECK_DEPS
* If blocks of cpv-kw lists have just one item in them, don't separate them with newline. This avoids tons of useless space in the output. * This code is surprisingly fragile...
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_archlist.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index e53f9cc7..ffef7eb9 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -390,6 +390,7 @@ def prettify(cpv_kws):
max_len = 0
kws_all = []
pretty_list = []
+ cpv_block_size = 0
for each in cpv_kws:
# Ignore comments/whitespace carried over from original list
@@ -405,10 +406,18 @@ def prettify(cpv_kws):
kws_all.sort()
for each in cpv_kws:
- # Ignore comments/whitespace carried over from original list
+ # Handle comments/whitespace carried over from original list
if type(each) is not list:
+ # If the prev cpv block has just one line, don't print an extra \n
+ # XXX: This code relies on blocks of dep-cpvs being separated by \n
+ if CHECK_DEPS and cpv_block_size is 1:
+ cpv_block_size = 0
+ continue
pretty_list.append([each, []])
+ cpv_block_size = 0
continue
+ # The size of the current cpv list block
+ cpv_block_size += 1
# Pad the cpvs with space
each[0] += n_sep(max_len - len(each[0]))
for i in range(0, len(kws_all)):