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.launchpad import Launchpad
|
||||||
from launchpadlib.errors import HTTPError
|
from launchpadlib.errors import HTTPError
|
||||||
|
|
||||||
def die(message):
|
from ubuntutools.logger import Logger
|
||||||
print >> sys.stderr, "Fatal: " + message
|
from ubuntutools.config import UDTConfig
|
||||||
|
|
||||||
|
def error_out(msg):
|
||||||
|
Logger.error(msg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "Usage: %prog <bug number>"
|
usage = "Usage: %prog <bug number>"
|
||||||
opt_parser = OptionParser(usage)
|
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()
|
(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:
|
if len(args) < 1:
|
||||||
opt_parser.error("Need at least one bug number.")
|
opt_parser.error("Need at least one bug number.")
|
||||||
|
|
||||||
launchpad = None
|
launchpad = Launchpad.login_with("ubuntu-dev-tools", options.lpinstance)
|
||||||
try:
|
|
||||||
launchpad = Launchpad.login_with("ubuntu-dev-tools", "production")
|
|
||||||
except ImportError:
|
|
||||||
suggestion = "check whether python-launchpadlib is installed"
|
|
||||||
if launchpad is None:
|
if launchpad is None:
|
||||||
die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \
|
error_out("Couldn't authenticate to Launchpad.")
|
||||||
(suggestion, ))
|
|
||||||
|
|
||||||
# check that the new main bug isn't a duplicate
|
# check that the new main bug isn't a duplicate
|
||||||
try:
|
try:
|
||||||
@ -55,15 +63,15 @@ def main():
|
|||||||
if error.response.status == 401:
|
if error.response.status == 401:
|
||||||
print >> sys.stderr, ("E: Don't have enough permissions to access "
|
print >> sys.stderr, ("E: Don't have enough permissions to access "
|
||||||
"bug %s") % (args[0])
|
"bug %s") % (args[0])
|
||||||
die(error.content)
|
error_out(error.content)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
if 'bitesize' not in bug.tags:
|
if 'bitesize' not in bug.tags:
|
||||||
bug.tags += ['bitesize']
|
bug.tags += ['bitesize']
|
||||||
content = """I'm marking this bug as 'bitesize' as it looks like an issue that
|
content = """I'm marking this bug as 'bitesize' as it looks like an issue
|
||||||
is easy to fix and suitable for newcomers in Ubuntu development. If you need
|
that is easy to fix and suitable for newcomers in Ubuntu development. If you
|
||||||
any help with fixing it, talk to me (https://launchpad.net/~%s) about it.""" % \
|
need any help with fixing it, talk to me (https://launchpad.net/~%s) about
|
||||||
(launchpad.me.name)
|
it.""" % (launchpad.me.name)
|
||||||
bug.newMessage(content=content, subject="bitesize bug")
|
bug.newMessage(content=content, subject="bitesize bug")
|
||||||
bug.lp_save()
|
bug.lp_save()
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
.TH bitesize "1" "May 9 2010" "ubuntu-dev-tools"
|
.TH bitesize "1" "May 9 2010" "ubuntu-dev-tools"
|
||||||
.SH NAME
|
.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
|
bitesize \- mark one or more bugs as duplicate of another bug
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B bitesize \fR<\fIbug number\fI>\fR
|
.B bitesize <\fIbug number\fI>
|
||||||
.br
|
.br
|
||||||
.B bitesize \-\-help
|
.B bitesize \-\-help
|
||||||
|
|
||||||
@ -20,6 +20,30 @@ Listed below are the command line options for \fBbitesize\fR:
|
|||||||
.TP
|
.TP
|
||||||
.BR \-h ", " \-\-help
|
.BR \-h ", " \-\-help
|
||||||
Display a help message and exit.
|
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
|
.SH SEE ALSO
|
||||||
.BR ubuntu\-dev\-tools (5)
|
.BR ubuntu\-dev\-tools (5)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user