""" Installation for System Configuration $Id$ """ # Copyright 2008-2011 eGovMon # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the eGovernment Monitoring # (eGovMon) # # eGovMon 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. # # eGovMon 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 eGovMon; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA __author__ = "$Author$" __version__ = "$Revision$" __updated__ = "$LastChangedDate$" import sys from distutils.core import setup fail = False def run_tests(): try: # Try to reload system configuration from initial.rdf from sc import SystemConfiguration sc = SystemConfiguration() except NameError: print "Could not load system configuration, continuing with installation" fail = False 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 (not fail or '--force' in sys.argv) and 'install' in sys.argv: print 'Installing' import shutil import os if not os.path.exists('/etc/egovmon'): os.system('mkdir /etc/egovmon') os.system('chmod 755 /etc/egovmon') src, target = './initial.rdf','/etc/egovmon/initial.rdf' if not os.path.exists(target) or (os.path.getmtime(src) > os.path.getmtime(target)): shutil.copy(src, target) else: print 'initial.rdf already exists. New version was not installed' setup(name = "System Configuration", version="0.1", description="System Configuration for the repository.", author="eGovernment Monitirong", author_email="maintainer@egovmon.no", url="http://www.egovmon.no", py_modules=['sc', 'scerror'], data_files=[('',['initial.rdf'])])