36
by Martin Pitt, Stefano Rivera, Michael Bienia, Benjamin Drung, Michael Vogt, Martin Pitt
[ Stefano Rivera ] |
1 |
#!/usr/bin/python
|
2 |
#
|
|
3 |
# Copyright (C) 2010, Benjamin Drung <bdrung@ubuntu.com>
|
|
4 |
#
|
|
5 |
# Permission to use, copy, modify, and/or distribute this software for any
|
|
6 |
# purpose with or without fee is hereby granted, provided that the above
|
|
7 |
# copyright notice and this permission notice appear in all copies.
|
|
8 |
#
|
|
9 |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10 |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11 |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12 |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13 |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14 |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15 |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
18.1.58
by Michael Bienia, Michael Bienia, Jonathan Davies, Colin Watson, Luke Yelavich, Iain Lane
[ Michael Bienia ] |
16 |
|
18.1.83
by Luca Falavigna, Andrew Starr-Bochicchio, Benjamin Drung, Michael Bienia, Steve Beattie
[ Andrew Starr-Bochicchio ] |
17 |
import optparse |
18.1.58
by Michael Bienia, Michael Bienia, Jonathan Davies, Colin Watson, Luke Yelavich, Iain Lane
[ Michael Bienia ] |
18 |
import os |
19 |
import sys |
|
29
by Luca Falavigna, Dustin Kirkland, Kees Cook, Benjamin Drung, Stefano Rivera, Iain Lane, Michael Bienia, Colin Watson
[ Dustin Kirkland ] |
20 |
|
70
by Stefano Rivera, Stefano Rivera, Evan Broder
[ Stefano Rivera ] |
21 |
from ubuntutools.update_maintainer import (update_maintainer, |
22 |
restore_maintainer, |
|
23 |
MaintainerUpdateException) |
|
24 |
||
36
by Martin Pitt, Stefano Rivera, Michael Bienia, Benjamin Drung, Michael Vogt, Martin Pitt
[ Stefano Rivera ] |
25 |
|
26 |
def main(): |
|
27 |
script_name = os.path.basename(sys.argv[0]) |
|
28 |
usage = "%s [options]" % (script_name) |
|
29 |
epilog = "See %s(1) for more info." % (script_name) |
|
30 |
parser = optparse.OptionParser(usage=usage, epilog=epilog) |
|
31 |
parser.add_option("-d", "--debian-directory", dest="debian_directory", |
|
32 |
help="location of the 'debian' directory (default: " |
|
33 |
"%default).", metavar="PATH", default="./debian") |
|
70
by Stefano Rivera, Stefano Rivera, Evan Broder
[ Stefano Rivera ] |
34 |
parser.add_option("-r", "--restore", |
35 |
help="Restore the original maintainer", |
|
36 |
action='store_true', default=False) |
|
36
by Martin Pitt, Stefano Rivera, Michael Bienia, Benjamin Drung, Michael Vogt, Martin Pitt
[ Stefano Rivera ] |
37 |
parser.add_option("-q", "--quiet", help="print no informational messages", |
38 |
dest="quiet", action="store_true", default=False) |
|
39 |
(options, args) = parser.parse_args() |
|
40 |
||
41 |
if len(args) != 0: |
|
42 |
print >> sys.stderr, ("%s: Error: Unsupported additional parameters " |
|
43 |
"specified: %s") % (script_name, ", ".join(args)) |
|
44 |
sys.exit(1) |
|
45 |
||
70
by Stefano Rivera, Stefano Rivera, Evan Broder
[ Stefano Rivera ] |
46 |
if not options.restore: |
47 |
operation = update_maintainer |
|
48 |
else: |
|
49 |
operation = restore_maintainer |
|
50 |
||
51 |
try: |
|
52 |
operation(options.debian_directory, not options.quiet) |
|
53 |
except MaintainerUpdateException: |
|
54 |
sys.exit(1) |
|
36
by Martin Pitt, Stefano Rivera, Michael Bienia, Benjamin Drung, Michael Vogt, Martin Pitt
[ Stefano Rivera ] |
55 |
|
56 |
if __name__ == "__main__": |
|
57 |
main() |