~ubuntu-branches/ubuntu/hardy/gnue-common/hardy

« back to all changes in this revision

Viewing changes to src/rpc/RpcDoc.py

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-03-09 11:06:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050309110631-8gvvn39q7tjz1kj6
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file is part of GNU Enterprise.
 
3
#
 
4
# GNU Enterprise is free software; you can redistribute it
 
5
# and/or modify it under the terms of the GNU General Public
 
6
# License as published by the Free Software Foundation; either
 
7
# version 2, or (at your option) any later version.
 
8
#
 
9
# GNU Enterprise is distributed in the hope that it will be
 
10
# useful, but WITHOUT ANY WARRANTY; without even the implied
 
11
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
12
# PURPOSE. See the GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public
 
15
# License along with program; see the file COPYING. If not,
 
16
# write to the Free Software Foundation, Inc., 59 Temple Place
 
17
# - Suite 330, Boston, MA 02111-1307, USA.
 
18
#
 
19
# Copyright 2001-2005 Free Software Foundation
 
20
#
 
21
# FILE:
 
22
# RpcDoc.py
 
23
#
 
24
# DESCRIPTION:
 
25
# Frontend to GnuRpc documentation commands.
 
26
#
 
27
# SYNTAX:
 
28
#
 
29
#  grpcdoc <module> <command> [ <grpc-file> [<output-file>] ]
 
30
#  grpcdoc <module> help
 
31
#  grpcdoc help
 
32
#
 
33
 
 
34
 
 
35
import sys, string
 
36
from gnue.common.utils.FileUtils import dyn_import
 
37
 
 
38
def run (interface, command, *arguments):
 
39
  try:
 
40
    commdriver = dyn_import("gnue.common.rpc.drivers.%s.RpcDoc" % (interface))
 
41
    commdriver.doc(sys.stdout,command, *arguments)
 
42
  except ImportError, err:
 
43
    print _("GNUe RPC Documentation Generator")
 
44
    print ""
 
45
    print o(u_("Error: the module %s does not exist or cannot be loaded") % \
 
46
          (interface))
 
47
    print ""
 
48
 
 
49
  return ""
 
50
 
 
51
 
 
52
def help():
 
53
  print """
 
54
GNUe RPC Documentation Generator
 
55
 
 
56
Description:
 
57
  grpcdoc generates documentation and IDLs based on an XML-based
 
58
  .grpc markup.
 
59
 
 
60
Syntax:
 
61
  grpcdoc <module> <command> [ <grpc-file> [<output-file>] ]
 
62
  grpcdoc <module> help
 
63
  grpcdoc help
 
64
 
 
65
Examples:
 
66
 
 
67
  1. To generate documentation on the exposed XML-RPC services, run:
 
68
        grpcdoc xmlrpc doc myapp.grpc
 
69
 
 
70
  2. To generate a CORBA IDL definition, run:
 
71
        grpcdoc corba idl myapp.grpc
 
72
 
 
73
  3. To see what commands are available for the soap module, run:
 
74
        grpcdoc soap help
 
75
 
 
76
"""
 
77
 
 
78
 
 
79
 
 
80
if __name__ == '__main__':
 
81
 
 
82
  if   len(sys.argv) < 2 or \
 
83
       string.lower(sys.argv[1]) == 'help' or \
 
84
       len(sys.argv) < 3:
 
85
 
 
86
    help()
 
87
 
 
88
  else:
 
89
 
 
90
    run(*sys.argv[1:])
 
91