# 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/repository.py
# CONF = config.get_config().CONF
# LOG = logging.getLogger(__name__)
# MAIN_REMOTE_NAME = "origin"
#         REPO_REMOTE_NAME = "push-remote"
# class PushError(Exception):
# class GitRepository(git.Repo):
# class SvnRepository():
#     def __init__(self, push_info):
# def get_git_repository(remote_repo_url, parent_dir_path, name=None):
# def get_svn_repository(remote_repo_url, repo_path):
#     def clone_from(cls, remote_repo_url, repo_path, proxy=None, *args, **kwargs):
#     def __init__(self, repo_path, *args, **kwargs):
#     def name(self):
#     def checkout(self, ref_name, refspecs=None):
#     def _get_reference(self, ref_name):
#     def _update_submodules(self):
#     def archive(self, archive_name, build_dir):
#     def commit_changes(self, commit_message, committer_name, committer_email):
#     def push_head_commits(self, remote_repo_url, remote_repo_branch):
#     def force_create_remote(self, name, url):
#     def checkout_from(cls, remote_repo_url, repo_path):
#     def __init__(self, remote_repo_url, local_repo_path):
#     def name(self):
#     def checkout(self, revision):
# 
# Path: lib/constants.py
# BUILD_INFO_FILE_NAME = "build.json"
# 
# Path: lib/constants.py
# PACKAGES_INFO_FILE_NAME = "packages.json"
# 
# Path: lib/constants.py
# REPOSITORIES_DIR = 'repositories'


import json
import logging
import os
import yaml
from lib import config
from lib import exception
from lib import repository
from lib.constants import BUILD_INFO_FILE_NAME
from lib.constants import PACKAGES_INFO_FILE_NAME
from lib.constants import REPOSITORIES_DIR
# Copyright (C) IBM Corp. 2016.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



CONF = config.get_config().CONF
LOG = logging.getLogger(__name__)

RELEASE_FILE_NAME_TEMPLATE = "{date}-{suffix}.markdown"
RELEASE_FILE_CONTENT_TEMPLATE = """\
---
{header_yaml}

# 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/repository.py
# CONF = config.get_config().CONF
# LOG = logging.getLogger(__name__)
# MAIN_REMOTE_NAME = "origin"
#         REPO_REMOTE_NAME = "push-remote"
# class PushError(Exception):
# class GitRepository(git.Repo):
# class SvnRepository():
#     def __init__(self, push_info):
# def get_git_repository(remote_repo_url, parent_dir_path, name=None):
# def get_svn_repository(remote_repo_url, repo_path):
#     def clone_from(cls, remote_repo_url, repo_path, proxy=None, *args, **kwargs):
#     def __init__(self, repo_path, *args, **kwargs):
#     def name(self):
#     def checkout(self, ref_name, refspecs=None):
#     def _get_reference(self, ref_name):
#     def _update_submodules(self):
#     def archive(self, archive_name, build_dir):
#     def commit_changes(self, commit_message, committer_name, committer_email):
#     def push_head_commits(self, remote_repo_url, remote_repo_branch):
#     def force_create_remote(self, name, url):
#     def checkout_from(cls, remote_repo_url, repo_path):
#     def __init__(self, remote_repo_url, local_repo_path):
#     def name(self):
#     def checkout(self, revision):
# 
# Path: lib/constants.py
# BUILD_INFO_FILE_NAME = "build.json"
# 
# Path: lib/constants.py
# PACKAGES_INFO_FILE_NAME = "packages.json"
# 
# Path: lib/constants.py
# REPOSITORIES_DIR = 'repositories'


# Path: lib/subcommands/build_release_notes.py
import json
import logging
import os
import yaml
from lib import config
from lib import exception
from lib import repository
from lib.constants import BUILD_INFO_FILE_NAME
from lib.constants import PACKAGES_INFO_FILE_NAME
from lib.constants import REPOSITORIES_DIR

# Copyright (C) IBM Corp. 2016.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



CONF = config.get_config().CONF
LOG = logging.getLogger(__name__)

RELEASE_FILE_NAME_TEMPLATE = "{date}-{suffix}.markdown"
RELEASE_FILE_CONTENT_TEMPLATE = """\
---
{header_yaml}

---