10637.3.1
by Guilherme Salgado
Use the default python version instead of a hard-coded version |
1 |
#!/usr/bin/python -S
|
9636.4.2
by Michael Hudson
add some boilerplate |
2 |
#
|
3 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
5 |
||
6 |
import _pythonpath |
|
7 |
||
9636.4.33
by Michael Hudson
failing scripty tests |
8 |
from lp.codehosting.branchdistro import DistroBrancher |
9590.1.82
by Michael Hudson
start fixing the branch-distro tests |
9 |
from lp.codehosting.vfs import get_rw_server |
9636.4.33
by Michael Hudson
failing scripty tests |
10 |
from lp.services.scripts.base import LaunchpadScript, LaunchpadScriptFailure |
9636.4.2
by Michael Hudson
add some boilerplate |
11 |
|
12 |
||
9636.4.10
by Michael Hudson
blah |
13 |
class BranchDistroScript(LaunchpadScript): |
9636.4.41
by Michael Hudson
address review comments |
14 |
|
9636.4.10
by Michael Hudson
blah |
15 |
usage = "%prog distro old-series new-series" |
9636.4.33
by Michael Hudson
failing scripty tests |
16 |
|
17 |
def add_my_options(self): |
|
18 |
self.parser.add_option( |
|
19 |
'--check', dest="check", action="store_true", default=False, |
|
20 |
help=("Check that the new distro series has its official " |
|
21 |
"branches set up correctly.")) |
|
22 |
||
9636.4.2
by Michael Hudson
add some boilerplate |
23 |
def main(self): |
9636.4.10
by Michael Hudson
blah |
24 |
if len(self.args) != 3: |
25 |
self.parser.error("Wrong number of arguments.") |
|
9636.4.33
by Michael Hudson
failing scripty tests |
26 |
brancher = DistroBrancher.fromNames(self.logger, *self.args) |
9590.1.82
by Michael Hudson
start fixing the branch-distro tests |
27 |
server = get_rw_server(direct_database=True) |
10197.5.9
by Michael Hudson
even more |
28 |
server.start_server() |
9636.4.36
by Michael Hudson
er, hooray unit tests |
29 |
try: |
30 |
if self.options.check: |
|
31 |
if not brancher.checkNewBranches(): |
|
32 |
raise LaunchpadScriptFailure("Check failed") |
|
33 |
else: |
|
34 |
brancher.makeNewBranches() |
|
35 |
finally: |
|
10197.5.9
by Michael Hudson
even more |
36 |
server.stop_server() |
9636.4.2
by Michael Hudson
add some boilerplate |
37 |
|
38 |
if __name__ == '__main__': |
|
9636.4.10
by Michael Hudson
blah |
39 |
BranchDistroScript("branch-distro", dbuser='branch-distro').run() |