core: Add a [core] config section
I deemed it better to make core an extension (that cannot be disabled) rather than add a special case throughout the config handling to make it possible to have config section that doesn't belong to an extension. This change is needed for #997. Until #997 is completed, Mopidy will complain that core has now config schema (because it is empty) and claim that core is disabled. This of course has no practical effects.
This commit is contained in:
parent
a99e161aab
commit
c69c68648b
@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
|||||||
|
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
from .actor import Core
|
from .actor import Core
|
||||||
|
from .ext import Extension
|
||||||
from .history import HistoryController
|
from .history import HistoryController
|
||||||
from .library import LibraryController
|
from .library import LibraryController
|
||||||
from .listener import CoreListener
|
from .listener import CoreListener
|
||||||
|
|||||||
1
mopidy/core/ext.conf
Normal file
1
mopidy/core/ext.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
[core]
|
||||||
25
mopidy/core/ext.py
Normal file
25
mopidy/core/ext.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import mopidy
|
||||||
|
from mopidy import config, ext
|
||||||
|
|
||||||
|
|
||||||
|
class Extension(ext.Extension):
|
||||||
|
|
||||||
|
dist_name = 'Mopidy-Core'
|
||||||
|
ext_name = 'core'
|
||||||
|
version = mopidy.__version__
|
||||||
|
|
||||||
|
def get_default_config(self):
|
||||||
|
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
|
||||||
|
return config.read(conf_file)
|
||||||
|
|
||||||
|
def get_config_schema(self):
|
||||||
|
schema = super(Extension, self).get_config_schema()
|
||||||
|
del schema['enabled'] # core cannot be disabled
|
||||||
|
return schema
|
||||||
|
|
||||||
|
def setup(self, registry):
|
||||||
|
pass # core has nothing to register
|
||||||
1
setup.py
1
setup.py
@ -34,6 +34,7 @@ setup(
|
|||||||
'mopidy = mopidy.__main__:main',
|
'mopidy = mopidy.__main__:main',
|
||||||
],
|
],
|
||||||
'mopidy.ext': [
|
'mopidy.ext': [
|
||||||
|
'core = mopidy.core:Extension',
|
||||||
'http = mopidy.http:Extension',
|
'http = mopidy.http:Extension',
|
||||||
'local = mopidy.local:Extension',
|
'local = mopidy.local:Extension',
|
||||||
'file = mopidy.file:Extension',
|
'file = mopidy.file:Extension',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user