diff --git a/openxcap b/openxcap index b4b92d6..2780df5 100644 --- a/openxcap +++ b/openxcap @@ -1,76 +1,70 @@ #!/usr/bin/env python # Copyright (C) 2007-2015 AG Projects. # """OpenXCAP""" MEMORY_DEBUG = False if __name__ == '__main__': import sys from optparse import OptionParser from application.process import process, ProcessError from application import log import xcap name = 'openxcap' description = 'An open source XCAP Server' version = xcap.__version__ fullname = 'OpenXCAP %s' % version config_directory = '/etc/openxcap' runtime_directory = '/var/run/openxcap' default_pid = "%s/%s.pid" % (runtime_directory, name) parser = OptionParser(version="%%prog %s" % version) parser.add_option("--no-fork", action="store_false", dest="fork", default=1, help="run the process in the foreground (for debugging)") parser.add_option("--pid", dest="pidfile", default=default_pid, help="pid file (%s)" % default_pid, metavar="File") (options, args) = parser.parse_args() - try: - xcap.dependencies.check() - except xcap.DependencyError, e: - log.fatal(str(e)) - sys.exit(1) - pidfile = options.pidfile process.system_config_directory = config_directory if not options.fork: process._runtime_directory = None else: try: process.runtime_directory = runtime_directory process.daemonize(pidfile) except ProcessError, e: log.msg("Fatal error: %s" % e) sys.exit(1) else: from xcap.logutil import start_log start_log() log.msg("Starting %s" % fullname) try: if not options.fork and MEMORY_DEBUG: from application.debug.memory import memory_dump from xcap.server import XCAPServer server = XCAPServer() server.start() except Exception, e: log.fatal("failed to create %s: %s" % (fullname, e)) if e.__class__ is not RuntimeError: log.err() sys.exit(1) if not options.fork and MEMORY_DEBUG: print "------------------" memory_dump() print "------------------" diff --git a/xcap/__init__.py b/xcap/__init__.py index eb24424..5b4ce9b 100644 --- a/xcap/__init__.py +++ b/xcap/__init__.py @@ -1,43 +1,9 @@ # Copyright (C) 2007-2010 AG-Projects. # """XCAP package""" __version__ = "2.3.0" __cfgfile__ = "config.ini" - -# python-lxml and python-sqlobject don't provide any usable version attribute. -package_requirements = {'python-application': '1.4.0', - 'python-gnutls': '1.1.8', - 'twisted': '8.1.0'} - -try: - from application.dependency import ApplicationDependencies, PackageDependency, DependencyError -except ImportError: - class DependencyError(Exception): pass - - class ApplicationDependencies(object): - def __init__(self, *args, **kw): - pass - def check(self): - required_version = package_requirements['python-application'] - raise DependencyError("need python-application version %s or higher but it's not installed" % required_version) - - class PackageDependency(object): - def __init__(self, name, required_version, version_attribute=None): - required_version = package_requirements['python-application'] - raise DependencyError("need python-application version %s or higher but it's not installed" % required_version) - -package_dependencies = [PackageDependency('python-mysqldb', '1.2.2', 'MySQLdb.__version__')] -dependencies = ApplicationDependencies(*package_dependencies, **package_requirements) - -# web2 is not included anymore with twisted tarballs, but it's still on svn -# and all functionality hasn't been migrated to web yet. -Saul -try: - import twisted.web2 -except ImportError: - raise DependencyError("Twisted's web2 component is missing. Check http://twistedmatrix.com/trac/wiki/Downloads") -del twisted.web2 -