~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/publish-distro.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-07-18 21:50:38 UTC
  • mto: This revision was merged to the branch mainline in revision 13478.
  • Revision ID: jeroen.vermeulen@canonical.com-20110718215038-w8lm6ufp99826y69
Convert publishdistro to a LaunchpadCronScript.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python -S
2
2
#
3
 
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
3
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
4
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
5
 
6
6
# pylint: disable-msg=C0103,W0403
7
7
 
8
8
import _pythonpath
9
9
 
10
 
from optparse import OptionParser
11
 
 
12
10
from canonical.config import config
13
 
from canonical.launchpad.scripts import (
14
 
    execute_zcml_for_scripts, logger)
15
 
from lp.services.scripts.base import LaunchpadScriptFailure
16
 
from canonical.lp import initZopeless
17
 
from lp.soyuz.scripts import publishdistro
 
11
from lp.soyuz.scripts.publishdistro import PublishDistro
18
12
 
19
13
 
20
14
if __name__ == "__main__":
21
 
    parser = OptionParser()
22
 
    publishdistro.add_options(parser)
23
 
    options, args = parser.parse_args()
24
 
    assert len(args) == 0, "publish-distro takes no arguments, only options."
25
 
 
26
 
    log = logger(options, "publish-distro")
27
 
    log.debug("Initializing zopeless.")
28
 
    execute_zcml_for_scripts()
29
 
    txn = initZopeless(dbuser=config.archivepublisher.dbuser)
30
 
 
31
 
    try:
32
 
        publishdistro.run_publisher(options, txn)
33
 
    except LaunchpadScriptFailure, err:
34
 
        log.error(err)
 
15
    script = PublishDistro(dbuser=config.archivepublisher.dbuser)
 
16
    script.run()