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: Tue, 03 May 2016 06:11:36
Message-Id: 1461971668.75fbbcf58f244717712602a83765bcdc6f07ddcf.dolsen@gentoo
1 commit: 75fbbcf58f244717712602a83765bcdc6f07ddcf
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 29 23:14:28 2016 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 29 23:14:28 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=75fbbcf5
7
8 portage/module.py: Restore backaward compatibilty for previous module_spec.
9
10 If the module_spec is missing the 'sourcefile' key and value it will fall back to the previous
11 code. It will also print a warning message.
12
13 pym/portage/module.py | 12 +++++++++++-
14 1 file changed, 11 insertions(+), 1 deletion(-)
15
16 diff --git a/pym/portage/module.py b/pym/portage/module.py
17 index 1a10996..b7967ba 100644
18 --- a/pym/portage/module.py
19 +++ b/pym/portage/module.py
20 @@ -4,9 +4,12 @@
21
22 from __future__ import print_function
23
24 +import warnings
25 +
26 from portage import os
27 from portage.exception import PortageException
28 from portage.cache.mappings import ProtectedDict
29 +from portage.localization import _
30
31
32 class InvalidModuleName(PortageException):
33 @@ -46,7 +49,14 @@ class Module(object):
34 for submodule in self.module_spec['provides']:
35 kid = self.module_spec['provides'][submodule]
36 kidname = kid['name']
37 - kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
38 + try:
39 + kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
40 + except KeyError:
41 + kid['module_name'] = '.'.join([mod_name, self.name])
42 + warnings.warn(
43 + _("%s module's module_spec is old and needs updating. "
44 + "Backward compatibility may be removed in the future.")
45 + % (self.name), UserWarning, stacklevel=2)
46 kid['is_imported'] = False
47 self.kids[kidname] = kid
48 self.kids_names.append(kidname)