diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-04-28 00:04:31 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-04-28 00:04:31 -0700 |
commit | 2b6ddb35bc13df23b0af198dc737909892f110bd (patch) | |
tree | 6a9fbcb8ddd30f844b59fc373749ee59c4c32a22 /pym/portage_compat_namespace.py | |
parent | aab8d3dca843e07866755fc821b9bc9d5004bde5 (diff) | |
download | portage-2b6ddb35bc13df23b0af198dc737909892f110bd.tar.gz portage-2b6ddb35bc13df23b0af198dc737909892f110bd.tar.bz2 portage-2b6ddb35bc13df23b0af198dc737909892f110bd.zip |
Remove old portage module namespace compatibility that's been deprecated
since portage-2.1.6.
Diffstat (limited to 'pym/portage_compat_namespace.py')
-rw-r--r-- | pym/portage_compat_namespace.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/pym/portage_compat_namespace.py b/pym/portage_compat_namespace.py deleted file mode 100644 index 2dc772838..000000000 --- a/pym/portage_compat_namespace.py +++ /dev/null @@ -1,45 +0,0 @@ -# portage_compat_namespace.py -- provide compability layer with new namespace -# Copyright 2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -""" -This module checks the name under which it is imported and attempts to load -the corresponding module of the new portage namespace, inserting it into the -loaded modules list. -It also issues a warning to the caller to migrate to the new namespace. -Note that this module should never be used with it's true name, but only by -links pointing to it. Also it is limited to portage_foo -> portage.foo -translations, however existing subpackages shouldn't use it anyway to maintain -compability with 3rd party modules (like elog or cache plugins), and they -shouldn't be directly imported by external consumers. - -This module is based on an idea by Brian Harring. -""" - -import sys, warnings - -__oldname = __name__ -if __name__.startswith("portage_"): - __newname = __name__.replace("_", ".") -else: - __newname = "portage."+__name__ - -try: - __package = __import__(__newname, globals(), locals()) - __realmodule = getattr(__package, __newname[8:]) -except (ImportError, AttributeError): - raise ImportError("No module named %s" % __oldname) - -def _showwarning(message, category, filename, lineno, file=None, line=None): - if file is None: - import sys - 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 |