~launchpad-pqm/launchpad/devel

10637.3.1 by Guilherme Salgado
Use the default python version instead of a hard-coded version
1
#!/usr/bin/python -S
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
2
#
14538.2.49 by Curtis Hovey
Updated copyright.
3
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
9678.4.39 by Barry Warsaw
[rs=gary] Fix the test_all_scripts failures by making sure apport_python_hook
6
"""Cron job to update remote_products using SourceForge project data."""
7
7793.7.6 by Graham Binns
Added cronscript for updating remote products from sourceforge.
8
# pylint: disable-msg=W0403
9678.4.39 by Barry Warsaw
[rs=gary] Fix the test_all_scripts failures by making sure apport_python_hook
9
import _pythonpath
7793.7.6 by Graham Binns
Added cronscript for updating remote products from sourceforge.
10
11
import time
12
14612.2.8 by William Grant
cronscripts
13
from lp.bugs.scripts.sfremoteproductfinder import (
14
    SourceForgeRemoteProductFinder,
15
    )
14605.1.1 by Curtis Hovey
Moved canonical.config to lp.services.
16
from lp.services.config import config
8356.1.1 by Leonard Richardson
Partial move.
17
from lp.services.scripts.base import LaunchpadCronScript
7793.7.6 by Graham Binns
Added cronscript for updating remote products from sourceforge.
18
19
20
class UpdateRemoteProductsFromSourceForge(LaunchpadCronScript):
21
22
    def main(self):
23
        start_time = time.time()
24
25
        finder = SourceForgeRemoteProductFinder(self.txn, self.logger)
26
        finder.setRemoteProductsFromSourceForge()
27
28
        run_time = time.time() - start_time
29
        self.logger.info("Time for this run: %.3f seconds." % run_time)
30
31
32
if __name__ == '__main__':
33
    script = UpdateRemoteProductsFromSourceForge(
34
        "updateremoteproduct",
35
        dbuser=config.updatesourceforgeremoteproduct.dbuser)
36
    script.lock_and_run()