def collect_categories(mask_paths): classes = [] for mask, path in mask_paths: classes.extend(collect(mask, path, lambda obj: hasattr(obj, "category") and obj.category != None and obj.category != "")) categories = set(c.category for c in classes) return categories
def collect_categories(mask_paths): """Return a list of all category subclasses. Look for them in modules imported as module_mask % basename(f) where f is name of all files in path. """ categories = [] for mask, path in mask_paths: categories.extend(collect(mask, path, lambda obj: getattr(obj, "displayOnHub", None) != None)) return categories
def collect_spokes(mask_paths, category): """Return a list of all spoke subclasses that should appear for a given category. """ spokes = [] for mask, path in mask_paths: spokes.extend(collect(mask, path, lambda obj: hasattr(obj, "category") and obj.category != None and obj.category == category)) return spokes
def collect_categories(mask_paths): """Return a list of all category subclasses. Look for them in modules imported as module_mask % basename(f) where f is name of all files in path. """ categories = [] for mask, path in mask_paths: categories.extend( collect(mask, path, lambda obj: getattr(obj, "displayOnHub", None) != None)) return categories
def collect_spokes(mask_paths, category): """Return a list of all spoke subclasses that should appear for a given category. Look for them in files imported as module_path % basename(f) :param mask_paths: list of mask, path tuples to search for classes :type mask_paths: list of (mask, path) :return: list of Spoke classes belonging to category :rtype: list of Spoke classes """ spokes = [] for mask, path in mask_paths: spokes.extend(collect(mask, path, lambda obj: hasattr(obj, "category") and obj.category != None and obj.category.__name__ == category)) return spokes
def collect_spokes(mask_paths, category): """Return a list of all spoke subclasses that should appear for a given category. Look for them in files imported as module_path % basename(f) :param mask_paths: list of mask, path tuples to search for classes :type mask_paths: list of (mask, path) :return: list of Spoke classes belonging to category :rtype: list of Spoke classes """ spokes = [] for mask, path in mask_paths: spokes.extend( collect( mask, path, lambda obj: hasattr(obj, "category") and obj. category != None and obj.category.__name__ == category)) return spokes
def collect_spokes(mask_paths, spoke_parent_class): """Return a list of all spoke subclasses that should appear for a given category. Look for them in files imported as module_path % basename(f) :param mask_paths: list of mask, path tuples to search for classes :type mask_paths: list of (mask, path) :param spoke_parent_class: Spoke parent class used for checking spoke compatibility :type spoke_parent_class: GUI or TUI Spoke class :return: list of Spoke classes belonging to category :rtype: list of Spoke classes """ spokes = [] for mask, path in mask_paths: spokes.extend(collect(mask, path, lambda obj: issubclass(obj, spoke_parent_class) and obj.should_run("firstboot", None))) return spokes
def _collectActionClasses(self, module_pattern_w_path, standalone_class): """Collect all the Hub and Spoke classes which should be enqueued for processing. :param module_pattern_w_path: the full name patterns (pyanaconda.ui.gui.spokes.%s) and directory paths to modules we are about to import :type module_pattern_w_path: list of (string, string) :param standalone_class: the parent type of Spokes we want to pick up :type standalone_class: common.StandaloneSpoke based types :return: list of Spoke classes with standalone_class as a parent :rtype: list of Spoke classes """ standalones = [] for module_pattern, path in module_pattern_w_path: standalones.extend(collect(module_pattern, path, lambda obj: issubclass(obj, standalone_class) and \ getattr(obj, "preForHub", False) or getattr(obj, "postForHub", False))) return standalones
from pyanaconda.ui.common import collect # FIXME: Storage tests don't want to work right now, so they are disabled while # I debug them so we can get useful data from other tests. os._exit(77) if os.geteuid() != 0: sys.stderr.write("You must be root to run the storage tests; skipping.\n") # This return code tells the automake test driver that this test was skipped. os._exit(77) if "top_srcdir" not in os.environ: sys.stderr.write("$top_srcdir must be defined in the test environment\n") # This return code tells the automake test driver that the test setup failed sys.exit(99) failures = 0 classes = collect( "cases.%s", os.path.abspath( os.path.join(os.environ["top_srcdir"], "tests/storage/cases/")), lambda obj: getattr(obj, "desc", None) is not None) for tc in classes: obj = tc() failures += obj.run() os._exit(failures)
import os, sys from pyanaconda.ui.common import collect # FIXME: Storage tests don't want to work right now, so they are disabled while # I debug them so we can get useful data from other tests. os._exit(77) if os.geteuid() != 0: sys.stderr.write("You must be root to run the storage tests; skipping.\n") # This return code tells the automake test driver that this test was skipped. os._exit(77) if "top_srcdir" not in os.environ: sys.stderr.write("$top_srcdir must be defined in the test environment\n") # This return code tells the automake test driver that the test setup failed sys.exit(99) failures = 0 classes = collect("cases.%s", os.path.abspath(os.path.join(os.environ["top_srcdir"], "tests/storage/cases/")), lambda obj: getattr(obj, "desc", None) is not None) for tc in classes: obj = tc() failures += obj.run() os._exit(failures)