summaryrefslogtreecommitdiff
path: root/server/common.py
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-29 18:14:43 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-29 18:14:43 +0000
commit50c6507fb8abd2dbcb48519d89c44ce44977880c (patch)
treeaeb085847e0aa40f917bbcf0163475d0233c7dfd /server/common.py
parentb4d21acf42650114dcdc5b1f36ad359b17c20a58 (diff)
Change common.py'>common.py so that it inserts all of the libraries it loads
into sys.modules, so that we can import specific submodules directly (e.g. "import common.logging") or specific contents of submodules (e.g. "from common.logging import record") instead of only being able to import the top-level common module. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1001 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'server/common.py')
-rw-r--r--server/common.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/common.py b/server/common.py
index a933f507..46fdee17 100644
--- a/server/common.py
+++ b/server/common.py
@@ -10,5 +10,13 @@ dirname = os.path.dirname(__file__)
top_level_dir = os.path.abspath(os.path.join(dirname, '..', 'client'))
sys.path.insert(0, top_level_dir)
+import common_lib
from common_lib import *
del sys.path[0]
+
+for library in common_lib.__all__:
+ sys.modules['common.%s' % library] = eval(library)
+
+# clean up the namespace
+del dirname, top_level_dir, library
+del os, sys, common_lib