Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11262 - main/trunk/pym/_emerge
Date: Tue, 29 Jul 2008 13:01:42
Message-Id: E1KNopf-00048c-O0@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-07-29 13:01:38 +0000 (Tue, 29 Jul 2008)
3 New Revision: 11262
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Fix slightly broken loop logic in insert_optional_args() by converting it to
9 pop args off of a stack.
10
11
12 Modified: main/trunk/pym/_emerge/__init__.py
13 ===================================================================
14 --- main/trunk/pym/_emerge/__init__.py 2008-07-29 12:05:43 UTC (rev 11261)
15 +++ main/trunk/pym/_emerge/__init__.py 2008-07-29 13:01:38 UTC (rev 11262)
16 @@ -12737,7 +12737,10 @@
17
18 new_args = []
19 jobs_opts = ("-j", "--jobs")
20 - for i, arg in enumerate(args):
21 + arg_stack = args[:]
22 + arg_stack.reverse()
23 + while arg_stack:
24 + arg = arg_stack.pop()
25
26 short_job_opt = bool("j" in arg and arg[:1] == "-" and arg[:2] != "--")
27 if not (short_job_opt or arg in jobs_opts):
28 @@ -12760,16 +12763,15 @@
29 job_count = "True"
30 saved_opts = arg[1:].replace("j", "")
31
32 - if job_count is None and \
33 - i < len(args) - 1:
34 + if job_count is None and arg_stack:
35 try:
36 - job_count = int(args[i+1])
37 + job_count = int(arg_stack[-1])
38 except ValueError:
39 pass
40 else:
41 - # The next loop iteration will append
42 - # the validated job count to new_args.
43 - continue
44 + # Discard the job count from the stack
45 + # since we're consuming it here.
46 + arg_stack.pop()
47
48 if job_count is None:
49 # unlimited number of jobs