# Path: pypi_redirect/pypi_redirect/server_app/launcher.py
# def run_server(primordial_logger=None, enable_file_logging=False):
#     """
#     Run the server which proxies requests from:
#         python/<package>
#     to:
#         https://pypi.python.org/simple/<package>
# 
#     And requests from:
#         python/<package>/<filename>
#     to:
#         https://pypi.python.org/<path-to-filename>
#     """
#     if primordial_logger is None:
#         primordial_logger = _create_console_logger()
# 
#     root = wire_dependencies()
# 
#     cherrypy_config_path = _get_cherrypy_config_file(primordial_logger)
# 
#     app = cherrypy.tree.mount(
#         root,
#         script_name='/',
#         config=cherrypy_config_path)
# 
#     cherrypy.config.update(cherrypy_config_path)
# 
#     if enable_file_logging:
#         _enable_file_logging(app, primordial_logger=primordial_logger)
# 
#     cherrypy.engine.start()
#     cherrypy.engine.block()


from logging import handlers, DEBUG
from ..server_app.launcher import run_server
import logging
import cherrypy
import win32serviceutil
import win32service


class PyPIWindowsService(win32serviceutil.ServiceFramework):
    """NT Service."""
    _svc_name_ = "PyPIRedirectService"
    _svc_display_name_ = "PyPI Redirect Service"

    def SvcDoRun(self):
        svc_logger = _create_svc_logger()

# Path: pypi_redirect/pypi_redirect/server_app/launcher.py
# def run_server(primordial_logger=None, enable_file_logging=False):
#     """
#     Run the server which proxies requests from:
#         python/<package>
#     to:
#         https://pypi.python.org/simple/<package>
# 
#     And requests from:
#         python/<package>/<filename>
#     to:
#         https://pypi.python.org/<path-to-filename>
#     """
#     if primordial_logger is None:
#         primordial_logger = _create_console_logger()
# 
#     root = wire_dependencies()
# 
#     cherrypy_config_path = _get_cherrypy_config_file(primordial_logger)
# 
#     app = cherrypy.tree.mount(
#         root,
#         script_name='/',
#         config=cherrypy_config_path)
# 
#     cherrypy.config.update(cherrypy_config_path)
# 
#     if enable_file_logging:
#         _enable_file_logging(app, primordial_logger=primordial_logger)
# 
#     cherrypy.engine.start()
#     cherrypy.engine.block()


# Path: pypi_redirect/pypi_redirect/daemon/pypi_windows_service.py
from logging import handlers, DEBUG
from ..server_app.launcher import run_server
import logging
import cherrypy
import win32serviceutil
import win32service



class PyPIWindowsService(win32serviceutil.ServiceFramework):
    """NT Service."""
    _svc_name_ = "PyPIRedirectService"
    _svc_display_name_ = "PyPI Redirect Service"

    def SvcDoRun(self):
        svc_logger = _create_svc_logger()

        run_server(primordial_logger=svc_logger, enable_file_logging=True)