From: Marius Mauch Date: Sat, 17 Feb 2007 13:11:28 +0000 (-0000) Subject: Replace compat symlinks with a new compat module as the symlink solution prevents... X-Git-Tag: v2.2_pre1~1695 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=344c94a32baf1fec5ac650aa7475adc643887915;p=portage.git Replace compat symlinks with a new compat module as the symlink solution prevents reuse of state information (requested by ferringb) svn path=/main/trunk/; revision=5981 --- diff --git a/pym/cvstree.py b/pym/cvstree.py index 64d929425..de769f711 120000 --- a/pym/cvstree.py +++ b/pym/cvstree.py @@ -1 +1 @@ -portage/cvstree.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py index 12dcece7e..de769f711 120000 --- a/pym/dispatch_conf.py +++ b/pym/dispatch_conf.py @@ -1 +1 @@ -portage/dispatch_conf.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/eclass_cache.py b/pym/eclass_cache.py index c7d7db2ca..de769f711 120000 --- a/pym/eclass_cache.py +++ b/pym/eclass_cache.py @@ -1 +1 @@ -portage/eclass_cache.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/emergehelp.py b/pym/emergehelp.py index dbfcb4af5..de769f711 120000 --- a/pym/emergehelp.py +++ b/pym/emergehelp.py @@ -1 +1 @@ -emerge/help.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py index 89c090948..de769f711 120000 --- a/pym/getbinpkg.py +++ b/pym/getbinpkg.py @@ -1 +1 @@ -portage/getbinpkg.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/output.py b/pym/output.py index f99c2257f..de769f711 120000 --- a/pym/output.py +++ b/pym/output.py @@ -1 +1 @@ -portage/output.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py index 90dfb342c..de769f711 120000 --- a/pym/portage_checksum.py +++ b/pym/portage_checksum.py @@ -1 +1 @@ -portage/checksum.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_compat_namespace.py b/pym/portage_compat_namespace.py new file mode 100644 index 000000000..9e5e691a9 --- /dev/null +++ b/pym/portage_compat_namespace.py @@ -0,0 +1,35 @@ +# 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 +# $Id$ + +""" +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) + +warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname)) +sys.modules[__oldname] = __realmodule diff --git a/pym/portage_const.py b/pym/portage_const.py index aac7e46cd..de769f711 120000 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -1 +1 @@ -portage/const.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_data.py b/pym/portage_data.py index 55990ebc4..de769f711 120000 --- a/pym/portage_data.py +++ b/pym/portage_data.py @@ -1 +1 @@ -portage/data.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_debug.py b/pym/portage_debug.py index 52af90d3d..de769f711 120000 --- a/pym/portage_debug.py +++ b/pym/portage_debug.py @@ -1 +1 @@ -portage/debug.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_dep.py b/pym/portage_dep.py index e16bb2a7c..de769f711 120000 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -1 +1 @@ -portage/dep.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_exception.py b/pym/portage_exception.py index c3c090d0e..de769f711 120000 --- a/pym/portage_exception.py +++ b/pym/portage_exception.py @@ -1 +1 @@ -portage/exception.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_exec.py b/pym/portage_exec.py new file mode 100644 index 000000000..30b5cdfd8 --- /dev/null +++ b/pym/portage_exec.py @@ -0,0 +1,15 @@ +# 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 +# $Id: portage_compat_namespace.py 5782 2007-01-25 17:07:32Z genone $ + +""" +Special edition of portage_compat_namespace.py as for this module we can't translate +name automatically as "import portage.exec" is a SyntaxError. +""" + +import sys, warnings + +import portage.process +warnings.warn("DEPRECATION NOTICE: The portage_exec module was replaced by portage.process") +sys.modules["portage_exec"] = portage.process diff --git a/pym/portage_gpg.py b/pym/portage_gpg.py index dd5c10655..de769f711 120000 --- a/pym/portage_gpg.py +++ b/pym/portage_gpg.py @@ -1 +1 @@ -portage/gpg.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_localization.py b/pym/portage_localization.py index 3b57bfee6..de769f711 120000 --- a/pym/portage_localization.py +++ b/pym/portage_localization.py @@ -1 +1 @@ -portage/localization.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_locks.py b/pym/portage_locks.py index 58fef0660..de769f711 120000 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -1 +1 @@ -portage/locks.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_mail.py b/pym/portage_mail.py index c88fcdced..de769f711 120000 --- a/pym/portage_mail.py +++ b/pym/portage_mail.py @@ -1 +1 @@ -portage/mail.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index 6f6c0e9c2..de769f711 120000 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -1 +1 @@ -portage/manifest.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_news.py b/pym/portage_news.py index 166e3ce03..de769f711 120000 --- a/pym/portage_news.py +++ b/pym/portage_news.py @@ -1 +1 @@ -portage/news.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_selinux.py b/pym/portage_selinux.py index 5c7a71ca8..de769f711 120000 --- a/pym/portage_selinux.py +++ b/pym/portage_selinux.py @@ -1 +1 @@ -portage/selinux.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_update.py b/pym/portage_update.py index cb88f8a51..de769f711 120000 --- a/pym/portage_update.py +++ b/pym/portage_update.py @@ -1 +1 @@ -portage/update.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_util.py b/pym/portage_util.py index 570febc0f..de769f711 120000 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -1 +1 @@ -portage/util.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/portage_versions.py b/pym/portage_versions.py index 1e05cb3b1..de769f711 120000 --- a/pym/portage_versions.py +++ b/pym/portage_versions.py @@ -1 +1 @@ -portage/versions.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file diff --git a/pym/xpak.py b/pym/xpak.py index 223cb31c9..de769f711 120000 --- a/pym/xpak.py +++ b/pym/xpak.py @@ -1 +1 @@ -portage/xpak.py \ No newline at end of file +portage_compat_namespace.py \ No newline at end of file