#!/usr/bin/env python """The Sampling server package setup""" # Copyright 2005, 2006 EIAO Consoritum # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the European Internet Accessibility Observatory # (EIAO) # # EIAO 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 2 of the License, or # (at your option) any later version. # # EIAO 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 EIAO; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA __owner__ = "Terje Gjosater" __maintainer__ = "Terje Gjosater, Morten Goodwin Olsen" __version__ = 0.1 import sys import os from distutils.core import setup import sc fail = False def run_tests(): global fail import unittest import test runner = unittest.TextTestRunner(verbosity=1) result = runner.run(unittest.TestLoader().loadTestsFromModule(test)) failures = result.failures errors = result.errors if failures or errors: fail = True for res in test.result: if res[0] > 0: fail = True if fail and '--force' not in sys.argv: print 'One of more tests failed. Installation will stop. (add --force to install anyway "'+' '.join(sys.argv) +' --force")' elif fail: print 'One of more tests failed. Installation will continue anyway.' else: print 'Tests ran successful.' if 'test' in sys.argv:# or 'install' in sys.argv: print 'Running tests' try: run_tests() except ImportError, e: print e print 'Required modules not found for test, assuming you are doing a fresh installation' if (not fail or '--force' in sys.argv) and 'install' in sys.argv: print 'Installing' setup(name = "Sampling server", version="2.0", description="Sampling server for the EIAO observatory.", author="European Internet Accessibility Observatory", author_email="developer@eiao.net", url="http://www.eiao.net", scripts=["samplingserver"] ) os.system("cp init.d/samplingserver /etc/init.d/") #TODO: Ask Nils what this next line means os.system("test -f /etc/rc3.d/s94samplingserver || ln -s /etc/init.d/samplingserver /etc/rc3.d/s94samplingserver")