# Path: webpack/exceptions.py
# class ConfigFileNotFound(Exception):
#     pass
# 
# Path: webpack/conf.py
# class Conf(conf.Conf):
#     OUTPUT_ROOT = None
#     STATIC_URL = None
#     OUTPUT_DIR = 'webpack_assets'
#     CONFIG_DIRS = None
#     CONTEXT = None
#     BUILD_URL = 'http://127.0.0.1:9009/build'
#     WATCH = False
#     AGGREGATE_TIMEOUT = 200
#     POLL = None
#     HMR = False
#     CACHE = True
#     CACHE_DIR = None
#     MANIFEST = None
#     USE_MANIFEST = False
#     MANIFEST_PATH = None
#     MANIFEST_SETTINGS = {
#         # Force the compiler to connect to the build server
#         'USE_MANIFEST': False,
#         # Ensure that the server does not add a hmr runtime
#         'HMR': False,
#     }
#     def get_path_to_output_dir(self):
#     def get_public_path(self):


import os
from .exceptions import ConfigFileNotFound
from .conf import settings


def find_config_file(config_file):
    if not os.path.isabs(config_file) and settings.CONFIG_DIRS:
        for dir_path in settings.CONFIG_DIRS:
            abs_path = os.path.join(dir_path, config_file)
            if os.path.exists(abs_path):
                return abs_path

        config_dirs = ' tried: {}'.format(
            [os.path.join(dir_path, config_file) for dir_path in settings.CONFIG_DIRS]
        )
        raise ConfigFileNotFound('{}{}'.format(config_file, config_dirs))

    if not os.path.exists(config_file):

# Path: webpack/exceptions.py
# class ConfigFileNotFound(Exception):
#     pass
# 
# Path: webpack/conf.py
# class Conf(conf.Conf):
#     OUTPUT_ROOT = None
#     STATIC_URL = None
#     OUTPUT_DIR = 'webpack_assets'
#     CONFIG_DIRS = None
#     CONTEXT = None
#     BUILD_URL = 'http://127.0.0.1:9009/build'
#     WATCH = False
#     AGGREGATE_TIMEOUT = 200
#     POLL = None
#     HMR = False
#     CACHE = True
#     CACHE_DIR = None
#     MANIFEST = None
#     USE_MANIFEST = False
#     MANIFEST_PATH = None
#     MANIFEST_SETTINGS = {
#         # Force the compiler to connect to the build server
#         'USE_MANIFEST': False,
#         # Ensure that the server does not add a hmr runtime
#         'HMR': False,
#     }
#     def get_path_to_output_dir(self):
#     def get_public_path(self):


# Path: webpack/resolver.py
import os
from .exceptions import ConfigFileNotFound
from .conf import settings



def find_config_file(config_file):
    if not os.path.isabs(config_file) and settings.CONFIG_DIRS:
        for dir_path in settings.CONFIG_DIRS:
            abs_path = os.path.join(dir_path, config_file)
            if os.path.exists(abs_path):
                return abs_path

        config_dirs = ' tried: {}'.format(
            [os.path.join(dir_path, config_file) for dir_path in settings.CONFIG_DIRS]
        )
        raise ConfigFileNotFound('{}{}'.format(config_file, config_dirs))

    if not os.path.exists(config_file):

        raise ConfigFileNotFound(config_file)