コード例 #1
0
ファイル: __init__.py プロジェクト: kuldipem/ubuntu-make
def load_frameworks():
    """Load all modules and assign to correct category"""
    main_category = MainCategory()

    # Prepare local paths (1. environment path, 2. local path, 3. system paths).
    # If we have duplicated categories, only consider the first loaded one.
    local_paths = [get_user_frameworks_path()]
    sys.path.insert(0, get_user_frameworks_path())
    environment_path = os.environ.get(UMAKE_FRAMEWORKS_ENVIRON_VARIABLE)
    if environment_path:
        sys.path.insert(0, environment_path)
        local_paths.insert(0, environment_path)

    for loader, module_name, ispkg in pkgutil.iter_modules(path=local_paths):
        load_module(module_name, main_category)
    for loader, module_name, ispkg in pkgutil.iter_modules(path=[os.path.dirname(__file__)]):
        module_name = "{}.{}".format(__package__, module_name)
        load_module(module_name, main_category)
コード例 #2
0
def load_frameworks(force_loading=False):
    """Load all modules and assign to correct category"""
    main_category = MainCategory()

    # Prepare local paths (1. environment path, 2. local path, 3. system paths).
    # If we have duplicated categories, only consider the first loaded one.
    local_paths = [get_user_frameworks_path()]
    sys.path.insert(0, get_user_frameworks_path())
    environment_path = os.environ.get(UMAKE_FRAMEWORKS_ENVIRON_VARIABLE)
    if environment_path:
        sys.path.insert(0, environment_path)
        local_paths.insert(0, environment_path)

    for loader, module_name, ispkg in pkgutil.iter_modules(path=local_paths):
        load_module(module_name, main_category, force_loading)
    for loader, module_name, ispkg in pkgutil.iter_modules(path=[os.path.dirname(__file__)]):
        module_name = "{}.{}".format(__package__, module_name)
        load_module(module_name, main_category, force_loading)