コード例 #1
0
def get_subpaths(paths):
    """Get list of subdirectories
    if `__init__.py` file not exists in root path then
    get subdirectories.
    Why? More info here:
        https://www.mail-archive.com/[email protected]/msg00294.html
    :param paths: List of paths
    :return: Return list of paths with subdirectories.
    """
    subpaths = []
    for path in paths:
        if not os.path.isfile(os.path.join(path, "__init__.py")):
            subpaths.extend(
                [
                    os.path.join(path, item)
                    for item in os.listdir(path)
                    if os.path.isfile(os.path.join(path, item, "__init__.py"))
                    and (
                        not getaddons.is_module(os.path.join(path, item))
                        or getaddons.is_installable_module(os.path.join(path, item))
                    )
                ]
            )
        else:
            if not getaddons.is_module(path) or getaddons.is_installable_module(path):
                subpaths.append(path)
    return subpaths
コード例 #2
0
def get_subpaths(paths, ignores):
    """Get list of subdirectories
    if `__init__.py` file not exists in root path then
    get subdirectories.
    Why? More info here:
        https://www.mail-archive.com/[email protected]/msg00294.html
    :param paths: List of paths
    :return: Return list of paths with subdirectories.
    """
    subpaths = []
    for path in paths:
        if not os.path.isfile(os.path.join(path, '__init__.py')):
            subpaths.extend([
                os.path.join(path, item) for item in os.listdir(path)
                if os.path.isfile(os.path.join(path, item, '__init__.py'))
                and os.path.join(path, item) not in ignores and
                (not getaddons.is_module(os.path.join(path, item))
                 or getaddons.is_installable_module(os.path.join(path, item)))
            ])
        else:
            if (path not in ignores
                    and (not getaddons.is_module(path)
                         or getaddons.is_installable_module(path))):
                subpaths.append(path)
    return subpaths
コード例 #3
0
def is_installable_module(path):
    """return False if the path doesn't contain an installable odoo module,
    otherwise the full path to the module's manifest"""
    manifest_path = is_module(path)
    if manifest_path:
        manifest = ast.literal_eval(open(manifest_path).read())
        if manifest.get('installable', True):
            return manifest_path
    return False
コード例 #4
0
def is_installable_module(path):
    """return False if the path doesn't contain an installable odoo module,
    otherwise the full path to the module's manifest"""
    manifest_path = is_module(path)
    if manifest_path:
        manifest = ast.literal_eval(open(manifest_path).read())
        if manifest.get('installable', True):
            return manifest_path
    return False
コード例 #5
0
def get_test_dependencies(addons_path, addons_list):
    """
    Get the list of core and external modules dependencies
    for the modules to test.
    :param addons_path: string with a comma separated list of addons paths
    :param addons_list: list of the modules to test
    """
    if not addons_list:
        return ['base']
    else:
        for path in addons_path.split(','):
            manif_path = is_module(os.path.join(path, addons_list[0]))
            if not manif_path:
                continue
            manif = eval(open(manif_path).read())
            return list(
                set(manif.get('depends', []))
                | set(get_test_dependencies(addons_path, addons_list[1:]))
                - set(addons_list))
コード例 #6
0
def get_test_dependencies(addons_path, addons_list):
    """
    Get the list of core and external modules dependencies
    for the modules to test.
    :param addons_path: string with a comma separated list of addons paths
    :param addons_list: list of the modules to test
    """
    if not addons_list:
        return ['base']
    else:
        for path in addons_path.split(','):
            manif_path = is_module(os.path.join(path, addons_list[0]))
            if not manif_path:
                continue
            manif = eval(open(manif_path).read())
            return list(
                set(manif.get('depends', []))
                | set(get_test_dependencies(addons_path, addons_list[1:])) -
                set(addons_list))