# Path: lib/config.py
# RAW_TEXT_ID = "R|"
# CONFIG_METADATA_FILE_PATH = "config/metadata.yaml"
# LOG_FILE_NAME = 'builds.log'
#         CONF = get_config().CONF
# def get_config():
#     def _split_lines(self, text, width):
#     def __init__(self):
#     def CONF(self):
#     def _setup_command_line_arg_from_config_metadata(
#             self, target_parser, option_name, option_dict):
#     def _setup_command_line_parser(self, config_metadata_file_path):
#     def parse_command_line_arguments(self, args):
#     def parse_command_line(self, command_line_args):
#     def parse_config_file(self, config_file_path):
#     def parse(self, command_line_args=None):
# def setup_default_config():
# class CustomHelpFormatter(argparse.HelpFormatter):
# class ConfigParser(object):
# 
# Path: lib/exception.py
# class BaseException(Exception):
# class RequiredParameterMissing(BaseException):
# class DistributionError(BaseException):
# class DistributionDetectionError(DistributionError):
# class DistributionNotSupportedError(DistributionError):
# class DistributionVersionNotSupportedError(DistributionError):
# class PackageError(BaseException):
# class PackageSpecError(PackageError):
# class PackageDescriptorError(PackageError):
# class PackageDirectoryIsEmpty(PackageError):
# class RepositoryError(BaseException):
# class SubprocessError(BaseException):
# class TimeoutError(BaseException):
# class FilesToValidateNotFound(BaseException):
# class NoPackagesUpdated(BaseException):
#     DEFAULT_MESSAGE = "Failed to build packages"
#     DEFAULT_MESSAGE = "Required parameter '%(parameter)s' is missing"
#     DEFAULT_MESSAGE = "Distribution not Supported"
#     DEFAULT_MESSAGE = "Failed to detect system's GNU/Linux distribution"
#     DEFAULT_MESSAGE = "%(distribution)s distribution is not supported"
#     DEFAULT_MESSAGE = "%(distribution)s version %(version)s is not supported"
#     DEFAULT_MESSAGE = "Failed to gather %(package)s's information"
#     DEFAULT_MESSAGE = (
#         "%(package)s's spec for %(distro)s %(distro_version)s not Found.")
#     DEFAULT_MESSAGE = "Missing data in %(package)s's YAML descriptor"
#     DEFAULT_MESSAGE = "No packages to build. Packages directory is empty."
#     DEFAULT_MESSAGE = (
#         "Failed to setup %(repo_name)s's repository at %(repo_path)s.")
#     DEFAULT_MESSAGE = (
#         "%(cmd)s returned non-zero exit code: ret:%(returncode)i, "
#         "stdout: %(stdout)s, stderr: %(stderr)s")
#     DEFAULT_MESSAGE = (
#         "Timeout failure on %(func_name)s after %(num_attempts)s attempts. "
#         "Initial timeout: %(initial_timeout)s, final timeout: "
#         "%(final_timeout)s.")
#     DEFAULT_MESSAGE = (
#         "Files to be validated not found in base directory.")
#     DEFAULT_MESSAGE = (
#         "No packages were updated since last commit.")
#     def __init__(self, message=None, **kwargs):
# 
# Path: lib/versions_repository.py
# def get_versions_repository(config):
#     """
#     Get the packages metadata Git repository, cloning it if does not
#     yet exist.
# 
#     Args:
#         config (dict): configuration dictionary
# 
#     Raises:
#         exception.RepositoryError: if the clone is unsuccessful
#     """
#     path = os.path.join(config.get('work_dir'),
#                         REPOSITORIES_DIR)
#     url = config.get('packages_metadata_repo_url')
#     name = "versions_{subcommand}".format(
#         subcommand=config.get('subcommand'))
#     try:
#         versions_repo = repository.get_git_repository(url, path, name)
#     except exception.RepositoryError:
#         LOG.error("Failed to clone versions repository")
#         raise
# 
#     return versions_repo


import logging
import os
from lib import config
from lib import exception
from lib.package import Package
from lib.versions_repository import get_versions_repository
    a yaml file with the same name.
    Considering the example:

    versions
    +-- kernel
    |   +-- kernel.yaml
    +-- libvirt
    |   +-- libvirt.yaml
    |   +-- someother_file_or_directory
    +-- not-a-package
    |   +-- not-following-standards.yaml
    +-- file

    "kernel" and "libvirt" will be discovered, "not-a-package" and "file"
    will not.
    """
    versions_repo_target_path = get_versions_repository(CONF).working_tree_dir
    package_list = []
    try:
        package_list = [
            package for package in os.listdir(versions_repo_target_path)
            if os.path.isdir(os.path.join(versions_repo_target_path, package)) and
            os.path.isfile(os.path.join(versions_repo_target_path, package,
                                        "".join([package, ".yaml"])))
        ]
    except OSError:
        LOG.error("No packages found in versions repository directory")
        raise

    if not package_list:

# Path: lib/config.py
# RAW_TEXT_ID = "R|"
# CONFIG_METADATA_FILE_PATH = "config/metadata.yaml"
# LOG_FILE_NAME = 'builds.log'
#         CONF = get_config().CONF
# def get_config():
#     def _split_lines(self, text, width):
#     def __init__(self):
#     def CONF(self):
#     def _setup_command_line_arg_from_config_metadata(
#             self, target_parser, option_name, option_dict):
#     def _setup_command_line_parser(self, config_metadata_file_path):
#     def parse_command_line_arguments(self, args):
#     def parse_command_line(self, command_line_args):
#     def parse_config_file(self, config_file_path):
#     def parse(self, command_line_args=None):
# def setup_default_config():
# class CustomHelpFormatter(argparse.HelpFormatter):
# class ConfigParser(object):
# 
# Path: lib/exception.py
# class BaseException(Exception):
# class RequiredParameterMissing(BaseException):
# class DistributionError(BaseException):
# class DistributionDetectionError(DistributionError):
# class DistributionNotSupportedError(DistributionError):
# class DistributionVersionNotSupportedError(DistributionError):
# class PackageError(BaseException):
# class PackageSpecError(PackageError):
# class PackageDescriptorError(PackageError):
# class PackageDirectoryIsEmpty(PackageError):
# class RepositoryError(BaseException):
# class SubprocessError(BaseException):
# class TimeoutError(BaseException):
# class FilesToValidateNotFound(BaseException):
# class NoPackagesUpdated(BaseException):
#     DEFAULT_MESSAGE = "Failed to build packages"
#     DEFAULT_MESSAGE = "Required parameter '%(parameter)s' is missing"
#     DEFAULT_MESSAGE = "Distribution not Supported"
#     DEFAULT_MESSAGE = "Failed to detect system's GNU/Linux distribution"
#     DEFAULT_MESSAGE = "%(distribution)s distribution is not supported"
#     DEFAULT_MESSAGE = "%(distribution)s version %(version)s is not supported"
#     DEFAULT_MESSAGE = "Failed to gather %(package)s's information"
#     DEFAULT_MESSAGE = (
#         "%(package)s's spec for %(distro)s %(distro_version)s not Found.")
#     DEFAULT_MESSAGE = "Missing data in %(package)s's YAML descriptor"
#     DEFAULT_MESSAGE = "No packages to build. Packages directory is empty."
#     DEFAULT_MESSAGE = (
#         "Failed to setup %(repo_name)s's repository at %(repo_path)s.")
#     DEFAULT_MESSAGE = (
#         "%(cmd)s returned non-zero exit code: ret:%(returncode)i, "
#         "stdout: %(stdout)s, stderr: %(stderr)s")
#     DEFAULT_MESSAGE = (
#         "Timeout failure on %(func_name)s after %(num_attempts)s attempts. "
#         "Initial timeout: %(initial_timeout)s, final timeout: "
#         "%(final_timeout)s.")
#     DEFAULT_MESSAGE = (
#         "Files to be validated not found in base directory.")
#     DEFAULT_MESSAGE = (
#         "No packages were updated since last commit.")
#     def __init__(self, message=None, **kwargs):
# 
# Path: lib/versions_repository.py
# def get_versions_repository(config):
#     """
#     Get the packages metadata Git repository, cloning it if does not
#     yet exist.
# 
#     Args:
#         config (dict): configuration dictionary
# 
#     Raises:
#         exception.RepositoryError: if the clone is unsuccessful
#     """
#     path = os.path.join(config.get('work_dir'),
#                         REPOSITORIES_DIR)
#     url = config.get('packages_metadata_repo_url')
#     name = "versions_{subcommand}".format(
#         subcommand=config.get('subcommand'))
#     try:
#         versions_repo = repository.get_git_repository(url, path, name)
#     except exception.RepositoryError:
#         LOG.error("Failed to clone versions repository")
#         raise
# 
#     return versions_repo


# Path: lib/packages_manager.py
import logging
import os
from lib import config
from lib import exception
from lib.package import Package
from lib.versions_repository import get_versions_repository

    a yaml file with the same name.
    Considering the example:

    versions
    +-- kernel
    |   +-- kernel.yaml
    +-- libvirt
    |   +-- libvirt.yaml
    |   +-- someother_file_or_directory
    +-- not-a-package
    |   +-- not-following-standards.yaml
    +-- file

    "kernel" and "libvirt" will be discovered, "not-a-package" and "file"
    will not.
    """
    versions_repo_target_path = get_versions_repository(CONF).working_tree_dir
    package_list = []
    try:
        package_list = [
            package for package in os.listdir(versions_repo_target_path)
            if os.path.isdir(os.path.join(versions_repo_target_path, package)) and
            os.path.isfile(os.path.join(versions_repo_target_path, package,
                                        "".join([package, ".yaml"])))
        ]
    except OSError:
        LOG.error("No packages found in versions repository directory")
        raise

    if not package_list:

    	raise exception.PackageDirectoryIsEmpty()