Release v0.14.1

This commit is contained in:
Stein Magnus Jodal 2013-04-28 23:45:49 +02:00
commit 3a2fcc975e
8 changed files with 44 additions and 17 deletions

View File

@ -4,6 +4,15 @@ Changelog
This changelog is used to track all major changes to Mopidy.
v0.14.1 (2013-04-28)
====================
This release addresses an issue in v0.14.0 where the new
:option:`mopidy-convert-config` tool and the new :option:`mopidy --option`
command line option was broken because some string operations inadvertently
converted some byte strings to unicode.
v0.14.0 (2013-04-28)
====================

View File

@ -23,4 +23,4 @@ if (isinstance(pykka.__version__, basestring)
warnings.filterwarnings('ignore', 'could not open display')
__version__ = '0.14.0'
__version__ = '0.14.1'

View File

@ -141,8 +141,8 @@ def _format(config, comments, schemas, display):
def parse_override(override):
"""Parse ``section/key=value`` command line overrides"""
section, remainder = override.split('/', 1)
key, value = remainder.split('=', 1)
section, remainder = override.split(b'/', 1)
key, value = remainder.split(b'=', 1)
return (section.strip(), key.strip(), value.strip())

View File

@ -9,7 +9,7 @@ from mopidy.utils import path
def load():
settings_file = path.expand_path('$XDG_CONFIG_DIR/mopidy/settings.py')
settings_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/settings.py')
print 'Checking %s' % settings_file
setting_globals = {}
@ -109,7 +109,7 @@ def main():
print b'Converted config:\n'
print config_lib.format(config, extensions)
conf_file = path.expand_path('$XDG_CONFIG_DIR/mopidy/mopidy.conf')
conf_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/mopidy.conf')
if os.path.exists(conf_file):
print '%s exists, exiting.' % conf_file
sys.exit(1)

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import logging
import re
import socket
import sys
from mopidy.utils import path
from mopidy.config import validators
@ -254,6 +255,8 @@ class Path(ConfigValue):
return ExpandedPath(value, expanded)
def serialize(self, value, display=False):
if isinstance(value, unicode):
value = value.encode(sys.getfilesystemencoding())
if isinstance(value, ExpandedPath):
return value.original
return value

View File

@ -109,18 +109,24 @@ class ValidateTest(unittest.TestCase):
class ParseOverrideTest(unittest.TestCase):
def test_valid_override(self):
expected = ('section', 'key', 'value')
self.assertEqual(expected, config.parse_override('section/key=value'))
self.assertEqual(expected, config.parse_override('section/key=value '))
self.assertEqual(expected, config.parse_override('section/key =value'))
self.assertEqual(expected, config.parse_override('section /key=value'))
expected = (b'section', b'key', b'value')
self.assertEqual(expected, config.parse_override(b'section/key=value'))
self.assertEqual(expected, config.parse_override(b'section/key=value '))
self.assertEqual(expected, config.parse_override(b'section/key =value'))
self.assertEqual(expected, config.parse_override(b'section /key=value'))
def test_valid_override_is_bytes(self):
section, key, value = config.parse_override(b'section/key=value')
self.assertIsInstance(section, bytes)
self.assertIsInstance(key, bytes)
self.assertIsInstance(value, bytes)
def test_empty_override(self):
expected = ('section', 'key', '')
self.assertEqual(expected, config.parse_override('section/key='))
self.assertEqual(expected, config.parse_override('section/key= '))
self.assertEqual(expected, config.parse_override(b'section/key='))
self.assertEqual(expected, config.parse_override(b'section/key= '))
def test_invalid_override(self):
self.assertRaises(ValueError, config.parse_override, 'section/key')
self.assertRaises(ValueError, config.parse_override, 'section=')
self.assertRaises(ValueError, config.parse_override, 'section')
self.assertRaises(ValueError, config.parse_override, b'section/key')
self.assertRaises(ValueError, config.parse_override, b'section=')
self.assertRaises(ValueError, config.parse_override, b'section')

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import logging
import mock
import socket
import sys
from mopidy.config import types
@ -364,3 +365,10 @@ class PathTest(unittest.TestCase):
def test_serialize_plain_string(self):
value = types.Path()
self.assertEqual('path', value.serialize(b'path'))
def test_serialize_unicode_string(self):
value = types.Path()
expected = 'æøå'.encode(sys.getfilesystemencoding())
result = value.serialize('æøå')
self.assertEqual(expected, result)
self.assertIsInstance(result, bytes)

View File

@ -37,5 +37,6 @@ class VersionTest(unittest.TestCase):
self.assertLess(SV('0.11.0'), SV('0.11.1'))
self.assertLess(SV('0.11.1'), SV('0.12.0'))
self.assertLess(SV('0.12.0'), SV('0.13.0'))
self.assertLess(SV('0.13.0'), SV(__version__))
self.assertLess(SV(__version__), SV('0.14.1'))
self.assertLess(SV('0.13.0'), SV('0.14.0'))
self.assertLess(SV('0.14.0'), SV(__version__))
self.assertLess(SV(__version__), SV('0.14.2'))