Gentoo Archives: gentoo-commits

From: Devan Franchini <twitch153@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/layman:master commit in: layman/
Date: Fri, 28 Aug 2015 01:48:11
Message-Id: 1440726435.d5ca0ce0d10220401176b981882349c9f25294c4.twitch153@gentoo
1 commit: d5ca0ce0d10220401176b981882349c9f25294c4
2 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 28 01:45:45 2015 +0000
4 Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 28 01:47:15 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=d5ca0ce0
7
8 maker.py: Modifies query prompts
9
10 These modifications remove a lot of duplicated prompts that were created
11 when trying to prompt the user for an item that could be of more than
12 one value.
13
14 layman/maker.py | 70 ++++++++++++++++++++++-----------------------------------
15 1 file changed, 27 insertions(+), 43 deletions(-)
16
17 diff --git a/layman/maker.py b/layman/maker.py
18 index 06d624b..c184f6b 100644
19 --- a/layman/maker.py
20 +++ b/layman/maker.py
21 @@ -295,11 +295,11 @@ class Interactive(object):
22 feeds = []
23
24 for i in range(1, feed_amount + 1):
25 + extra = ''
26 if feed_amount > 1:
27 - msg = 'Define overlay feed[%(i)s]: ' % ({'i': str(i)})
28 - feeds.append(get_input(msg))
29 - else:
30 - feeds.append(get_input('Define overlay feed: '))
31 + extra = '[%(i)s]' % {'i': str(i)}
32 + feeds.append(get_input('Define overlay%(extra)s feed: '\
33 + % {'extra': extra}))
34
35 self.overlay['feed'] = feeds
36 self.output.notice('')
37 @@ -344,48 +344,32 @@ class Interactive(object):
38 for i in range(1, source_amount + 1):
39 sources = []
40 correct = False
41 + extra = ''
42 if source_amount > 1:
43 - msg = 'Define source[%(i)s]\'s URL: ' % ({'i': str(i)})
44 - sources.append(get_input(msg))
45 + extra = '[%(i)s]\'s' % {'i': str(i)}
46
47 - ovl_type = self.guess_overlay_type(sources[0])
48 - if ovl_type:
49 - msg = 'Is "%(type)s" the correct overlay type?: '\
50 - % ({'type': ovl_type})
51 - correct = get_ans(msg)
52 - while not ovl_type or not correct:
53 - msg = 'Please provide overlay type: '
54 - ovl_type = self.check_overlay_type(\
55 - get_input(msg, color='yellow'))
56 - correct = True
57 -
58 - sources.append(ovl_type)
59 - if 'branch' in self.required:
60 - msg = 'Define source[%(i)s]\'s branch (if applicable): '\
61 - % ({'i': str(i)})
62 - sources.append(get_input(msg))
63 - else:
64 - sources.append('')
65 + msg = 'Define source%(extra)s URL: ' % {'extra': extra}
66 + sources.append(get_input(msg))
67 +
68 + ovl_type = self.guess_overlay_type(sources[0])
69 + if ovl_type:
70 + msg = 'Is "%(type)s" the correct overlay type?: '\
71 + % ({'type': ovl_type})
72 + correct = get_ans(msg)
73 + while not ovl_type or not correct:
74 + msg = 'Please provide overlay type: '
75 + ovl_type = self.check_overlay_type(\
76 + get_input(msg, color='yellow'))
77 + correct = True
78 +
79 + sources.append(ovl_type)
80 + if 'branch' in self.required:
81 + msg = 'Define source%(extra)s branch (if applicable): '\
82 + % {'extra': extra}
83 + sources.append(get_input(msg))
84 else:
85 - sources.append(get_input('Define source URL: '))
86 -
87 - ovl_type = self.guess_overlay_type(sources[0])
88 - if ovl_type:
89 - msg = 'Is %(type)s the correct overlay type?: '\
90 - % ({'type': ovl_type})
91 - correct = get_ans(msg)
92 - while not ovl_type or not correct:
93 - msg = 'Please provide overlay type: '
94 - ovl_type = self.check_overlay_type(\
95 - get_input(msg, color='yellow'))
96 - correct = True
97 -
98 - sources.append(ovl_type)
99 - if 'branch' in self.required:
100 - msg = 'Define source branch (if applicable): '
101 - sources.append(get_input(msg))
102 - else:
103 - sources.append('')
104 + sources.append('')
105 +
106 if self.auto_complete:
107 sources = self._set_additional_info(sources)
108 for source in sources: