~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
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
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
13
from canonical.config import config
8356.1.1 by Leonard Richardson
Partial move.
14
from lp.services.scripts.base import LaunchpadCronScript
7793.7.6 by Graham Binns
Added cronscript for updating remote products from sourceforge.
15
from canonical.launchpad.scripts.sfremoteproductfinder import (
16
    SourceForgeRemoteProductFinder)
17
18
19
class UpdateRemoteProductsFromSourceForge(LaunchpadCronScript):
20
21
    def main(self):
22
        start_time = time.time()
23
24
        finder = SourceForgeRemoteProductFinder(self.txn, self.logger)
25
        finder.setRemoteProductsFromSourceForge()
26
27
        run_time = time.time() - start_time
28
        self.logger.info("Time for this run: %.3f seconds." % run_time)
29
30
31
if __name__ == '__main__':
32
    script = UpdateRemoteProductsFromSourceForge(
33
        "updateremoteproduct",
34
        dbuser=config.updatesourceforgeremoteproduct.dbuser)
35
    script.lock_and_run()