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.
|
||||
# This keeps the dependencies "optional".
|
||||
try:
|
||||
__import__("pywal.backends.%s" % backend)
|
||||
util.variable_import("pywal.backends.%s" % backend)
|
||||
except ImportError:
|
||||
util.variable_import("pywal.backends.wal")
|
||||
backend = "wal"
|
||||
__import__("pywal.backends.%s" % backend)
|
||||
|
||||
logging.info("Using %s backend.", backend)
|
||||
backend = sys.modules["pywal.backends.%s" % backend]
|
||||
|
@ -92,6 +92,11 @@ def create_dir(directory):
|
||||
os.makedirs(directory, exist_ok=True)
|
||||
|
||||
|
||||
def variable_import(module):
|
||||
"""Import a module dynamically."""
|
||||
__import__(module)
|
||||
|
||||
|
||||
def setup_logging():
|
||||
"""Logging config."""
|
||||
logging.basicConfig(format=("[%(levelname)s\033[0m] "
|
||||
|
Loading…
x
Reference in New Issue
Block a user