1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#
# $Id: info.py,v 1.1 1999/12/11 12:35:11 rob Exp $
#
# Copyright 1999 Rob Tillotson <robt@debian.org>
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee or royalty is
# hereby granted, provided that the above copyright notice appear in
# all copies and that both the copyright notice and this permission
# notice appear in supporting documentation or portions thereof,
# including modifications, that you you make.
#
# THE AUTHOR ROB TILLOTSON DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE!
#
"""
"""
__version__ = '$Id: info.py,v 1.1 1999/12/11 12:35:11 rob Exp $'
__copyright__ = 'Copyright 1999 Rob Tillotson <robt@debian.org>'
import string, sys, os
import Pyrite
from Pyrite import _
from Pyrite.Application import Application
from Sulfur.Options import Boolean, String, O_NOCONFIG, O_NONINTERACTIVE, O_MULTIPLE
import Sulfur
class App(Application):
name = 'Pyrite Info'
version = Pyrite.version
author = Pyrite.author
description = _("Print information about the Pyrite installation.")
options = [
Boolean('all', None, _('list all available information'),
None, (O_NOCONFIG, O_NONINTERACTIVE), ['all', 'a']),
String('plugins', '', _('list plugins in a particular collection'),
None, (O_NOCONFIG, O_NONINTERACTIVE, O_MULTIPLE), ['plugins', 'p']),
]
def __init__(self):
Application.__init__(self)
self.config_path = 'Pyrite::Info'
def info_header(self):
print _("Pyrite Version : %s") % Pyrite.version
print _("Sulfur Version : %s") % Sulfur.version
print
def info_python(self):
print _("Python Platform : %s") % sys.platform
print _("Python Version : %s") % sys.version
def info_defaults(self):
print
print _("Data Directory : %s") % self.data_directory
print _("Port : %s") % self.port
print _("User Name : %s") % self.default_user
print _("User ID : %s") % self.default_uid
if self.plugin_module_path:
print
p = self.plugin_module_path[0]
print _("Plugin Path : %s") % (p and p or _("(current package)"))
for p in self.plugin_module_path[1:]:
print " : %s" % (p and p or _("(current package)"))
def info_state(self):
print
print _("Current User : %s") % self.user
print _("Current User ID : %s") % self.uid
print _("Sync ID : %s") % self.sync_id
def info_plugins(self, collection, title=None, verbose=0):
inf = self.list_plugin_info(collection)
ky = inf.keys()
ky.sort()
if not title: title = _("Plugins in collection '%s':") % collection
print title
print
print _("Name Version Description")
print _("---- ------- -----------")
for k in ky:
i = inf[k]
print _("%-15s %-8s %s") % (k[:15], i['version'][:8],
string.split(i['description'],'\n')[0][:54])
print
def info_products(self):
print
print _("Installed Products:")
l = self.product_list()
if not l: print _(" No products are installed.")
else:
for p in l:
print " %-15s %-10s %-50s" % \
(p['name'][:15], p['version'][:10],
string.split(p['description'],'\n')[0][:50])
def run(self, argv):
if not self.get_option('plugins'):
self.info_header()
self.info_python()
self.info_defaults()
self.info_state()
self.info_products()
print
if self.get_option('all'):
print
self.info_plugins('Connector', _("Connectors:"))
print
self.info_plugins('Conduit', _("Conduits:"))
#self.info_plugins('Filter', _("Filters:"))
print
self.info_plugins('Store', _("Stores:"))
print
self.info_plugins('Application', _("Applications:"))
else:
for p in self.get_option('plugins'):
print
self.info_plugins(p)
|