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
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
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_installable_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))