def _find_raw_repositories(ctx, path, **kwds): name = kwds.get("name") recursive = kwds.get("recursive", False) shed_file_dirs = [] for pattern in REPO_METADATA_FILES: shed_file_dirs.extend(find_matching_directories( path, pattern, recursive=recursive )) config_name = None if len(shed_file_dirs) == 1: shed_file_dir = shed_file_dirs[0] try: config = shed_repo_config(ctx, shed_file_dir, name=name) except Exception as e: error_message = PARSING_PROBLEM % (shed_file_dir, e) exception = RuntimeError(error_message) _handle_realization_error(exception, **kwds) return [exception] config_name = config.get("name") if len(shed_file_dirs) > 1 and name is not None: raise Exception(NAME_INVALID_MESSAGE) if config_name is not None and name is not None: if config_name != name: raise Exception(CONFLICTING_NAMES_MESSAGE) raw_dirs = shed_file_dirs or [path] kwds_copy = kwds.copy() kwds_copy["name"] = name return _build_raw_repo_objects(ctx, raw_dirs, **kwds_copy)
def _find_raw_repositories(ctx, path, **kwds): name = kwds.get("name", None) recursive = kwds.get("recursive", False) shed_file_dirs = find_matching_directories( path, SHED_CONFIG_NAME, recursive=recursive ) config_name = None if len(shed_file_dirs) == 1: shed_file_dir = shed_file_dirs[0] try: config = shed_repo_config(ctx, shed_file_dir, name=name) except Exception as e: error_message = PARSING_PROBLEM % (shed_file_dir, e) exception = RuntimeError(error_message) _handle_realization_error(exception, **kwds) return [exception] config_name = config.get("name", None) if len(shed_file_dirs) > 1 and name is not None: raise Exception(NAME_INVALID_MESSAGE) if config_name is not None and name is not None: if config_name != name: raise Exception(CONFLICTING_NAMES_MESSAGE) raw_dirs = shed_file_dirs or [path] kwds_copy = kwds.copy() kwds_copy["name"] = name return _build_raw_repo_objects(ctx, raw_dirs, **kwds_copy)
def yield_recipes_on_paths(ctx, paths, recursive): for path in paths: recipe_dirs = find_matching_directories(path, "meta.yaml", recursive=recursive) for recipe_dir in recipe_dirs: yield recipe_dir
def _find_raw_repositories(path, **kwds): name = kwds.get("name", None) recursive = kwds.get("recursive", False) shed_file_dirs = find_matching_directories(path, SHED_CONFIG_NAME, recursive=recursive) config_name = None if len(shed_file_dirs) == 1: shed_file_dir = shed_file_dirs[0] try: config = shed_repo_config(shed_file_dir, name=name) except Exception as e: error_message = PARSING_PROBLEM % (shed_file_dir, e) return [RuntimeError(error_message)] config_name = config.get("name", None) if len(shed_file_dirs) > 1 and name is not None: raise Exception(NAME_INVALID_MESSAGE) if config_name is not None and name is not None: if config_name != name: raise Exception(CONFLICTING_NAMES_MESSAGE) raw_dirs = shed_file_dirs or [path] kwds_copy = kwds.copy() kwds_copy["name"] = name return _build_raw_repo_objects(raw_dirs, **kwds_copy)
def yield_recipes_on_paths(ctx, paths, recursive): for path in paths: recipe_dirs = find_matching_directories( path, "meta.yaml", recursive=recursive ) for recipe_dir in recipe_dirs: yield recipe_dir