summaryrefslogtreecommitdiffstats
path: root/pym/portage_compat_namespace.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage_compat_namespace.py')
-rw-r--r--pym/portage_compat_namespace.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pym/portage_compat_namespace.py b/pym/portage_compat_namespace.py
index 07f22a95e..6956ec2b3 100644
--- a/pym/portage_compat_namespace.py
+++ b/pym/portage_compat_namespace.py
@@ -31,10 +31,15 @@ try:
except (ImportError, AttributeError):
raise ImportError("No module named %s" % __oldname)
-def _formatwarning(message, category, filename, lineno):
- return "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
-
-warnings.formatwarning = _formatwarning
+def _showwarning(message, category, filename, lineno, file=None, line=None):
+ if file is None:
+ file = sys.stderr
+ try:
+ file.write("%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message))
+ except IOError:
+ pass
+
+warnings.showwarning = _showwarning
warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname), DeprecationWarning)
sys.modules[__oldname] = __realmodule