deps: Add executable path to 'mopidy deps' output

This commit is contained in:
Stein Magnus Jodal 2015-03-14 23:07:59 +01:00
parent 336ef4534a
commit aed91008a3
3 changed files with 20 additions and 0 deletions

View File

@ -61,6 +61,10 @@ v0.20.0 (UNRELEASED)
to set the log level for all loggers to the lowest possible value, including to set the log level for all loggers to the lowest possible value, including
log records at levels lover than ``DEBUG`` too. log records at levels lover than ``DEBUG`` too.
- Add path to the current ``mopidy`` executable to the output of ``mopidy
deps``. This make it easier to see that a user is using pip-installed Mopidy
instead of APT-installed Mopidy without asking for ``which mopidy`` output.
**Configuration** **Configuration**
- Add support for the log level value ``all`` to the loglevels configurations. - Add support for the log level value ``all`` to the loglevels configurations.

View File

@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import functools import functools
import os import os
import platform import platform
import sys
import pygst import pygst
pygst.require('0.10') pygst.require('0.10')
@ -24,6 +25,7 @@ def format_dependency_list(adapters=None):
for dist_name in dist_names] for dist_name in dist_names]
adapters = [ adapters = [
executable_info,
platform_info, platform_info,
python_info, python_info,
functools.partial(pkg_info, 'Mopidy', True) functools.partial(pkg_info, 'Mopidy', True)
@ -63,6 +65,13 @@ def _format_dependency(dep_info):
return '\n'.join(lines) return '\n'.join(lines)
def executable_info():
return {
'name': 'Executable',
'version': sys.argv[0],
}
def platform_info(): def platform_info():
return { return {
'name': 'Platform', 'name': 'Platform',

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import platform import platform
import sys
import unittest import unittest
import mock import mock
@ -46,6 +47,12 @@ class DepsTest(unittest.TestCase):
self.assertIn(' pylast: 0.5', result) self.assertIn(' pylast: 0.5', result)
self.assertIn(' setuptools: 0.6', result) self.assertIn(' setuptools: 0.6', result)
def test_executable_info(self):
result = deps.executable_info()
self.assertEqual('Executable', result['name'])
self.assertIn(sys.argv[0], result['version'])
def test_platform_info(self): def test_platform_info(self):
result = deps.platform_info() result = deps.platform_info()