1 |
commit: 83baf60851c023fd985eab8a119f52a781c9be74 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 30 00:11:35 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 30 00:11:35 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=83baf608 |
7 |
|
8 |
portage/modules.py: Change warnings output to writemsg() |
9 |
|
10 |
Add the missing attribute and filepath to the output for best clarity, bug reporting. |
11 |
|
12 |
pym/portage/module.py | 11 +++++------ |
13 |
1 file changed, 5 insertions(+), 6 deletions(-) |
14 |
|
15 |
diff --git a/pym/portage/module.py b/pym/portage/module.py |
16 |
index b7967ba..f9828a5 100644 |
17 |
--- a/pym/portage/module.py |
18 |
+++ b/pym/portage/module.py |
19 |
@@ -4,12 +4,11 @@ |
20 |
|
21 |
from __future__ import print_function |
22 |
|
23 |
-import warnings |
24 |
- |
25 |
from portage import os |
26 |
from portage.exception import PortageException |
27 |
from portage.cache.mappings import ProtectedDict |
28 |
from portage.localization import _ |
29 |
+from portage.util import writemsg |
30 |
|
31 |
|
32 |
class InvalidModuleName(PortageException): |
33 |
@@ -53,10 +52,10 @@ class Module(object): |
34 |
kid['module_name'] = '.'.join([mod_name, kid['sourcefile']]) |
35 |
except KeyError: |
36 |
kid['module_name'] = '.'.join([mod_name, self.name]) |
37 |
- warnings.warn( |
38 |
- _("%s module's module_spec is old and needs updating. " |
39 |
- "Backward compatibility may be removed in the future.") |
40 |
- % (self.name), UserWarning, stacklevel=2) |
41 |
+ msg = ("%s module's module_spec is old, missing attribute: " |
42 |
+ "'sourcefile'. Backward compatibility may be " |
43 |
+ "removed in the future.\nFile: %s\n") |
44 |
+ writemsg(_(msg) % (self.name, self._module.__file__)) |
45 |
kid['is_imported'] = False |
46 |
self.kids[kidname] = kid |
47 |
self.kids_names.append(kidname) |