# 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 NoSuchConfigError(DputError):
#     """
#     Thrown when dput can not find a Configuration file or block that is
#     requested.
#     """
#     pass
# 
# class DputConfigurationError(DputError):
#     """
#     Errors in the parsing or retrieving of configuration files should raise
#     an instance of this, or a subclass thereof.
#     """
#     pass
# 
# class InvalidConfigError(DputError):
#     """
#     Config file was loaded properly, but it was missing part of it's
#     required fields.
#     """
#     pass


import os
import json
import shlex
import importlib
import subprocess
import dput.core
        import validictory
from contextlib import contextmanager
from dput.core import logger
from dput.exceptions import (NoSuchConfigError, DputConfigurationError,
                             InvalidConfigError)
        logger.debug("Loading schema %s from %s" % (schema, root))
        spath = "%s/%s.json" % (
            root,
            schema
        )
        try:
            if os.path.exists(spath):
                sobj = json.load(open(spath, 'r'))
            else:
                logger.debug("No such config: %s" % (spath))
        except ValueError as e:
            raise DputConfigurationError("syntax error in %s: %s" % (
                spath,
                e
            ))

    if sobj is None:
        logger.critical("Schema not found: %s" % (schema))
        raise DputConfigurationError("No such schema: %s" % (schema))

    try:
        validictory.validate(obj, sobj)
    except ImportError:
        pass
    except validictory.validator.ValidationError as e:
        err = str(e)
        error = "Error with config file %s - %s" % (
            name,
            err
        )

# 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 NoSuchConfigError(DputError):
#     """
#     Thrown when dput can not find a Configuration file or block that is
#     requested.
#     """
#     pass
# 
# class DputConfigurationError(DputError):
#     """
#     Errors in the parsing or retrieving of configuration files should raise
#     an instance of this, or a subclass thereof.
#     """
#     pass
# 
# class InvalidConfigError(DputError):
#     """
#     Config file was loaded properly, but it was missing part of it's
#     required fields.
#     """
#     pass


# Path: dput/util.py
import os
import json
import shlex
import importlib
import subprocess
import dput.core
        import validictory
from contextlib import contextmanager
from dput.core import logger
from dput.exceptions import (NoSuchConfigError, DputConfigurationError,
                             InvalidConfigError)

        logger.debug("Loading schema %s from %s" % (schema, root))
        spath = "%s/%s.json" % (
            root,
            schema
        )
        try:
            if os.path.exists(spath):
                sobj = json.load(open(spath, 'r'))
            else:
                logger.debug("No such config: %s" % (spath))
        except ValueError as e:
            raise DputConfigurationError("syntax error in %s: %s" % (
                spath,
                e
            ))

    if sobj is None:
        logger.critical("Schema not found: %s" % (schema))
        raise DputConfigurationError("No such schema: %s" % (schema))

    try:
        validictory.validate(obj, sobj)
    except ImportError:
        pass
    except validictory.validator.ValidationError as e:
        err = str(e)
        error = "Error with config file %s - %s" % (
            name,
            err
        )

        ex = InvalidConfigError(error)