From 9fc7e013ff25e971aaa964d8aeaf55ed06936c1a Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 7 Mar 2011 20:11:34 +0100 Subject: [PATCH] Move main() into mopidy.core --- bin/mopidy | 2 +- mopidy/__main__.py | 13 +++---------- mopidy/core.py | 5 +++++ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/bin/mopidy b/bin/mopidy index 0472518e..aabf21d3 100755 --- a/bin/mopidy +++ b/bin/mopidy @@ -1,5 +1,5 @@ #! /usr/bin/env python if __name__ == '__main__': - from mopidy.__main__ import main + from mopidy.core import main main() diff --git a/mopidy/__main__.py b/mopidy/__main__.py index 20e78f5a..169c2754 100644 --- a/mopidy/__main__.py +++ b/mopidy/__main__.py @@ -1,17 +1,10 @@ -import os -import sys - # Add ../ to the path so we can run Mopidy from a Git checkout without # installing it on the system. +import os +import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))) -from mopidy.core import CoreProcess - -def main(): - # Explictly call run() instead of start(), since we don't need to start - # another process. - CoreProcess().run() - if __name__ == '__main__': + from mopidy.core import main main() diff --git a/mopidy/core.py b/mopidy/core.py index 56febe5b..f56bb334 100644 --- a/mopidy/core.py +++ b/mopidy/core.py @@ -12,6 +12,11 @@ from mopidy.utils.settings import list_settings_optparse_callback logger = logging.getLogger('mopidy.core') +def main(): + # Explictly call run() instead of start(), since we don't need to start + # another process. + CoreProcess().run() + class CoreProcess(BaseThread): def __init__(self): self.core_queue = multiprocessing.Queue()