# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():
# 
# Path: dput/exceptions.py
# class ChangesFileException(DputError):
#     """
#     Thrown when there's an error processing / verifying a .changes file
#     (most often via the :class:`dput.changes.Changes` object)
#     """
# 
#     def __init__(self, message, gpg_stderr=None):
#         super(ChangesFileException, self).__init__(message)
#         self.gpg_stderr = gpg_stderr
# 
# class HookException(DputError):
#     """
#     Thrown when there's an error checking, or creating a checker. Usually
#     thrown by a checker invoked by :class:`dput.checker.run_hooks`.
#     """
#     pass


from dput.core import logger
from dput.exceptions import (ChangesFileException, HookException)

class HashValidationError(HookException):
    """
    Subclass of the :class:`dput.exceptions.HookException`.

    Thrown if the ``checksum`` checker encounters an issue.
    """
    pass


def validate_checksums(changes, profile, interface):
    """
    The ``checksum`` checker is a stock dput checker that checks packages
    intended for upload for correct checksums. This is actually the most
    simple checker that exists.

    Profile key: none.

    Example profile::

        {
            ...
            "hash": "md5"
            ...
        }

    The hash may be one of md5, sha1, sha256.
    """
    try:
        changes.validate_checksums(check_hash=profile["hash"])

# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():
# 
# Path: dput/exceptions.py
# class ChangesFileException(DputError):
#     """
#     Thrown when there's an error processing / verifying a .changes file
#     (most often via the :class:`dput.changes.Changes` object)
#     """
# 
#     def __init__(self, message, gpg_stderr=None):
#         super(ChangesFileException, self).__init__(message)
#         self.gpg_stderr = gpg_stderr
# 
# class HookException(DputError):
#     """
#     Thrown when there's an error checking, or creating a checker. Usually
#     thrown by a checker invoked by :class:`dput.checker.run_hooks`.
#     """
#     pass


# Path: dput/hooks/checksum.py
from dput.core import logger
from dput.exceptions import (ChangesFileException, HookException)


class HashValidationError(HookException):
    """
    Subclass of the :class:`dput.exceptions.HookException`.

    Thrown if the ``checksum`` checker encounters an issue.
    """
    pass


def validate_checksums(changes, profile, interface):
    """
    The ``checksum`` checker is a stock dput checker that checks packages
    intended for upload for correct checksums. This is actually the most
    simple checker that exists.

    Profile key: none.

    Example profile::

        {
            ...
            "hash": "md5"
            ...
        }

    The hash may be one of md5, sha1, sha256.
    """
    try:
        changes.validate_checksums(check_hash=profile["hash"])

    except ChangesFileException as e: