From 8e7b69bebf4e951b4971e4795cb6d2c4a164c0f6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 18 Apr 2014 12:16:03 +0100 Subject: Add a setup.py for running test suite --- setup.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 setup.py (limited to 'setup.py') diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f81df5e --- /dev/null +++ b/setup.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python2 +# Copyright 2014 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# =*= License: GPL-3+ =*= + + +from distutils.core import setup, Extension +from distutils.cmd import Command +import glob +import os + +import cliapp + + +class Check(Command): + + user_options = [ + ('unit-tests', 'u', 'run unit tests?'), + ('yarns', 'y', 'run yarn tests locally?'), + ] + + def set_all_options(self, new_value): + self.unit_tests = new_value + self.yarns = new_value + + def initialize_options(self): + self.set_all_options(False) + + def finalize_options(self): + any_set = ( + self.unit_tests or + self.yarns) + if not any_set: + self.set_all_options(True) + + def run(self): + if self.unit_tests: + print "run unit tests" + cliapp.runcmd( + ['python', '-m', 'CoverageTestRunner', + '--ignore-missing-from=without-tests'], + stdout=None, stderr=None) + os.remove('.coverage') + + if self.yarns and got_yarn: + cliapp.runcmd(['yarn'] + glob.glob('yarns/*.yarn'), stdout=None, stderr=None) + + +setup(name='distix', + version='0.0', + description='Distributed ticketing system', + author='Lars Wirzenius', + author_email='liw@liw.fi', + url='http://liw.fi/distix/', + scripts=['distix'], + packages=['distixlib'], + cmdclass={ + 'check': Check, + }, + ) -- cgit v1.2.1