Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/portage/
Date: Mon, 10 Jul 2017 17:52:38
Message-Id: 1499709019.a9da39a81f0469ab7e2086b3225c45ad5def25a1.dolsen@gentoo
1 commit: a9da39a81f0469ab7e2086b3225c45ad5def25a1
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 10 17:29:05 2017 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 10 17:50:19 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9da39a8
7
8 portage/module.py: Add a generic get_spec()
9
10 This new function gets any arbitrary spec value.
11 The other get_* functions could be optimized to return the
12 get_spec result instead. This would reduce code duplication.
13
14 pym/portage/module.py | 15 +++++++++++++++
15 1 file changed, 15 insertions(+)
16
17 diff --git a/pym/portage/module.py b/pym/portage/module.py
18 index f9828a518..00f322387 100644
19 --- a/pym/portage/module.py
20 +++ b/pym/portage/module.py
21 @@ -205,3 +205,18 @@ class Modules(object):
22 raise InvalidModuleName(
23 "Module name '%s' was invalid or not found" % modname)
24 return desc
25 +
26 + def get_spec(self, modname, var):
27 + """Retrieves the module class exported spec variable
28 +
29 + @type modname: string
30 + @param modname: the module class name
31 + @type dictionary
32 + @return: the modules class exported options descriptions
33 + """
34 + if modname and modname in self.module_names:
35 + value = self._modules[modname].get(var, None)
36 + else:
37 + raise InvalidModuleName(
38 + "Module name '%s' was invalid or not found" % modname)
39 + return value