Skip to content

Commit

Permalink
core: Add a [core] config section
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jodal committed Jul 16, 2015
1 parent a99e161 commit c69c686
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions mopidy/core/__init__.py
Expand Up @@ -2,6 +2,7 @@

# flake8: noqa
from .actor import Core
from .ext import Extension
from .history import HistoryController
from .library import LibraryController
from .listener import CoreListener
Expand Down
1 change: 1 addition & 0 deletions mopidy/core/ext.conf
@@ -0,0 +1 @@
[core]
25 changes: 25 additions & 0 deletions mopidy/core/ext.py
@@ -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 change: 1 addition & 0 deletions setup.py
Expand Up @@ -34,6 +34,7 @@ def get_version(filename):
'mopidy = mopidy.__main__:main',
],
'mopidy.ext': [
'core = mopidy.core:Extension',
'http = mopidy.http:Extension',
'local = mopidy.local:Extension',
'file = mopidy.file:Extension',
Expand Down

0 comments on commit c69c686

Please sign in to comment.