lpreport.py :  » IDE » PIDA » pida-0.6beta3 » pida » utils » launchpadder » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » IDE » PIDA 
PIDA » pida 0.6beta3 » pida » utils » launchpadder » lpreport.py
#! /usr/bin/env python

import optparse, sys

import lplib as launchpadlib



def get_opts():
    usage = """
Console\t%prog -n [-r ROOT_URL] -p PRODUCT -t TITLE -c COMMENT
GUI\t%prog [-r ROOT_URL] [-p PRODUCT] [-t TITLE] [-c COMMENT]
Details\t%prog --help"""
    parser = optparse.OptionParser(usage=usage)
    parser.add_option('-r', '--root-url', dest='root_url',
        action='store', type='string',
        help="""The base Launchpad URL. If not given defaults to
the main launchpad at %s.""" % launchpadlib.ROOT_URL)
    parser.add_option('-p', '--product-name', dest='product',
        action='store', type='string',
        help="""The product name to report. This option is compulsory for
console reports, where it will be the actual value.
For GUI reports, it is the prefilled name and can be
changed by the user""")
    parser.add_option('-t', '--title', dest='title',
        action='store', type='string',
        help="""The bug report title. This option is compulsory for
console reports, where it will be the actual value.
For GUI reports, it is the prefilled name and can be
changed by the user""")
    parser.add_option('-c', '--comment', dest='comment',
        action='store', type='string',
        help="""The bug report comment. This option is compulsory for
console reports, where it will be the actual value.
For GUI reports, it is the prefilled name and can be
changed by the user""")
    parser.add_option('-s', '--stdin-comment', dest='stdin_comment',
        action='store_true',
        help = """Read the comment text from stdin (overrides -c)""")
    parser.add_option('-n', '--no-gui', dest='no_gui',
        action='store_true',
        help="""Run in console (non-GUI mode)""")
    parser.add_option('-S', '--show-product', dest='show_product',
        action='store_true',
        help="""Show the product option (GUI only). The default behaviour
without this option is to show the product field if it has
not been priveded on the command line.""")
    opts, args = parser.parse_args()
    opts.product = opts.product or ''
    opts.title = opts.title or ''
    opts.comment = opts.comment or ''
    opts.root_url = opts.root_url or launchpadlib.ROOT_URL
    if opts.stdin_comment:
        opts.comment = sys.stdin.read()
    if not opts.product:
        opts.show_product = True
    if opts.no_gui:
        def _error(msg):
            parser.error('Must provide a %s for console reports' % msg)
        if not opts.product:
            _error('product')
        if not opts.title:
            _error('title')
        if not opts.comment:
            _error('comment')
    return opts, args


if __name__ == '__main__':
    opts, args = get_opts()
    if opts.no_gui:
        launchpadlib.console_report(opts)
    else:
        import gtkgui
        gtkgui.gui_report(opts)
    sys.exit(0)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.