Beispiel #1
0
__author__ = "[email protected] (John Admanski)"

import os, sys, imp

try:
    import autotest.client.shared.check_version as check_version
except ImportError:
    # This must run on Python versions less than 2.4.
    dirname = os.path.dirname(sys.modules[__name__].__file__)
    common_dir = os.path.abspath(os.path.join(dirname, "shared"))
    sys.path.insert(0, common_dir)
    import check_version
    sys.path.pop(0)

check_version.check_python_version()

import new, glob, traceback


def _create_module(name):
    """Create a single top-level module"""
    module = new.module(name)
    sys.modules[name] = module
    return module


def _create_module_and_parents(name):
    """Create a module, and all the necessary parents"""
    parts = name.split(".")
    # first create the top-level module
    parent = _create_module(parts[0])
Beispiel #2
0
:author: John Admanski ([email protected])
"""
import os
import sys

try:
    import autotest.client.shared.check_version as check_version
except ImportError:
    # This must run on Python versions less than 2.4.
    dirname = os.path.dirname(sys.modules[__name__].__file__)
    common_dir = os.path.abspath(os.path.join(dirname, "shared"))
    sys.path.insert(0, common_dir)
    import check_version
    sys.path.pop(0)

check_version.check_python_version()

import types
import imp


def _create_module(name):
    """
    Create a single top-level module and add it to sys.modules.

    :param name: Module name, such as 'autotest'.
    """
    module = types.ModuleType(name)
    sys.modules[name] = module
    return module