Browse Source

proper setup.py setup & test

boyska 9 years ago
parent
commit
b1f597deae

+ 3 - 0
.gitignore

@@ -1,2 +1,5 @@
 *.pyc
 .*.sw?
+/dist/
+/*.egg-info
+build

+ 0 - 0
larigira/__init__.py


+ 0 - 0
celeryconfig.py → larigira/celeryconfig.py


+ 0 - 0
eventutils.py → larigira/eventutils.py


+ 4 - 1
mpc.py → larigira/mpc.py

@@ -80,7 +80,7 @@ def on_player_crash(*args, **kwargs):
     sys.exit(1)
 
 
-if __name__ == '__main__':
+def main():
     p = Player()
     p.start()
     p.link_exception(on_player_crash)
@@ -90,3 +90,6 @@ if __name__ == '__main__':
         p.q.put('signal', *args)
     gevent.signal(signal.SIGHUP, sig, signal.SIGHUP)
     gevent.wait()
+
+if __name__ == '__main__':
+    main()

+ 0 - 0
rpc.py → larigira/rpc.py


+ 0 - 0
task.py → larigira/task.py


+ 1 - 1
test_parented.py → larigira/tests/test_parented.py

@@ -6,7 +6,7 @@ import pytest
 
 import gevent
 
-from mpc import Timer, ParentedLet
+from larigira.mpc import Timer, ParentedLet
 
 # TODO: implement simple children and check that we will receive the expected
 # messages on the queue

+ 1 - 1
test_web.py → larigira/tests/test_web.py

@@ -4,7 +4,7 @@ monkey.patch_all(subprocess=True)
 
 import pytest
 
-from rpc import create_app
+from larigira.rpc import create_app
 
 
 @pytest.fixture

+ 45 - 0
setup.py

@@ -0,0 +1,45 @@
+import sys
+
+from setuptools import setup
+from setuptools.command.test import test as TestCommand
+
+
+class PyTest(TestCommand):
+    user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
+
+    def initialize_options(self):
+        TestCommand.initialize_options(self)
+        self.pytest_args = []
+
+    def finalize_options(self):
+        TestCommand.finalize_options(self)
+        self.test_args = []
+        self.test_suite = True
+
+    def run_tests(self):
+        # import here, cause outside the eggs aren't loaded
+        import pytest
+        errno = pytest.main(self.pytest_args)
+        sys.exit(errno)
+
+setup(name='larigira',
+      version='0.1',
+      description='A radio automation based on MPD',
+      author='boyska',
+      author_email='piuttosto@logorroici.org',
+      license='AGPL',
+      packages=['larigira'],
+      install_requires=[
+          'gevent',
+          'flask',
+          'python-mpd2',
+          'redis',
+          'celery'
+      ],
+      tests_require=['pytest'],
+      cmdclass={'test': PyTest},
+      zip_safe=False,
+      entry_points={
+          'console_scripts': ['larigira=larigira.mpc:main']
+      }
+      )