mirror of
https://github.com/beetbox/beets.git
synced 2025-12-29 20:12:33 +01:00
Move the included file loading out of confit.py.
This commit is contained in:
parent
bfc5a1b803
commit
168a1645e0
2 changed files with 12 additions and 10 deletions
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
import beets.library
|
||||
from beets.util import confit
|
||||
|
||||
|
|
@ -23,3 +25,13 @@ __author__ = 'Adrian Sampson <adrian@radbox.org>'
|
|||
Library = beets.library.Library
|
||||
|
||||
config = confit.LazyConfig('beets', __name__)
|
||||
|
||||
try:
|
||||
included_filenames = config['include'].get(list)
|
||||
except confit.NotFoundError:
|
||||
included_filenames = []
|
||||
|
||||
for filename in included_filenames:
|
||||
filename = os.path.join(config.config_dir(), filename)
|
||||
if os.path.isfile(filename):
|
||||
config.set_file(filename)
|
||||
|
|
|
|||
|
|
@ -779,16 +779,6 @@ class Configuration(RootView):
|
|||
if os.path.isfile(filename):
|
||||
self.add(ConfigSource(load_yaml(filename) or {}, filename))
|
||||
|
||||
try:
|
||||
included_filenames = self['include'].get(list)
|
||||
except NotFoundError:
|
||||
included_filenames = []
|
||||
|
||||
for filename in included_filenames:
|
||||
filename = os.path.join(self.config_dir(), filename)
|
||||
if os.path.isfile(filename):
|
||||
self.add(ConfigSource(load_yaml(filename) or {}, filename))
|
||||
|
||||
def _add_default_source(self):
|
||||
"""Add the package's default configuration settings. This looks
|
||||
for a YAML file located inside the package for the module
|
||||
|
|
|
|||
Loading…
Reference in a new issue