Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/layman:master commit in: layman/
Date: Sun, 08 Feb 2015 01:57:21
Message-Id: 1423360558.13380e488ad4a458d7d2410bc235c62d61c7a595.dolsen@gentoo
1 commit: 13380e488ad4a458d7d2410bc235c62d61c7a595
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 8 01:55:58 2015 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 8 01:55:58 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=13380e48
7
8 updater.py: Add a -R, --rebuild option to force a rebuild of the config
9
10 ---
11 layman/updater.py | 8 +++++---
12 1 file changed, 5 insertions(+), 3 deletions(-)
13
14 diff --git a/layman/updater.py b/layman/updater.py
15 index e3003f9..fe3f300 100644
16 --- a/layman/updater.py
17 +++ b/layman/updater.py
18 @@ -57,6 +57,8 @@ class Main(object):
19 help = 'Print the NEW INSTALL help messages.')
20 self.parser.add_argument("-c", "--config",
21 help='the path to config file')
22 + self.parser.add_argument("-R", "--rebuild", action='store_true',
23 + help='rebuild the Pacakge Manager config file')
24 self.parser.add_argument('--version', action='version',
25 version='%(prog)s ' + VERSION)
26
27 @@ -85,18 +87,18 @@ class Main(object):
28
29 if self.args.setup_help:
30 self.print_instructions()
31 - elif not self.check_is_new():
32 + elif not self.check_is_new(self.args.rebuild):
33 self.rename_check()
34
35
36 - def check_is_new(self):
37 + def check_is_new(self, rebuild=False):
38 print_instructions = False
39 if isinstance(self.config['conf_type'], STR):
40 self.config.set_option('conf_type',
41 self.config['conf_type'].split(','))
42 for i in self.config['conf_type']:
43 conf = i.replace('.', '_').strip()
44 - if conf and not os.access(self.config[conf], os.F_OK):
45 + if conf and (rebuild or not os.access(self.config[conf], os.F_OK)):
46 getattr(self, 'create_%(conf)s' % {'conf': conf})()
47 print_instructions = True
48 if print_instructions: