diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rwxr-xr-x | kolab.py | 41 | ||||
-rw-r--r-- | kolab/__init__.py | 1 | ||||
-rw-r--r-- | kolab/__init__.py.in | 0 | ||||
-rw-r--r-- | kolabd/__init__.py | 12 | ||||
-rw-r--r-- | kolabd/__init__.py.in | 125 | ||||
-rw-r--r-- | pykolab/__init__.py | 28 | ||||
-rw-r--r-- | pykolab/cli/__init__.py (renamed from pykolab/__init__.py.in) | 21 | ||||
-rw-r--r-- | pykolab/constants.py.in (renamed from pykolab/constants.py) | 14 |
10 files changed, 96 insertions, 153 deletions
diff --git a/Makefile.am b/Makefile.am index 797fb36..a0b4e39 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,10 @@ DISTCLEANFILES = \ EXTRA_DIST = \ AUTHORS \ + ChangeLog \ COPYING \ + INSTALL \ + NEWS \ README execdir = $(sbindir) diff --git a/configure.ac b/configure.ac index d8129a3..eb1a567 100644 --- a/configure.ac +++ b/configure.ac @@ -19,9 +19,7 @@ AC_SUBST(DATESTAMP,`date +"%a %b %d %Y"`) AC_CONFIG_FILES([ Makefile -kolab/__init__.py -kolabd/__init__.py -pykolab/__init__.py +pykolab/constants.py ]) AC_OUTPUT diff --git a/kolab.py b/kolab.py new file mode 100755 index 0000000..ead23d8 --- /dev/null +++ b/kolab.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# +# Copyright 2010 Kolab Systems AG (http://www.kolabsys.com) +# +# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> +# +# 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; version 2 only +# +# 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +import logging +import os +import sys + +# For development purposes +sys.path.extend(['.', '..']) + +from pykolab.translate import _ +from pykolab.cli import Cli + +try: + import pykolab.logger +except ImportError, e: + print >> sys.stderr, _("Cannot load pykolab/logger.py:") + print >> sys.stderr, "%s" % e + sys.exit(1) + +if __name__ == "__main__": + kolab = Cli() + kolab.run() + diff --git a/kolab/__init__.py b/kolab/__init__.py index e69de29..a136346 100644 --- a/kolab/__init__.py +++ b/kolab/__init__.py @@ -0,0 +1 @@ +from pykolab.constants import * diff --git a/kolab/__init__.py.in b/kolab/__init__.py.in deleted file mode 100644 index e69de29..0000000 --- a/kolab/__init__.py.in +++ /dev/null diff --git a/kolabd/__init__.py b/kolabd/__init__.py index 0cbb477..74bb2be 100644 --- a/kolabd/__init__.py +++ b/kolabd/__init__.py @@ -16,18 +16,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -__license__ = "GPLv2+" -__copyright__ = "Kolab Systems AG" -__version__ = 0.1 -__release__ = 0.1 - -if 0.1 < 1: - __status__ = 'snapshot' -elif math.round(0.1,0) < 0.1: - __status__ = 'prerelease' -else: - __status__ = 'stable' - from optparse import OptionParser from ConfigParser import SafeConfigParser diff --git a/kolabd/__init__.py.in b/kolabd/__init__.py.in deleted file mode 100644 index 726e2ed..0000000 --- a/kolabd/__init__.py.in +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright 2010 Kolab Systems AG (http://www.kolabsys.com) -# -# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> -# -# 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; version 2 only -# -# 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 Library General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -__license__ = "GPLv2+" -__copyright__ = "Kolab Systems AG" -__version__ = @VERSION@ -__release__ = @RELEASE@ - -if @RELEASE@ < 1: - __status__ = 'snapshot' -elif math.round(@RELEASE@,0) < @RELEASE@: - __status__ = 'prerelease' -else: - __status__ = 'stable' - -from optparse import OptionParser -from ConfigParser import SafeConfigParser - -import traceback -import shutil - -from pykolab.constants import * -from pykolab.translate import _ - -class KolabDaemon(object): - def __init__(self, init_base=True): - """ - self.args == Arguments passed on the CLI - self.cli_options == Parser results (again, CLI) - self.parser == The actual Parser (from OptionParser) - self.plugins == Our Kolab Plugins - """ - - self.args = None - self.cli_options = None - self.parser = None - self.plugins = None - - # Create and parse the options - self.parse_options() - - def parse_options(self, load_plugins=True): - """ - Create the OptionParser for the options passed to us from runtime - Command Line Interface. - """ - - epilog = "The Kolab Daemon is part of the Kolab Groupware Solution. For" + \ - "about Kolab or PyKolab, visit http://www.kolabsys.com" - - # Enterprise Linux 5 does not have an "epilog" parameter to OptionParser - try: - self.parser = OptionParser(epilog=epilog) - except: - self.parser = OptionParser() - - ## - ## Runtime Options - ## - runtime_group = self.parser.add_option_group(_("Runtime Options")) - runtime_group.add_option( "-d", "--debug", - dest = "debuglevel", - type = 'int', - default = 0, - help = _("Set the debugging verbosity. Maximum is 99")) - - ## - ## Get options from plugins - ## - if load_plugins: - self.plugins = pykolab.plugins.KolabPlugins(init=True) - self.plugins.add_options(self.parser) - - # Parse Options - (self.cli_options, self.args) = self.parser.parse_args() - - def run(self): - """Run Forest, RUN!""" - - exitcode = 0 - - try: - self.base.run() - except SystemExit, e: - exitcode = e - except KeyboardInterrupt: - exitcode = 1 - self.base.log.info(_("Interrupted by user")) - except AttributeError, e: - exitcode = 1 - traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://issues.kolab.org") - except TypeError, e: - self.log.error(_("Type Error: %s") % e) - except: - exitcode = 2 - traceback.print_exc() - print >> sys.stderr, _("Traceback occurred, please report a bug at http://issues.kolab.org") - finally: - if self.base.cfg.clean_up == 0: - # Leave everything as it is - pass - if self.base.cfg.clean_up > 0: - # Remove our directories in the working directory - pass - if self.base.cfg.clean_up > 1: - # Remove everything - pass - sys.exit(exitcode) - diff --git a/pykolab/__init__.py b/pykolab/__init__.py new file mode 100644 index 0000000..ac6f538 --- /dev/null +++ b/pykolab/__init__.py @@ -0,0 +1,28 @@ +# Copyright 2010 Kolab Systems AG (http://www.kolabsys.com) +# +# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com> +# +# 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; version 2 only +# +# 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 Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +import traceback +import shutil +import sys + +import pykolab +import pykolab.plugins + +from pykolab.translate import _ +from pykolab.conf import Conf +from pykolab.constants import * diff --git a/pykolab/__init__.py.in b/pykolab/cli/__init__.py index 056f3c6..1b960b2 100644 --- a/pykolab/__init__.py.in +++ b/pykolab/cli/__init__.py @@ -16,18 +16,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -__license__ = "GPLv2+" -__copyright__ = "Kolab Systems AG" -__version__ = @VERSION@ -__release__ = @RELEASE@ - -if @RELEASE@ < 1: - __status__ = 'snapshot' -elif math.round(@RELEASE@,0) < @RELEASE@: - __status__ = 'prerelease' -else: - __status__ = 'stable' - import traceback import shutil import sys @@ -38,3 +26,12 @@ import pykolab.plugins from pykolab.translate import _ from pykolab.conf import Conf +from pykolab.constants import * + +class Cli(object): + def __init__(self): + self.conf = Conf() + print "%r" %(self.conf.args) + + def run(self): + print >> sys.stderr, _("Running") diff --git a/pykolab/constants.py b/pykolab/constants.py.in index 84d4a32..ae4b52f 100644 --- a/pykolab/constants.py +++ b/pykolab/constants.py.in @@ -22,6 +22,18 @@ import sys from pykolab.translate import _ +__license__ = "GPLv2+" +__copyright__ = "Kolab Systems AG" +__version__ = @VERSION@ +__release__ = @RELEASE@ + +if @RELEASE@ < 1: + __status__ = 'snapshot' +elif math.round(@RELEASE@,0) < @RELEASE@: + __status__ = 'prerelease' +else: + __status__ = 'stable' + domain = 'pykolab' epilog = _( "PyKolab is a Kolab Systems product. For more information " + \ @@ -68,4 +80,4 @@ SERVICE_MAP = { 'type': 'openldap', 'description': _('OpenLDAP or compatible') }, - }
\ No newline at end of file + } |