mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
lp-set-dup: Config file support
This commit is contained in:
parent
bcf9772206
commit
dc6b404bc9
@ -15,11 +15,38 @@ then perform required tasks on Launchpad.
|
||||
.SH OPTIONS
|
||||
Listed below are the command line options for \fBlp\-set\-dup\fR:
|
||||
.TP
|
||||
.B \-h or \-\-help
|
||||
.BR \-h ", " \-\-help
|
||||
Display a help message and exit.
|
||||
.TP
|
||||
.B \-f
|
||||
Skip confirmation prompt.
|
||||
.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 BACKPORTPACKAGE_LPINSTANCE ", " UBUNTUTOOLS_LPINSTANCE
|
||||
The default value for \fB--lpinstance\fR.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR ubuntu\-dev\-tools (5)
|
||||
|
||||
.SH AUTHORS
|
||||
\fBlp\-set\-dup\fR was written by Loïc Minier <lool@dooz.org>,
|
||||
|
25
lp-set-dup
25
lp-set-dup
@ -23,12 +23,13 @@
|
||||
# Loïc Minier <lool@dooz.org>
|
||||
|
||||
import sys
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
import ubuntutools.lp.libsupport as lp_libsupport
|
||||
from launchpadlib.errors import HTTPError
|
||||
|
||||
import ubuntutools.lp.libsupport as lp_libsupport
|
||||
from ubuntutools.config import UDTConfig
|
||||
|
||||
def die(message):
|
||||
print >> sys.stderr, "Fatal: " + message
|
||||
sys.exit(1)
|
||||
@ -36,19 +37,29 @@ def die(message):
|
||||
if __name__ == '__main__':
|
||||
usage = "Usage: %prog [-f] <new main bug> <bug to dup> [<bug to dup>...]"
|
||||
optParser = OptionParser(usage)
|
||||
optParser.add_option("-f", action = "store_true",
|
||||
dest = "force", default = False,
|
||||
help = "Skip confirmation prompt")
|
||||
|
||||
optParser.add_option("-f",
|
||||
help="Skip confirmation prompt",
|
||||
dest="force", default=False, action="store_true")
|
||||
optParser.add_option("-l", "--lpinstance", metavar="INSTANCE",
|
||||
help="Launchpad instance to connect to (default: production)",
|
||||
dest="lpinstance", default=None)
|
||||
optParser.add_option("--no-conf",
|
||||
help="Don't read config files or environment variables.",
|
||||
dest="no_conf", default=False, action="store_true")
|
||||
(options, args) = optParser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
optParser.error("Need at least a new main bug and a bug to dup")
|
||||
|
||||
config = UDTConfig(options.no_conf)
|
||||
if options.lpinstance is None:
|
||||
options.lpinstance = config.get_value("LPINSTANCE")
|
||||
|
||||
launchpad = None
|
||||
try:
|
||||
print "Setting up Launchpad"
|
||||
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools")
|
||||
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools",
|
||||
server=options.lpinstance)
|
||||
print "Launchpad setup complete"
|
||||
except ImportError:
|
||||
suggestion = "check whether python-launchpadlib is installed"
|
||||
|
Loading…
x
Reference in New Issue
Block a user