summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-02-17 13:11:28 +0000
committerMarius Mauch <genone@gentoo.org>2007-02-17 13:11:28 +0000
commit344c94a32baf1fec5ac650aa7475adc643887915 (patch)
tree277a78549b214fda290fca7ae18c3a9de7d29dc2
parentRemove portage_exec.py as subversion is stupid and can't convert it in one step (diff)
downloadportage-multirepo-344c94a32baf1fec5ac650aa7475adc643887915.tar.gz
portage-multirepo-344c94a32baf1fec5ac650aa7475adc643887915.tar.bz2
portage-multirepo-344c94a32baf1fec5ac650aa7475adc643887915.zip
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
l---------pym/cvstree.py2
l---------pym/dispatch_conf.py2
l---------pym/eclass_cache.py2
l---------pym/emergehelp.py2
l---------pym/getbinpkg.py2
l---------pym/output.py2
l---------pym/portage_checksum.py2
-rw-r--r--pym/portage_compat_namespace.py35
l---------pym/portage_const.py2
l---------pym/portage_data.py2
l---------pym/portage_debug.py2
l---------pym/portage_dep.py2
l---------pym/portage_exception.py2
-rw-r--r--pym/portage_exec.py15
l---------pym/portage_gpg.py2
l---------pym/portage_localization.py2
l---------pym/portage_locks.py2
l---------pym/portage_mail.py2
l---------pym/portage_manifest.py2
l---------pym/portage_news.py2
l---------pym/portage_selinux.py2
l---------pym/portage_update.py2
l---------pym/portage_util.py2
l---------pym/portage_versions.py2
l---------pym/xpak.py2
25 files changed, 73 insertions, 23 deletions
diff --git a/pym/cvstree.py b/pym/cvstree.py
index 64d92942..de769f71 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 12dcece7..de769f71 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 c7d7db2c..de769f71 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 dbfcb4af..de769f71 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 89c09094..de769f71 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 f99c2257..de769f71 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 90dfb342..de769f71 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 00000000..9e5e691a
--- /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 aac7e46c..de769f71 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 55990ebc..de769f71 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 52af90d3..de769f71 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 e16bb2a7..de769f71 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 c3c090d0..de769f71 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 00000000..30b5cdfd
--- /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 dd5c1065..de769f71 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 3b57bfee..de769f71 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 58fef066..de769f71 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 c88fcdce..de769f71 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 6f6c0e9c..de769f71 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 166e3ce0..de769f71 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 5c7a71ca..de769f71 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 cb88f8a5..de769f71 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 570febc0..de769f71 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 1e05cb3b..de769f71 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 223cb31c..de769f71 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