mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-26 12:31:32 +02:00
config: cleanup
This commit is contained in:
parent
82a571db3f
commit
49ca108ead
@ -117,10 +117,10 @@ def get(img, light=False, backend="default", cache_dir=CACHE_DIR):
|
|||||||
# Dynamically import the backend we want to use.
|
# Dynamically import the backend we want to use.
|
||||||
# This keeps the dependencies "optional".
|
# This keeps the dependencies "optional".
|
||||||
try:
|
try:
|
||||||
__import__("pywal.backends.%s" % backend)
|
util.variable_import("pywal.backends.%s" % backend)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
util.variable_import("pywal.backends.wal")
|
||||||
backend = "wal"
|
backend = "wal"
|
||||||
__import__("pywal.backends.%s" % backend)
|
|
||||||
|
|
||||||
logging.info("Using %s backend.", backend)
|
logging.info("Using %s backend.", backend)
|
||||||
backend = sys.modules["pywal.backends.%s" % backend]
|
backend = sys.modules["pywal.backends.%s" % backend]
|
||||||
|
@ -92,6 +92,11 @@ def create_dir(directory):
|
|||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
def variable_import(module):
|
||||||
|
"""Import a module dynamically."""
|
||||||
|
__import__(module)
|
||||||
|
|
||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
"""Logging config."""
|
"""Logging config."""
|
||||||
logging.basicConfig(format=("[%(levelname)s\033[0m] "
|
logging.basicConfig(format=("[%(levelname)s\033[0m] "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user