commit: 83baf60851c023fd985eab8a119f52a781c9be74
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 30 00:11:35 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Apr 30 00:11:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=83baf608
portage/modules.py: Change warnings output to writemsg()
Add the missing attribute and filepath to the output for best clarity, bug
reporting.
pym/portage/module.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/pym/portage/module.py b/pym/portage/module.py
index b7967ba..f9828a5 100644
--- a/pym/portage/module.py
+++ b/pym/portage/module.py
@@ -4,12 +4,11 @@
from __future__ import print_function
-import warnings
-
from portage import os
from portage.exception import PortageException
from portage.cache.mappings import ProtectedDict
from portage.localization import _
+from portage.util import writemsg
class InvalidModuleName(PortageException):
@@ -53,10 +52,10 @@ class Module(object):
kid['module_name'] = '.'.join([mod_name,
kid['sourcefile']])
except KeyError:
kid['module_name'] = '.'.join([mod_name,
self.name])
- warnings.warn(
- _("%s module's module_spec is old and
needs updating. "
- "Backward compatibility may be
removed in the future.")
- % (self.name), UserWarning,
stacklevel=2)
+ msg = ("%s module's module_spec is old, missing
attribute: "
+ "'sourcefile'. Backward
compatibility may be "
+ "removed in the future.\nFile:
%s\n")
+ writemsg(_(msg) % (self.name,
self._module.__file__))
kid['is_imported'] = False
self.kids[kidname] = kid
self.kids_names.append(kidname)