Skip to content

Commit

Permalink
Allow env to be invoked when no dependencies installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Feb 15, 2022
1 parent 0db5af9 commit bed1d14
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions kolibri/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@
import sys
from warnings import warn

from colorlog import ColoredFormatter
from colorlog import getLogger
from colorlog import StreamHandler
try:
# Do this to allow this to be accessed
# during build, when dependencies are not
# installed.
# TODO: Move version tools to build tools, so we don't have to do this
from colorlog import ColoredFormatter
from colorlog import getLogger
from colorlog import StreamHandler
except ImportError:
StreamHandler = None
getLogger = None
ColoredFormatter = None

from .logger import LOG_COLORS


logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
logging.StreamHandler(sys.stdout)

handler = StreamHandler()
handler.setFormatter(
ColoredFormatter(
fmt="%(log_color)s%(levelname)-8s %(message)s", log_colors=LOG_COLORS
if StreamHandler and getLogger and ColoredFormatter:
handler = StreamHandler()
handler.setFormatter(
ColoredFormatter(
fmt="%(log_color)s%(levelname)-8s %(message)s", log_colors=LOG_COLORS
)
)
)
logger = getLogger("env")
logger.addHandler(handler)
logger = getLogger("env")
logger.addHandler(handler)
else:
logger = logging.getLogger("env")


def settings_module():
Expand Down

0 comments on commit bed1d14

Please sign in to comment.