mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
add lpinstance/no-conf options, fix manpage
This commit is contained in:
parent
d94994b1f4
commit
7a45eede4a
38
bitesize
38
bitesize
@ -27,26 +27,34 @@ from optparse import OptionParser
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
from launchpadlib.errors import HTTPError
|
||||
|
||||
def die(message):
|
||||
print >> sys.stderr, "Fatal: " + message
|
||||
from ubuntutools.logger import Logger
|
||||
from ubuntutools.config import UDTConfig
|
||||
|
||||
def error_out(msg):
|
||||
Logger.error(msg)
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
usage = "Usage: %prog <bug number>"
|
||||
opt_parser = OptionParser(usage)
|
||||
opt_parser.add_option("-l", "--lpinstance", metavar="INSTANCE",
|
||||
help="Launchpad instance to connect to "
|
||||
"(default: production)",
|
||||
dest="lpinstance", default=None)
|
||||
opt_parser.add_option("--no-conf",
|
||||
help="Don't read config files or "
|
||||
"environment variables.",
|
||||
dest="no_conf", default=False, action="store_true")
|
||||
(options, args) = opt_parser.parse_args()
|
||||
|
||||
config = UDTConfig(options.no_conf)
|
||||
if options.lpinstance is None:
|
||||
options.lpinstance = config.get_value("LPINSTANCE")
|
||||
if len(args) < 1:
|
||||
opt_parser.error("Need at least one bug number.")
|
||||
|
||||
launchpad = None
|
||||
try:
|
||||
launchpad = Launchpad.login_with("ubuntu-dev-tools", "production")
|
||||
except ImportError:
|
||||
suggestion = "check whether python-launchpadlib is installed"
|
||||
launchpad = Launchpad.login_with("ubuntu-dev-tools", options.lpinstance)
|
||||
if launchpad is None:
|
||||
die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \
|
||||
(suggestion, ))
|
||||
error_out("Couldn't authenticate to Launchpad.")
|
||||
|
||||
# check that the new main bug isn't a duplicate
|
||||
try:
|
||||
@ -55,15 +63,15 @@ def main():
|
||||
if error.response.status == 401:
|
||||
print >> sys.stderr, ("E: Don't have enough permissions to access "
|
||||
"bug %s") % (args[0])
|
||||
die(error.content)
|
||||
error_out(error.content)
|
||||
else:
|
||||
raise
|
||||
if 'bitesize' not in bug.tags:
|
||||
bug.tags += ['bitesize']
|
||||
content = """I'm marking this bug as 'bitesize' as it looks like an issue that
|
||||
is easy to fix and suitable for newcomers in Ubuntu development. If you need
|
||||
any help with fixing it, talk to me (https://launchpad.net/~%s) about it.""" % \
|
||||
(launchpad.me.name)
|
||||
content = """I'm marking this bug as 'bitesize' as it looks like an issue
|
||||
that is easy to fix and suitable for newcomers in Ubuntu development. If you
|
||||
need any help with fixing it, talk to me (https://launchpad.net/~%s) about
|
||||
it.""" % (launchpad.me.name)
|
||||
bug.newMessage(content=content, subject="bitesize bug")
|
||||
bug.lp_save()
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
.TH bitesize "1" "May 9 2010" "ubuntu-dev-tools"
|
||||
.SH NAME
|
||||
Add \fIbitesize\fI tag to bugs and add a comment.
|
||||
Add \fBbitesize\fR tag to bugs and add a comment.
|
||||
bitesize \- mark one or more bugs as duplicate of another bug
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B bitesize \fR<\fIbug number\fI>\fR
|
||||
.B bitesize <\fIbug number\fI>
|
||||
.br
|
||||
.B bitesize \-\-help
|
||||
|
||||
@ -20,6 +20,30 @@ Listed below are the command line options for \fBbitesize\fR:
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Display a help message and exit.
|
||||
.TP
|
||||
.B \-l \fIINSTANCE\fR, \fB\-\-lpinstance\fR=\fIINSTANCE\fR
|
||||
Use the specified instance of Launchpad (e.g. "staging"), instead of
|
||||
the default of "production".
|
||||
.TP
|
||||
.B \-\-no\-conf
|
||||
Do not read any configuration files, or configuration from environment
|
||||
variables.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
All of the \fBCONFIGURATION VARIABLES\fR below are also supported as
|
||||
environment variables.
|
||||
Variables in the environment take precedence to those in configuration
|
||||
files.
|
||||
|
||||
.SH CONFIGURATION VARIABLES
|
||||
The following variables can be set in the environment or in
|
||||
.BR ubuntu\-dev\-tools (5)
|
||||
configuration files.
|
||||
In each case, the script\-specific variable takes precedence over the
|
||||
package\-wide variable.
|
||||
.TP
|
||||
.BR LP_SET_DUP_LPINSTANCE ", " UBUNTUTOOLS_LPINSTANCE
|
||||
The default value for \fB--lpinstance\fR.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR ubuntu\-dev\-tools (5)
|
||||
|
Loading…
x
Reference in New Issue
Block a user